Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting u-boot commands

9 views
Skip to first unread message

bob prohaska

unread,
Nov 28, 2021, 7:28:34 PM11/28/21
to
Is it possible to implement a script to be execuated by u-boot
in place of the default behavior? What's needed is something like

while true do
usb reset
if USB storage found
run bootcmd_usb0
else
repeat.....

So far it has taken between one and ten cycles of usb reset to find
the usb mass storage device when these commands are run by hand.

Thanks for reading,

bob prohaska


Deloptes

unread,
Nov 29, 2021, 2:24:58 AM11/29/21
to
bob prohaska wrote:

> So far it has taken between one and ten cycles of usb reset to find
> the usb mass storage device when these commands are run by hand.

usually you set a delay to give time so that the hardware initializes, but I
am speaking from theory - never tried USB boot on the RPi

bob prohaska

unread,
Nov 29, 2021, 11:11:47 AM11/29/21
to
Yes, that's the customary practice. I've turned on all the delays I know
about (timeout file, usb_pgood_delay, program_usb_boot_timeout=1,
boot_delay_ms=5000, boot_delay=5000) and none seem to make any
consistent difference. I'm guessing it's a half-bug in some of my
hardware. Sometimes the disk shows up on the second try, sometimes
the fifth or sixth. So far, it hasn't taken many more than six tries.

The most encouraging thing found so far is
http://etutorials.org/Linux+systems/embedded+linux+systems/Chapter+9.+Setting+Up+the+Bootloader/9.5+U-Boot/

but it's quite old, apparently dating back some ten years.

It rather implies one can set environment variables in config.txt,
those are tantamount to commands in the "hush" shell implemented
by u-boot. It's much less clear whether the hush shell implements
enough to parse the response to usb reset for the text "1 storage",
break out of the loop and run bootcmd_usb0.

Jim Jackson

unread,
Nov 29, 2021, 3:18:04 PM11/29/21
to
I've never had problems booting a RPI from USB attached mass storage -
but theb again I've never used uboot - I've only ever used the
RaspberryPi foundations bootloader. Is there any special reason
you have to use uboot?

bob prohaska

unread,
Nov 29, 2021, 3:55:57 PM11/29/21
to
Jim Jackson <j...@franjam.org.uk> wrote:
>
> I've never had problems booting a RPI from USB attached mass storage -
> but theb again I've never used uboot - I've only ever used the
> RaspberryPi foundations bootloader. Is there any special reason
> you have to use uboot?

To the best of my knowledge RasPiOS uses u-boot, which then
starts the Linux bootloader chain. If I'm wrong that might be
part of my problem.

I happen to be booting FreeBSD, but the problem of finding a
usb mass storage device arises earlier in the boot chain.

Jim Jackson

unread,
Nov 29, 2021, 5:12:41 PM11/29/21
to
On 2021-11-29, bob prohaska <b...@www.zefox.net> wrote:
> Jim Jackson <j...@franjam.org.uk> wrote:
>>
>> I've never had problems booting a RPI from USB attached mass storage -
>> but theb again I've never used uboot - I've only ever used the
>> RaspberryPi foundations bootloader. Is there any special reason
>> you have to use uboot?
>
> To the best of my knowledge RasPiOS uses u-boot,

Why do you think that?

The "standard" Raspbian boot sequence is described at

https://raspberrypi.stackexchange.com/questions/10442/what-is-the-boot-sequence

The definitive documentation is at

https://www.raspberrypi.com/documentation/computers/raspberry-pi.html

But I suspect that the FreeBSD people have gone with the independent uboot
implementation for the Pi. Is there a FreeBSD forum or users email list?
You might find better help there.

Mike Scott

unread,
Nov 30, 2021, 3:35:13 AM11/30/21
to
I wonder if that's the issue I had. The pi's in bits atm so I can't
check, but I had to set a timeout (kern.cam.boot_delay I think; I was
getting in a dreadful muddle at the time) in loader.conf to some huge
value, around 10sec iirc. Otherwise it couldn't mount the root device.
But it was all muddled up with my ignorance plus a dying hd so ymmv.


>
> Thanks for reading,
>
> bob prohaska
>
>


--
Mike Scott
Harlow, England

druck

unread,
Nov 30, 2021, 8:23:42 AM11/30/21
to
On 29/11/2021 00:28, bob prohaska wrote:
> So far it has taken between one and ten cycles of usb reset to find
> the usb mass storage device when these commands are run by hand.

Is the power supply adequate for the device? Does this occur with a
powered hub?

---druck
0 new messages