Compiling U-Boot with Device Tree Support for the Raspberry Pi

Prerequisites

To compile the U-Boot bootloader for the Raspberry Pi, you must first have an ARM cross compiler installed. I use gcc-4.7.3-arm-linux-gnueabi that comes with Ubuntu 14.04. To install the compiler run:

apt-get install gcc-arm-linux-gnueabi

U-Boot

Raspberry Pi support in the current mainline U-Boot is functional, but excludes support for USB. As the ethernet port on the Raspberry Pi is connected to the Broadcom SoC via USB, no support for USB not only effects your use of USB input devices such as a keyboard, USB storage devices (booting from USB thumb drive) but also Network (TFTP loads).

It is understood Stephen Warren is working on getting USB support into the mainline U-Boot repository.

Mainline

To download and extract the latest mainline version of U-Boot:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2014.04

Stephen Warren's work

Alternatively, if you require USB support, use Stephen Warren GIT repository:

git clone git://github.com/swarren/u-boot.git
git checkout -b rpi_dev origin/rpi_dev

Compiling

Now cross compile U-Boot using the Raspberry Pi Model B configuration:

make CROSS_COMPILE=arm-linux-gnueabi- distclean
make CROSS_COMPILE=arm-linux-gnueabi- rpi_b_config
make CROSS_COMPILE=arm-linux-gnueabi- u-boot.bin

Once compiled, u-boot.bin can be copied to your SD Card. Edit the config.txt file to include the following line:

kernel=u-boot.bin

Prepared Image

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