Re: Using loader to switch kernel and root device on Pi2

bob prohaska <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On Sun, Mar 30, 2025 at 10:55:00PM -0700, Mark Millard wrote:
> 
> The only 2 files that are needed on the microsd card
> for an RPi* firmware based USB boot are: bootcode.bin
> and, possibly, timeout .
> 
> It is the bootcode.bin file that enables the RPi*
> fimrware based USB boot. No other files contribute
> (other than timeout leading to a longer delay).
> 

This is really the key to the puzzle. For quite a long
time the Pi2 in question booted sucessfully by the
method described above. Following a routine update and
buildworld/kernel/install cycle, the boot process began
failing, ending in a netboot loop that could not be escaped.

The cause of the failure couldn't be traced to power or
hardware, so I concluded it was a corrupt microSD card. 

I re-constructed the system by dd-ing a new image to
microSD, verifying it would boot, moving files manually
to the USB disk and finally hiding all files on the microSD's
dos partition except for bootcode.bin and timeout by placing
them in a subdirectory imaginitively named "unused". 

That system booted without issue through several cycles
of pull/buildworld/kernel/install, whereupon it failed
again in exactly the same netboot loop. 

At this point it seemed the problem had something to do
with the Pi2. Booting FreeBSD directly from the microSD
still worked, so it seemed worthwhile to try using loader
started from microSD to boot from the usb disk. 

Adding to the /boot/loader.conf file on the microSD card

currdev="disk0s2a"
and
vfs.root.mountfrom="ufs:/dev/da0s2a"
seems to load the kernel and mount root from the USB disk.

If usb discovery fails at boot, the machine loads the 
kernel from microSD but still mounts root from usb. Not
good, but not fatal as a rule. It can be controlled
remotely and rebooted until startup is correct. 

Via the serial console usb discovery can be re-attempted 
at the u-boot prompt using usb reset. If the usb disk
is found, typing boot at that point brings the system
up with kernel and root from usb.  

The reason for usb discovery failure is probably related
to the Pi2's usb2 interface. The system in this saga uses
a usb3 to sata bridge and a usb3 powered hub.

A second Pi2 equipped with a usb2-pata bridge, via a 
usb3 powered hub, has been running and rebooting without
issue since July 2, 2020. 

Thanks for all your help!

bob prohaska
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.