Prepare raspbian image
Download wheezy-raspbian image from official site.
http://www.raspberrypi.org/downloads
Unzip downloaded file and put img file under working directory.
Also create following directory for mount target.
- mnt_src_rootfs
- mnt_dist_rootfs
Flash image to sdcard
We don't need rootfs on sdcard finally. But it is useful to check device entry for your external usb storage in this instruction.
# sudo dd bs=1M if=2014-01-07-wheezy-raspbian.img of=/dev/sdc
Mount partitions in image
Check wheezy-raspbian image file with fdisk.
# fdisk -l -u 2014-01-07-wheezy-raspbian.img
Disk 2014-01-07-wheezy-raspbian.img: 2962 MB, 2962227200 bytes
255 heads, 63 sectors/track, 360 cylinders, total 5785600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000981cb
Device Boot Start End Blocks Id System
2014-01-07-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
2014-01-07-wheezy-raspbian.img2 122880 5785599 2831360 83 Linux
Mount 2nd partition with offset.
# sudo mount -o loop,offset=$((122880*512)) 2014-01-07-wheezy-raspbian.img mnt_src_rootfs
Prepare external usb storage
Create ext4 partitions on your extarnal usb storage by fdisk and mkfs.
And mount it as 'mnt_dist_rootfs'.
Copy rootfs
Copy all rootfs files from img file to extarnal usb storage.
# sudo cp -ax mnt_src_rootfs/. mnt_dist_rootfs
Boot Raspberry pi
Insert sdcard and bootup. (Here, rootfs on sdcard is used.)
On raspbian,
- login
- connect usb extarnal usb storage.
- execute dmesg
- Get device entry for the ext4 partition on extarnal usb storage
Modify cmdline.txt
On raspbian,
# nano /boot/cmdline.txt
Modify following path to device entry of rootfs partition on extarnal usb storage.
root=/dev/sdc1
Sync and reboot rasbian.
# sync
That's it.
# reboot 0
That's it.
0 件のコメント:
コメントを投稿