Skip to content
Nicholas edited this page Aug 13, 2014 · 11 revisions

Partitioning your SD card

You will need to replace sdx in the following commands with the actual device node for your SD card. It will usually be sdb if you only have a single hard drive installed, you can check attached drives with lsblk.

The following commands will create 2 partitions on your SD card, one bootable FAT16 partition and one root partition that fills the rest of the space, you will need to run them as root. All data on the SD card will be lost.

fdisk /dev/sdx
> p             # prints partition table
> d             # repeat until all partitions are deleted
> n             # create a new partition
> p             # create primary
> 1             # make it the first partition
> <enter>       # use the default sector
> +32M          # create a boot partition with 32MB of space
> t
> c             # set the boot partition to type W95 FAT32 (LBA).
> a             # make it bootable
> n             # create rootfs partition
> p
> 2
> <enter>
> <enter>       # fill the remaining disk, adjust size to fit your needs
>               # (roms will be stored here! More space = more roms)
> p             # double check everything looks right
> w             # write partition table to disk.

Formatting your SD card

You will need dosfstools installed to create the FAT partition, so make sure you have that first. To format the boot partition type the following:

# run the following as root
mkfs.vfat -F16 -n boot /dev/sdx1 # remember this x will
                                 # probably be a different letter!
mkdir -p /mnt/boot
mount /dev/sdx1 /mnt/boot

# this creates the root file system
mkfs.ext4 -L rootfs /dev/sdx2
mkdir -p /mnt/rootfs
mount /dev/sdx2 /mnt/rootfs

Installing the buildroot image

In the rpi-emulator-buildroot folder there should be a output folder containing:

    output/images/
    +-- rootfs.tar
    +-- rpi-firmware
    |   +-- bootcode.bin
    |   +-- config.txt
    |   +-- fixup_cd.dat
    |   +-- fixup.dat
    |   +-- start_cd.elf
    |   `-- start.elf
    `-- zImage

You will need to copy the all files in the rpi-firmware folder and the zImage to your boot partition. Optionally there is also a mildly overclocked and 720p locked config.txt located in board/raspberrypi/config.txt, I used this for the release images.

# run the following as root
cp output/images/rpi-firmware/* /mnt/boot
cp output/zImage /mnt/boot
umount /mnt/boot

Finally the root filesystem needs to be untarred to the main partition.

# run the following as root
tar -xf output/images/rootfs.tar -C /mnt/rootfs
umount /mnt/rootfs