The latest Raspberry Pi patches have been applied to U-Boot. This adds:

• An "LCD" driver for the HDMI (and possibly composite) output, so you don't have to use serial console to see what U-Boot is doing. I must admit I haven't tested this recently, especially not since it was merged. I should do that!
• An MMC driver for the SD card, so files can actually be loaded, and hence Linux booted.

Still missing is USB support, e.g. for a keyboard or network booting.

To build it:

git clone -o u-boot-arm git://git.denx.de/u-boot-arm.git u-boot-rpi
cd u-boot-rpi
git checkout -b dev u-boot-arm/master
export CROSS_COMPILE=arm-linux-gnueabi-
./MAKEALL rpi_b

You'll probably want to apply http://lists.denx.de/pipermail/u-boot/2013-March/149625.html too.

Copy u-boot.bin to the SD card partition 1, renamed to kernel.img. I assume you're starting with a recent official "Raspbian" image on the SD card.

U-Boot expects to find boot.scr.uimg on the SD card in partition 1. This script will do the actual load/boot of the kernel. I use the following content:

fatload ${devtype} ${devnum}:1 ${kernel_addr_r} /zImage
fatload ${devtype} ${devnum}:1 ${fdt_addr_r} /${soc}-${board}.dtb
setenv bootargs "earlyprintk loglevel=8 console=ttyAMA0 verbose rootwait root=/dev/mmcblk0p2 rw"
bootz ${kernel_addr_r} - ${fdt_addr_r}

Put that into boot.scr, and generate boot.scr.uimg with:

mkimage -A arm -O linux -T script -C none -n boot.scr -d boot.scr boot.scr.uimg

Copy boot.scr.uimg to partition 1 of the SD card.

The main benefit of using U-Boot is the ability to boot an upstream kernel, since U-Boot fills in the device tree properties required for that. To build that kernel:

git clone -o korg_swarren_linux-rpi git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git
cd linux-rpi
git checkout -b dev korg_swarren_linux-rpi/for-next
export CROSS_COMPILE=arm-linux-gnueabi-
make ARCH=arm bcm2835_defconfig
make -s ARCH=arm zImage -j8 -s && make -s ARCH=arm dtbs

Copy arch/arm/boot/zImage to the SD card. Copy arch/arm/boot/dts/bcm2835-rpi-b.dtb to the SD card; you'll need to rename that to bcm2835-rpi_b.dtb.

The kernel requires a serial console; there's no graphics or USB support upstream yet.

I don't recall if I had to manually adjust the Raspbian image to enable getty (login) on the serial port; perhaps it comes that way. Verify that something like the following is in file /etc/inttab in partition 2 of the SD card:

#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

The Raspbian image ships with a config.txt in partition 1. I don't appear to have that; I must have deleted it. I guess none of the options in it are needed for U-Boot.

Now, plug the SD card into the Pi, hook up your serial console, and boot it. With any luck, you'll see the kernel start up and be able to log in.

I also have some hacky work-in-progress patches to enable the recently added DWC2 driver in the kernel, for USB support. They don't work yet. If you're interested, they're available in git://github.com/swarren/linux-rpi.git branch rpi_dev. If you actually try to use them, you'll need to turn on the power to the USB controller before booting the kernel, e.g. by adding the following commands to the top of boot.scr.uimg:

# msg with 2 parameters, up to 2 responses
setenv prop-2-2 'mw.l 0x00001000 0x00000020 ; mw.l 0x00001004 0x00000000 ; mw.l 0x00001008 $tag ; mw.l 0x0000100c 0x00000008 ; mw.l 0x00001010 0x00000008 ; mw.l 0x00001014 $p1 ; mw.l 0x00001018 $p2 ; mw.l 0x0000101c 0x00000000 ; md.l 0x1000 8'

# send msg, read/dump response
setenv send-rec 'mw 0x2000b8a0 0x00001008 ; md 0x2000b880 1 ; md.l 0x00001000 8'

# set power, devid==p1 (3==USB), state,wait==p2 (3==ON/WAIT)
setenv tag 0x28001 ; setenv p1 3 ; setenv p2 3; run prop-2-2 ; run send-rec
Shared publiclyView activity