m (→Prepared Image) |
m (→Setting up the Raspberry Pi to boot from Root NFS) |
||
Line 22: | Line 22: | ||
If the disk is correct, delete any existing partitions. | If the disk is correct, delete any existing partitions. | ||
− | Now select <B>n</B> to add a new partition. Select primary partition and other defaults. | + | Now select <B>n</B> to add a new partition. Select primary partition and any other defaults. |
The default partition will now be set for linux. Select <B>t</B> to change a partition's system ID and enter <B>4</B> (FAT16 <32M) | The default partition will now be set for linux. Select <B>t</B> to change a partition's system ID and enter <B>4</B> (FAT16 <32M) |
To assist with more rapid development, I prefer to mount the root filesystem from NFS.
Understanding the Raspberry Pi Boot Process details the bootloaders and files that are required to boot a Raspberry Pi.
I have a handful of 16 megabyte (yes, megabyte) MMC cards lying around that makes perfect boot media for this task.
The Raspberry Pi will boot from either FAT32 or FAT16. The minimum volume size for FAT32 is 32 megabytes, hence if I'm to work with a 16 megabyte MMC, I must format the card with a FAT16 filesystem.
Partition the card using fdisk where /dev/sdb is your SD/MMC block device:
sudo fdisk /dev/sdb
You will now be presented with a menu. First select p to print the current partition table, ensuring you have selected the right disk.
If the disk is correct, delete any existing partitions.
Now select n to add a new partition. Select primary partition and any other defaults.
The default partition will now be set for linux. Select t to change a partition's system ID and enter 4 (FAT16 <32M)
Finally, write the partition table to disk and exit by selecting w.
Now format the card:
sudo mkdosfs /dev/sdb1
Mount the new file system, so you can add the required files:
sudo mount -t msdos /dev/sdb1 /media/card
Copy the following files over to your freshly formatted SD/MMC card:
bootcode.bin start.elf config.txt cmdline.txt kernel.img
You can obtain the files from an existing Raspberry Pi installation, or you can download them from the Raspberry Pi Git Repository:
wget https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin wget https://github.com/raspberrypi/firmware/raw/master/boot/start.elf wget https://github.com/raspberrypi/firmware/raw/master/boot/kernel.img
Create a cmdline.txt file containing the following parameters:
console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=192.168.0.251:/home/cpeacock/export/rootfs ip=192.168.0.250:::::eth0 rootwait
The config.txt file can be omitted if you are using default parameters.
Below is a prepared FAT16 image. It can be restored using the Win32 Disk Imager