Searching and Finding boot.scr and uboot.env on a Raspberry Pi 4
Marc Haber
mh+u-boot at zugschlus.de
Mon Jun 9 18:40:49 CEST 2025
Hi,
for flexibility reasons I want to use u-boot to boot Debian on a
Raspberry Pi 4. I want to be able to fix a broken boot from remote over
the serial console. I have therefore written a boot.scr script that
looks for kernel and initrd on various partitions on various media in
various directories, loads kernel, initrd and devicetree and boots.
I am using the uboot binary that comes with Debian's u-boot-rpi:arm64
2025.01-3 package. That one is configured like that:
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_ENV_FAT_FILE="uboot.env"
This works as long as I am booting from an MMC card: The Raspi Firmware
reads config.txt (from MMC), loads uboot.bin (from MMC), which in turn
reads uboot.env and boot.scr (from MMC), the script runs and the system
comes up. While this happens, u-boot talks to me on the serial console,
presumably because uboot.env contains variables like
baudrate=115200
stderr=serial,vidconsole
stdin=serial,usbkbd
stdout=serial,vidconsole
However, when I have everything on USB, things don't work as smoothly.
The system does not come up and it doesn't talk to me on the serial
console. What I guess is that the Raspi Firmware reads config.txt (from
USB), loads uboot.bin (from USB) which then looks on the non-existent
MMC device for uboot.env and boot.scr. Game Over.
Is it somehow possible to have u-boot look for uboot.env and/or boot.scr
on the same device it was booted from? Can I compile in some kind of
search order so that u-boot can find uboot.env and boot.scr on other
devices than the first partition on mmc? Or do I really need to build my
own u-boot.bin?
If there is another method to ask user questions about u-boot, please
let me know.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
More information about the U-Boot
mailing list