getting u-boot to work on raspi 3b (32bit)

Robert Wenisch RWenisch at bfs.de
Tue Jul 25 17:35:29 CEST 2023


Hello,

in order to study the boot process of embedded ARM systems, I decided to start with something well documented: booting as raspi 3b using u-boot.
I downloaded kernel sources and u-boot sources. I built the kernel with

CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make bcmrpi_defconfig
CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make -j6 zImage dtbs modules
cp arch/arm/boot/zImage /path/to/sdcard-boot-partition
cp arch/arm/boot/dts/bcm2710-rpi-3-b.dtb /path/to/sdcard-boot-partition
CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm INSTALL_MOD_PATH make modules_install

Further I compiled and setup u-boot:

CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make rpi_3_32b_defconfig
CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make -j6

cp u-boot.bin /path/to/ sdcard-boot-partition

I then went on to edit the config.txt:

kernel=u-boot-bin
enable_uart=1
arm_64bit=0
device_tree=bcm2710-rpi-3-b.dtb

and boot.txt goes

fatload mmc 0:1 ${fdt_addr_r} bcm2710-rpi-3-b.dtb
fatload mmc 0:1 $kernel_addr_r} zImage
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw earlyprintk
bootz ${kernel_addr_r} - {fdt_addr_r}

I produced an image of boot.txt

mkimage -A arm -O linux -T script -d boot.txt boot.scr

Frustratingly, it didn't go as smoothly as expected.

With these setting I got up to state "Starting Kernel ..." over the serial port, then it freezes (or at least doesn't log anything on the tty).
I can't post the whole log as I only have it on my dev-machine.
However some interesting bits for now:
I'm booting on u-boot 2023-07-0967-g94e7cb181a
1 - Pretty much at the beginning it says "Loading Environment from FAT... *** warning - bad CRC, using default environment"
I suppose this only means we're not providing a .env file?

2 - Upon "Scanning bus usb at 7e980000 for devices... it's logging a lot of garbage (as in misinterpreted character codes), what might be going on there?

3 - A bit further down it states "Found U-Boot script /boot.scr"
 [...]
"## Executing script at 02400000"
As this changes when I edit around the boot.txt and mkimage, I infer u-boot is indeed loading my boot instructions not just some default values.

Then follow some info on kernel image flatted device tree blob and their respective memory addresses.
It the tries to load the kernel to little apparent success :/

This procedure is what I gathered from a plethora of tutorial and howtos. Most of these are quite old, have there been breaking changes in u-boot's development in the meanwhile?
For example some sources state the kernel is launched via booti ${kernel_addr_r} - {fdt_addr_r}, however the booti command seem to be absent in my u-boot version.

Is there anything else I#m doing wrong?

I'll be grateful for any hints at this point...

Cheers Robert


More information about the U-Boot mailing list