Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2020 11:05:28 -0700
From:      bob prohaska <fbsd@www.zefox.net>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        Jonathan Chen <jonc@chen.org.nz>, freebsd-arm@freebsd.org, bob prohaska <fbsd@www.zefox.net>
Subject:   Re: Booting from USB on RPi3
Message-ID:  <20200421180528.GB96994@www.zefox.net>
In-Reply-To: <39CD6D0A-AF9B-4E5E-95C9-11E343F02082@yahoo.com>
References:  <20200420172512.GA94315@www.zefox.net> <CAJuc1zPzseM4Ez5ixk6LHiVvnXXBZgbxH9Rh2TvJn-qxADJuvg@mail.gmail.com> <20200420220756.GC94315@www.zefox.net> <39CD6D0A-AF9B-4E5E-95C9-11E343F02082@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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. 

Thanks for writing!

bob prohaska




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200421180528.GB96994>