Re: RPi4 - Booting from mSD with USB storage

From: Mark Millard via freebsd-arm <freebsd-arm_at_FreeBSD.org>
Date: Sat, 03 Jul 2021 16:14:24 UTC

On 2021-Jul-3, at 03:11, Jordan Bass <jordan at jbass.io> wrote:

> I've installed 13.0-RELEASE on a micro SD card to use on a 8GB Raspberry Pi 4. The Raspberry Pi 4 launches u-boot from the mSD card successfully. Without any USB devices attached, u-boot will boot FreeBSD from the mSD card successfully. When I attach an externally powered USB SDD enclosure containing 2 drives and try to boot, u-boot will fail to boot FreeBSD from the micro SD card. It will then try to boot from USB and fail because they are just ZFS storage. Finally, u-boot will endlessly try to boot over the network.
> 
> To work around the problem, I can detach the USB drives, power on the Pi, wait a few seconds, and then attach the USB drives.
> 
> I've tried the 2021-04 build of u-boot, and that will boot from mSD with the USB drives attached, but only because it fails to detect the USB devices, and the ZFS pools will not be imported on boot.
> 
> Does anyone have any suggestions for configuring u-boot to behave in the way I expect? I want to boot from mSD, even when USB drives are attached.
> 

You do not report what, if any, error messages U-Boot is
reporting.

Just in case it is relevant, I', going to quote a list
message from back in April:

QUOTE
I will note that one thing that was discovered was
that u-boot does not well support having a USB device
with more than one storage LUN in the device. It
produces messages like:

Scanning disk usb_mass_storage.lun1...
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Scanning disk usb_mass_storage.lun3...
ERROR: failure to add disk device usb_mass_storage.lun3, r = 20
Error: Cannot initialize UEFI sub-system, r = 20
2676208 bytes read in 41 ms (62.2 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Error: Cannot initialize UEFI sub-system, r = 20
EFI LOAD FAILED: continuing...
BOOTP broadcast 1
DHCP client bound to address 192.168.1.171 (121 ms)
*** ERROR: `serverip' not set

(Text is actually from a test that Fedora's configuration
at the time was getting the same sort of problem from its
u-boot build. The text just happened to be handy to grab.)

It seemed that such a device needed to be plugged in after
u-boot was no longer involved (and to be unplugged before
u-boot would again be involved).

I mention this because having multiple SATA drives possible
might be an example of multiple storage LUNs for a single
USB device. There is:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253983

that starts before the u-boot tie was known and progresses
through it being discovered --and that mistakenly indicates
"Closed FIXED" to indicate that it was not a FreeBSD
problem. (No problem was "fixed": just isolated to not
be FreeBSD's problem.)
END QUOTE

To my knowledge, you would have to adjust U-Boot's
configuration to complete ignore USB in order to
work around U-Boot's problem for such contexts.
Looks like Robert Crowston provided some notes
that go in this driection.

There might be multi-storage-device (each single
LUN) that also have problems, for all I know.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)