Booting from USB on RPi3
Mark Millard
marklmi at yahoo.com
Tue Apr 21 18:34:54 UTC 2020
On 2020-Apr-21, at 11:05, bob prohaska <fbsd at www.zefox.net> wrote:
> On Mon, Apr 20, 2020 at 03:32:31PM -0700, Mark Millard wrote:
>>
>>
>> On 2020-Apr-20, at 15:07, bob prohaska <fbsd at www.zefox.net> wrote:
>>
>>> On Tue, Apr 21, 2020 at 07:31:40AM +1200, Jonathan Chen wrote:
>>>>
>>>> This is how I got my RPI3 running 12-STABLE to boot off USB. It does
>>>> require a microSD card with u-boot, and the loader.efi built sometime
>>>> after Sep 2019 though. However, my root-filesystem (and swap) lives on
>>>> an external USB drive.
>>>>
>>>> 1. Copy the loader.efi to EFI/BOOT/bootaa64.efi
>>>>
>>>> 2. Create a text file: EFI/FreeBSD/loader.env, this file contains a
>>>> one-line directive to loader(8) on where to find a kernel to boot.
>>>> Mine contains:
>>>> rootdev=disk1p1:
>>>> The disk entry should be the same as what loader(8) expects with your
>>>> USB disk setup. Mine has a GPT partitioning scheme, with the root-fs
>>>> on partition-1.
>>>>
>>>> 3. All /etc/fstab entries should use symbolic name entries instead of da0*. eg:
>>>> 7:27am# cat /etc/fstab
>>>> # Device Mountpoint FStype Options Dump Pass#
>>>> /dev/gpt/topaz-root / ufs rw 1 1
>>>> /dev/gpt/topaz-swap none swap sw 0 0
>>>>
>>>> Hope this helps.
>>>> --
>>>
>>> Where is the kernel loading from? I gather it's been long-time
>>> practice to load the kernel from microSD and then mount the USB
>>> device as root; it that what you're doing? It appears that using
>>> usbboot (correctly!) would eliminate that extra step.
>>
>> Looks to me like the rootdev assignment is controlling
>> where the kernel is loaded from but the FreeBSD loader
>> and its loader.env still are found on the microsd card
>> and used from there.
>>
>> So if "extra step" means any use of a miscrosd card, then
>> it would not meet what appear to be your criteria.
>
> My only real criteria is that I be able carry out the steps
> needed to make it work 8-). There's nothing intrinsically
> wrong with using the microSD card. In some ways it's good.
>
>> But if
>> you are okay with only needing a msdos file system
>> based microsd card with appropriate materials added
>> to the msdos file system (no freebsd partitions required),
>> then it might be okay.
>>
>> I'm not sure if armv7's without an EFI-like context have
>> a msdos file system path analogous to EFI/FreeBSD/loader.env
>> to allow the same sort of rootdev-assignment technique or
>> not.
>>
>> If your context is an example of:
>>
>> QUOTE
>> in situations where a Pi 3 fails to boot (the latest bootcode.bin includes additional bugfixes for the Pi 3B, compared to the boot code burned into the BCM2837A0)
>> END QUOTE
>>
>> then I'm not sure that you can avoid the microsd card
>> being involved.
>>
>> But that would be testable in a normal RPi OS
>> context: If you can boot Raspbian via USB-only
>> in the normal USB-only manor, then the problem
>> is elsewhere for doing so for FreeBSD. Going
>> the other way: If you can not boot Raspbian via
>> USB-only, then the microsd card is likely going
>> to be involved for any OS for that specific RPi3.
>>
>
> I think you're correct that I should test this using
> default Raspbian. I originally hoped that setting the
> USB boot OTP bit would guide the Pi to boot the msdos
> partition on the USB device, exactly as it boots from
> the microSD.
>
> In my case, even with the USB boot OTP bit set the Pi
> does not flash the rainbow screen when the microSD
> card is absent; it just sits inert on power-up. Only
> with a bootable microSD does the Pi seem to do anything.
>
> In principle having a dual-boot configuration seems desirable:
> A microSD-based "repair" installation, which can by default
> boot a USB-based "production" installation. It would be
> reminiscent of older FreeBSD versions that brought up a boot
> manager, allowing dual boot between, in those days, Windows
> and FreeBSD. Unfortunately Raspbian can't read UFS, but it
> does at least provide a hardware test.
>
> I expected the boot sequence to hop from microSD msdos partition
> to USB msdos partition. If I'm reading right that that's not how
> it's presently being done.
Cross checking on other things:
Which style of partitioning is in use on the USB drive?
Same style as on the microsd card(s) that you use for
booting? The RPi*'s do not deal with gpt or such for
boot media.
One thing that I do not know: does the RPi3 boot
handle USB hubs (beyond its internal one(s))? In other
contexts, I've had access to machines that could only
handle direct connections for a USB boot drive, not
boot-drives that were off a powered hub.
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the freebsd-arm
mailing list