Scripting u-boot commands

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

Reply to
bob prohaska
Loading thread data ...

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

Reply to
Deloptes

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

formatting link
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.

Thanks for reading,

bob prohaska

Reply to
bob prohaska

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?

Reply to
Jim Jackson

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.

Thanks for reading,

bob prohaska

Reply to
bob prohaska

Why do you think that?

The "standard" Raspbian boot sequence is described at

formatting link
The definitive documentation is at

formatting link
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.

Reply to
Jim Jackson

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.

Reply to
Mike Scott

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

---druck

Reply to
druck

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.