ARM – Pi2 to U-Boot..
I decided to try U-Boot on the Raspberry Pi 2, and the process has been fairly well documented in several places..
I used the latest U-Boot, with ‘patch’ info from here, as I needed Device Tree support: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=108217.
Actual ‘installation’ is simple, as I just copied the u-boot binary to the boot directory on the SD Card, and edited config.txt to ‘boot’ U-Boot instead of the actual kernel, by changing kernel=kernel7.img to kernel=u-boot.bin.
On first boot, the uart/console output looked like this:
U-Boot 2015.07-rc3 (Jul 14 2015 - 13:49:19 -0700) DRAM: 880 MiB WARNING: Caches not enabled RPI 2 Model B MMC: bcm2835_sdhci: 0 reading uboot.env ** Unable to read "uboot.env" from mmc0:1 ** Using default environment In: serial Out: lcd Err: lcd Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 U-Boot>
After this, I added definitions to set up the necessary boot parameters, etc.:
setenv machid 0x00000c42 setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd' setenv x_bootcmd_kernel fatload mmc 0:1 ${kernel_addr_r} zImage setenv x_bootcmd_fdt fatload mmc 0:1 ${fdt_addr_r} bcm2709-rpi-2-b.dtb setenv bootcmd '${x_bootcmd_kernel}; ${x_bootcmd_fdt}; bootz ${kernel_addr_r} - ${fdt_addr_r};' saveenv (to save the parameter info to uboot.env on the SD Card)
Note that you do not need to explicitly state the kernel and device tree file load addresses, as – with the patch – these are already defined in the compiled U-Boot executable (as kernel_addr_r and fdt_addr_r respectively).
Of course, there are alternative ways of doing this, but this is a format I have used before with other devices..
I had been booting kernel7.img as an ‘uncompressed’ Image, but U-Boot expects zImage or uImage formats, so I changed my compile workflow on the Pi2 accordingly:
make -j5 zImage make dtbs make -j5 modules make modules_install make firmware_install cp System.map /boot cp arch/arm/boot/dts/bcm2709-rpi-2-b.dtb /boot cp arch/arm/boot/zImage /boot
My next project will probably be to see if I can get U-Boot running on the ARM64 HiKey, but that might be a bit premature…
Robert Gadsdon. July 15, 2015.
Hi, I am trying to boot my raspberrypi with U-boot. After compiling the file u-boot.bin I copied to the raspbian boot directory, and add the line in the config.txt (Kernel=u-boot.bin). Now, U-boot screen is showing up, but my keyboard doesn’t work. Therefore, I am unable to stop auto boot. Do you hae any idea about this? thanks in advance. 🙂
You should be able to see, and control, all U-Boot commands etc. on the uart/usb console connection..
RG.