Searching and Finding boot.scr and uboot.env on a Raspberry Pi 4
Marc Haber
mh+u-boot at zugschlus.de
Thu Jun 12 13:08:59 CEST 2025
Hi Quentin, hi List,
tl;dr my issue is solved.
On Tue, Jun 10, 2025 at 01:18:17PM +0200, Quentin Schulz wrote:
>On 6/10/25 12:50 PM, Marc Haber wrote:
>>On Tue, Jun 10, 2025 at 12:36:23PM +0200, Quentin Schulz wrote:
>>>On Theobroma boards (Rockchip-based), we force the environment to be
>>>coming from the same storage medium as U-Boot proper, c.f.
>>>board/theobroma-systems/common/common.c:arch_env_get_location()
>>>
>>>This is the location of the U-Boot environment in raw, not in a
>>>filesystem, so this won't apply to your use-case.
>>
>>Sadly ;-)
>>
>
>But the logic to detect which boot medium was used is there, hence why
>I mentioned it :)
I looks like Debian's u-boot for Raspberry Pi actually finds boot.scr
laying at the side of u-boot.bin, and the initial environment the script
gets contains $devtype, $devnum, and $distro_bootpart which can be used
to continue finding things. $disto_bootpart is a bit confusingly named,
but since it's the only variable that always seems to contain the
correct number according to the tests I did, this is about enough.
I had to explicitly code out reading of uboot.env though (that for some
reason doesn't happen automatically), and while at it I added some code
to also read uboot.env.asc which easier to generate and to edit.
I apologize for not finding this myself any earlier, I was led into an
incorrect assumption about u-boot since the Raspberry Pi 4 is VERY picky
regarding choice of SD cards with the Firmware from April 2024 that
comes with current Debian. The Firmware that comes with current
Raspberry Pi OS is from March 2025 and is actually much less picky
regarding SD cards. I sorted out three SD cards and was about to give up
on u-boot when I discovered the firmware issue in the debug output of
the second stage bootloader (which needs to be explicitly enabled by
uart_2ndstage=1 in config.txt).
Writing "kernel=uboot.bin" in my config.txt while the file actually was
named u-boot.bin cost me an additional couple of hours. I then went to
bed and spotted the missing hyphen first thing in the morning.
Recommendation: Letting things rest for a while helps a lot!
>>As far as I have understood, if u-boot finds neither its environment
>>file or a boot.scr (that one comes from the environment as well, right?)
>>it just sits there doing nothing. It's that first step that I don't
>>understand.
>>
>
>Which first step are you talking about?
I was taling about finding the boot.scr script which now magically seems
to work. I do not even need an SD card any more, everything can happen
from the USB SSD. I reached my goal, can do everything with what's in
Debian and thank you for your help!
Thank you very much, again, for providing u-boot, and for listening and
giving answers that were able to point me in the right direction!
Cheers
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