Re: RPi4 - Booting from mSD with USB storage

From: Robert Crowston via freebsd-arm <freebsd-arm_at_FreeBSD.org>
Date: Sat, 03 Jul 2021 13:41:41 UTC
You could create a boot script ("u-boot.scr") and place it in the root of your sd card alongside u-boot. U-boot will interpret it at start up. You can use that to modify the "boot_targets" variable such that it doesn’t scan for usb drives, or so that it tries to load from mmc first.

As I recall part of the problem is there are several mmc-like devices on the pi4 and the one we want is the third one (mmc2). That’s quite low in the boot priority order.

First you should become a little familiar with what u-boot is doing when it probes your devices. I’d suggest plugging in a keyboard (or a serial console) and interrupting the automatic boot. Once you know how to make it boot from mmc, you can encode that in a script.

u-boot.scr is a compiled file, so you need the “mkimage” tool from u-boot.

I’m not sure if this is the best way, perhaps I am overcomplicating it. Good luck.

— RHC.

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

> Hi,
>
> 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.
>
> Thanks,
>
> Jordan