Revision as of 10:57, 21 June 2014 by Craig Peacock (Talk | contribs)

Setting up the Raspberry Pi to boot from Root NFS

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.

Preparing the MMC

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 write disk.

If the disk is correct, delete any existing partitions.

Now select n to add a new partition. Select primary partition and 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.

Prepared Image

Below is a prepared FAT16 image. It can be restored using Win32 Disk Imager