• Pi2 bootcode.bin puzzle

    From bp@www.zefox.net@21:1/5 to All on Tue Mar 25 14:48:14 2025
    Twice now a Paspberry Pi 2 v1.1 using the bootcode.bin-only
    method to boot from usb mass storage has abruptly
    stopped finding the mass storage device, or so it seems.

    The machines are actually running freebsd, but the failures
    are seemingly too early in the boot process to get anywhere
    close to freebsd files.

    In both cases, the failures occurred "out of the blue" during
    a normal reboot with no change to the system. I've monitored
    power supply voltage during boot, it stays above 5.2 volts,
    measured via one of the usb ports, on both powered hub and Pi2.

    Here's a transcript:



    Raspberry Pi Bootcode

    Found SD card, config.txt = 0, start.elf = 0, recovery.elf = 0, timeout = 0 Trying USB
    Set address 4
    Num devices = 1, addr = 4
    get_config_descriptor 41 bytes
    Initialise hub
    Found 5 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Enabling PORT POWER on port 5
    Waiting for devices to respond to reset
    Found device on port 1
    Found highspeed device
    Set address 5
    Num devices = 2, addr = 5
    get_config_descriptor 39 bytes
    device class = 255
    Device found: type = Ethernet adapter, addr = 5
    Found device on port 3
    Found highspeed device
    Set address 6
    Num devices = 3, addr = 6
    get_config_descriptor 41 bytes
    device class = 9
    Hub device found at addr 6, enumerating HUB
    Initialise hub
    Found 4 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Waiting for devices to respond to reset
    Found device on port 3
    Ignoring low speed device
    Found device on port 2
    Ignoring low speed device
    Found device on port 4
    Ignoring low speed device
    Found device on port 4
    Device failed to respond to reset
    Trying booting from Ethernet device addr 5

    At this point the Pi goes into a netboot loop. It doesn't seem to
    activate the disk drive apart from one blink of the activity LED.

    The Pi still boots from a Bookworm microSD, so
    it doesn't look like a broken Pi2. I've been
    using the version of bootcode.bin linked at https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
    from the page at https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-
    pi-boot-modes
    but didn't change anything betwen working and not.

    I notice that the narrative at that page is somewhat tangled.

    In one, and so far only one, instance the Pi booted sucessfully
    during a sequence of tests while makeing and re-making USB connections.
    That led me to suspect a loose plug, but multiple repetitions, moving
    all plugs, didn't repeat the success.

    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    Thanks for reading,

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Townley@21:1/5 to bp@www.zefox.net on Tue Mar 25 14:57:45 2025
    On 25/03/2025 14:48, bp@www.zefox.net wrote:
    Twice now a Paspberry Pi 2 v1.1 using the bootcode.bin-only
    method to boot from usb mass storage has abruptly
    stopped finding the mass storage device, or so it seems.

    The machines are actually running freebsd, but the failures
    are seemingly too early in the boot process to get anywhere
    close to freebsd files.

    In both cases, the failures occurred "out of the blue" during
    a normal reboot with no change to the system. I've monitored
    power supply voltage during boot, it stays above 5.2 volts,
    measured via one of the usb ports, on both powered hub and Pi2.

    Here's a transcript:



    Raspberry Pi Bootcode

    Found SD card, config.txt = 0, start.elf = 0, recovery.elf = 0, timeout = 0 Trying USB
    Set address 4
    Num devices = 1, addr = 4
    get_config_descriptor 41 bytes
    Initialise hub
    Found 5 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Enabling PORT POWER on port 5
    Waiting for devices to respond to reset
    Found device on port 1
    Found highspeed device
    Set address 5
    Num devices = 2, addr = 5
    get_config_descriptor 39 bytes
    device class = 255
    Device found: type = Ethernet adapter, addr = 5
    Found device on port 3
    Found highspeed device
    Set address 6
    Num devices = 3, addr = 6
    get_config_descriptor 41 bytes
    device class = 9
    Hub device found at addr 6, enumerating HUB
    Initialise hub
    Found 4 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Waiting for devices to respond to reset
    Found device on port 3
    Ignoring low speed device
    Found device on port 2
    Ignoring low speed device
    Found device on port 4
    Ignoring low speed device
    Found device on port 4
    Device failed to respond to reset
    Trying booting from Ethernet device addr 5

    At this point the Pi goes into a netboot loop. It doesn't seem to
    activate the disk drive apart from one blink of the activity LED.

    The Pi still boots from a Bookworm microSD, so
    it doesn't look like a broken Pi2. I've been
    using the version of bootcode.bin linked at https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
    from the page at https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-
    pi-boot-modes
    but didn't change anything betwen working and not.

    I notice that the narrative at that page is somewhat tangled.

    In one, and so far only one, instance the Pi booted sucessfully
    during a sequence of tests while makeing and re-making USB connections.
    That led me to suspect a loose plug, but multiple repetitions, moving
    all plugs, didn't repeat the success.

    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    Thanks for reading,

    bob prohaska


    Have tried another known good USB cable?

    --
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to bp@www.zefox.net on Tue Mar 25 16:49:41 2025
    bp@www.zefox.net wrote:
    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    No idea, but one problem I've had in the past is that USB devices can take a while to initialise, and it varies quite a bit between devices. This could
    be a reason why boots will sometimes fail - especially with eg spinning HDD.

    Often it was necessary to add an explicit delay so that system didn't try to read them before they were ready. I think on Linux the kernel cmdline
    options were 'rootwait' and 'rootdelay' but I don't know if bootcode.bin has any kind of setting like that.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Chris Townley on Tue Mar 25 23:50:40 2025
    Chris Townley <news@cct-net.co.uk> wrote:
    On 25/03/2025 14:48, bp@www.zefox.net wrote:
    Twice now a Paspberry Pi 2 v1.1 using the bootcode.bin-only
    method to boot from usb mass storage has abruptly
    stopped finding the mass storage device, or so it seems.

    The machines are actually running freebsd, but the failures
    are seemingly too early in the boot process to get anywhere
    close to freebsd files.

    In both cases, the failures occurred "out of the blue" during
    a normal reboot with no change to the system. I've monitored
    power supply voltage during boot, it stays above 5.2 volts,
    measured via one of the usb ports, on both powered hub and Pi2.

    Here's a transcript:



    Raspberry Pi Bootcode

    Found SD card, config.txt = 0, start.elf = 0, recovery.elf = 0, timeout = 0 >> Trying USB
    Set address 4
    Num devices = 1, addr = 4
    get_config_descriptor 41 bytes
    Initialise hub
    Found 5 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Enabling PORT POWER on port 5
    Waiting for devices to respond to reset
    Found device on port 1
    Found highspeed device
    Set address 5
    Num devices = 2, addr = 5
    get_config_descriptor 39 bytes
    device class = 255
    Device found: type = Ethernet adapter, addr = 5
    Found device on port 3
    Found highspeed device
    Set address 6
    Num devices = 3, addr = 6
    get_config_descriptor 41 bytes
    device class = 9
    Hub device found at addr 6, enumerating HUB
    Initialise hub
    Found 4 ports, multi_tt = 1
    Setting interface 0
    Enabling PORT POWER on port 1
    Enabling PORT POWER on port 2
    Enabling PORT POWER on port 3
    Enabling PORT POWER on port 4
    Waiting for devices to respond to reset
    Found device on port 3
    Ignoring low speed device
    Found device on port 2
    Ignoring low speed device
    Found device on port 4
    Ignoring low speed device
    Found device on port 4
    Device failed to respond to reset
    Trying booting from Ethernet device addr 5

    At this point the Pi goes into a netboot loop. It doesn't seem to
    activate the disk drive apart from one blink of the activity LED.

    The Pi still boots from a Bookworm microSD, so
    it doesn't look like a broken Pi2. I've been
    using the version of bootcode.bin linked at
    https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin
    from the page at
    https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-
    pi-boot-modes
    but didn't change anything betwen working and not.

    I notice that the narrative at that page is somewhat tangled.

    In one, and so far only one, instance the Pi booted sucessfully
    during a sequence of tests while makeing and re-making USB connections.
    That led me to suspect a loose plug, but multiple repetitions, moving
    all plugs, didn't repeat the success.

    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    Thanks for reading,

    bob prohaska


    Have tried another known good USB cable?

    I've even tried different usb-sata bridges. One in particular
    with an ASMT chipset that seemed to work everywhere else I tried
    it fails to boot. Plugged into a running Pi, or any other host,
    the disk seems to work fine with whatever bridge I try.

    Probably this is just a limitation of the Pi2 v1.1 USB system.
    I've got another Pi2v1.1 with an old PATA disk roughly as old
    as the Pi2, that combo seems to work fine.

    It just crossed my mind that I have another USB hard disk nearly
    as old as the Pi2. Maybe that could serve as a sanity check.
    Oops, guess not. It's a Western Digital MyBook, a NAS device.
    Rats!

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to bp@www.zefox.net on Tue Mar 25 23:55:22 2025
    bp@www.zefox.net wrote:
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    bp@www.zefox.net wrote:
    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    No idea, but one problem I've had in the past is that USB devices can take a
    while to initialise, and it varies quite a bit between devices. This could be a reason why boots will sometimes fail - especially with eg spinning HDD.

    Often it was necessary to add an explicit delay so that system didn't try to
    read them before they were ready. I think on Linux the kernel cmdline options were 'rootwait' and 'rootdelay' but I don't know if bootcode.bin has
    any kind of setting like that.

    I've tried with and without the presence of a timeout file on the
    fat32 partition of the microSD, far as I can tell it makes no
    difference once things start going wrong. I do use it out of habit.

    Does bootcode.bin pay any attention to config.txt? I thought it did,
    but am not sure it has any effect on USB mass storage boot. The docs
    say don't use any extra files on the fat32 partition.

    I believe that config.txt is consumed by the GPU-side firmware, which is start*.elf. bootcode.bin is just enough to be able to load start.elf
    and config.txt from storage. I'd guess that if that storage is USB, it's
    too early to have read config.txt.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Theo on Tue Mar 25 23:34:32 2025
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    bp@www.zefox.net wrote:
    Can bootcode.bin pick up any parameters (other than noting the
    presence of a timeout file) from any files placed on the microSD?

    No idea, but one problem I've had in the past is that USB devices can take a while to initialise, and it varies quite a bit between devices. This could be a reason why boots will sometimes fail - especially with eg spinning HDD.

    Often it was necessary to add an explicit delay so that system didn't try to read them before they were ready. I think on Linux the kernel cmdline options were 'rootwait' and 'rootdelay' but I don't know if bootcode.bin has any kind of setting like that.

    I've tried with and without the presence of a timeout file on the
    fat32 partition of the microSD, far as I can tell it makes no
    difference once things start going wrong. I do use it out of habit.

    Does bootcode.bin pay any attention to config.txt? I thought it did,
    but am not sure it has any effect on USB mass storage boot. The docs
    say don't use any extra files on the fat32 partition.

    Thanks for writing,

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to bp@www.zefox.net on Thu Mar 27 13:57:55 2025
    On 25/03/2025 23:50, bp@www.zefox.net wrote:
    I've even tried different usb-sata bridges. One in particular
    with an ASMT chipset that seemed to work everywhere else I tried
    it fails to boot. Plugged into a running Pi, or any other host,
    the disk seems to work fine with whatever bridge I try.

    Probably this is just a limitation of the Pi2 v1.1 USB system.
    I've got another Pi2v1.1 with an old PATA disk roughly as old
    as the Pi2, that combo seems to work fine.

    I didn't try booting from USB drives until the Pi 3B, but it wasn't
    until the Pi 4B with it's USB3 ports did that become really worthwhile
    to use SSDs.

    It just crossed my mind that I have another USB hard disk nearly
    as old as the Pi2. Maybe that could serve as a sanity check.
    Oops, guess not. It's a Western Digital MyBook, a NAS device.
    Rats!

    It may still work on the Pi 2B, but being slower you may need to
    increase the value of rootwait in cmdline.txt - particularly if it is a spinning disc rather than an SSD - it could take 60 seconds before the
    drive is readable.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to druck on Thu Mar 27 15:53:32 2025
    druck <news@druck.org.uk> wrote:
    It may still work on the Pi 2B, but being slower you may need to
    increase the value of rootwait in cmdline.txt - particularly if it is a spinning disc rather than an SSD - it could take 60 seconds before the
    drive is readable.

    I think the problem here is that start.elf, config.txt, the kernel and cmdline.txt are all on the USB device - you can't put a timeout in
    cmdline.txt because by that point you already need the USB device up to read that file.

    The alternative approach would be to have a regular bootcode.bin, start.elf, kernel, etc on the SD card and then tell the kernel to find its rootfs on a
    USB drive, at which point rootwait may help. (I think Bob is using FreeBSD
    but there is probably an equivalent option there). Or to interpose u-boot
    for the 'kernel' on the SD card, and then tell u-boot to find the kernel on USB.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From druck@21:1/5 to Theo on Thu Mar 27 21:22:05 2025
    On 27/03/2025 15:53, Theo wrote:
    druck <news@druck.org.uk> wrote:
    It may still work on the Pi 2B, but being slower you may need to
    increase the value of rootwait in cmdline.txt - particularly if it is a
    spinning disc rather than an SSD - it could take 60 seconds before the
    drive is readable.

    I think the problem here is that start.elf, config.txt, the kernel and cmdline.txt are all on the USB device - you can't put a timeout in cmdline.txt because by that point you already need the USB device up to read that file.

    The alternative approach would be to have a regular bootcode.bin, start.elf, kernel, etc on the SD card and then tell the kernel to find its rootfs on a USB drive, at which point rootwait may help. (I think Bob is using FreeBSD but there is probably an equivalent option there). Or to interpose u-boot for the 'kernel' on the SD card, and then tell u-boot to find the kernel on USB.

    That's the only way it works on older devices.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Theo on Fri Mar 28 15:19:00 2025
    Theo <theom+news@chiark.greenend.org.uk> wrote:

    I believe that config.txt is consumed by the GPU-side firmware, which is start*.elf. bootcode.bin is just enough to be able to load start.elf
    and config.txt from storage. I'd guess that if that storage is USB, it's
    too early to have read config.txt.

    It looks like the path of least resistance is to let FreeBSD boot from
    microSD, mount that as root and then mount the USB disk as /usr, with
    /var/, /tmp/ and swap mounted from the USB device, either as links
    to /usr or maybe as hard partitions.

    That worked fine in the very early days of FreeBSD on the Pi2.
    There isn't much write activity to the root filesystem in a
    "production" environment, only during OS upgrades. If the microSD
    is sufficiently oversized it'll last long enough.

    I'd hoped bootcode.bin could be upgraded/tuned to boot from a
    USB3 disk on a Pi2, but apparently not.

    Thanks to everyone for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to bp@www.zefox.net on Fri Mar 28 17:08:52 2025
    On 28/03/2025 at 15:19, bp@www.zefox.net wrote:
    Theo <theom+news@chiark.greenend.org.uk> wrote:

    I believe that config.txt is consumed by the GPU-side firmware, which is
    start*.elf. bootcode.bin is just enough to be able to load start.elf
    and config.txt from storage. I'd guess that if that storage is USB, it's
    too early to have read config.txt.

    It looks like the path of least resistance is to let FreeBSD boot from microSD, mount that as root and then mount the USB disk as /usr, with
    /var/, /tmp/ and swap mounted from the USB device, either as links
    to /usr or maybe as hard partitions.

    That worked fine in the very early days of FreeBSD on the Pi2.
    There isn't much write activity to the root filesystem in a
    "production" environment, only during OS upgrades. If the microSD
    is sufficiently oversized it'll last long enough.

    I'd hoped bootcode.bin could be upgraded/tuned to boot from a
    USB3 disk on a Pi2, but apparently not.

    Thanks to everyone for writing!

    bob prohaska




    Perhaps I'm coming here too late, but the way I did it was to keep the
    whole of the /boot directory on the SD card and put the whole of /
    (minus /boot contents) onto the USB SSD. Change the PARTUUID parameter
    in cmdline.txt to the new SSD partuuid and of course update the SSD
    /etc/fstab to the new values. Worked fine for Pi2B and Pi2B+.


    --
    Chris Elvidge, England
    SHERRI DOES NOT "GOT BACK"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to druck on Fri Mar 28 17:43:29 2025
    druck <news@druck.org.uk> wrote:
    On 27/03/2025 15:53, Theo wrote:
    druck <news@druck.org.uk> wrote:
    It may still work on the Pi 2B, but being slower you may need to
    increase the value of rootwait in cmdline.txt - particularly if it is a
    spinning disc rather than an SSD - it could take 60 seconds before the
    drive is readable.

    I think the problem here is that start.elf, config.txt, the kernel and cmdline.txt are all on the USB device - you can't put a timeout in cmdline.txt because by that point you already need the USB device up to read
    that file.

    The alternative approach would be to have a regular bootcode.bin, start.elf,
    kernel, etc on the SD card and then tell the kernel to find its rootfs on a USB drive, at which point rootwait may help. (I think Bob is using FreeBSD but there is probably an equivalent option there). Or to interpose u-boot for the 'kernel' on the SD card, and then tell u-boot to find the kernel on USB.

    That's the only way it works on older devices.

    Supposedly you can make them USB boot by just providing a bootcode.bin on
    SD, then they pick up start.elf, config.txt etc from USB. I've not tried
    this, but it appears to work for some people.

    (previously bootcode.bin didn't know anything about USB, but since Pi 3/4/5
    can USB boot I believe that code has now made itself into bootcode.bin)

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Mike Scott on Sat Mar 29 14:30:42 2025
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!

    Thanks for writing,

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Chris Elvidge on Sat Mar 29 04:47:36 2025
    Chris Elvidge <chris@internal.net> wrote:
    On 28/03/2025 at 15:19, bp@www.zefox.net wrote:
    Theo <theom+news@chiark.greenend.org.uk> wrote:

    I believe that config.txt is consumed by the GPU-side firmware, which is >>> start*.elf. bootcode.bin is just enough to be able to load start.elf
    and config.txt from storage. I'd guess that if that storage is USB, it's >>> too early to have read config.txt.

    It looks like the path of least resistance is to let FreeBSD boot from
    microSD, mount that as root and then mount the USB disk as /usr, with
    /var/, /tmp/ and swap mounted from the USB device, either as links
    to /usr or maybe as hard partitions.

    That worked fine in the very early days of FreeBSD on the Pi2.
    There isn't much write activity to the root filesystem in a
    "production" environment, only during OS upgrades. If the microSD
    is sufficiently oversized it'll last long enough.

    I'd hoped bootcode.bin could be upgraded/tuned to boot from a
    USB3 disk on a Pi2, but apparently not.

    Thanks to everyone for writing!

    bob prohaska




    Perhaps I'm coming here too late, but the way I did it was to keep the
    whole of the /boot directory on the SD card and put the whole of /
    (minus /boot contents) onto the USB SSD. Change the PARTUUID parameter
    in cmdline.txt to the new SSD partuuid and of course update the SSD /etc/fstab to the new values. Worked fine for Pi2B and Pi2B+.

    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Is this what fstab would look like?

    /dev/da0s2a mounted on /
    /dev/mmcsd0s2a mounted on /boot
    /dev/mmcsd0s1 mounted on /boot/efi
    /dev/da0s2d mounted on /usr

    That doesn't look impossible, but .....
    Somehow it seems wrong to me, as it requires access to /boot
    "out of order". Maybe the loader can do it.

    In the end, mounting the microsd as root and just hanging /usr
    off of it will relieve most of the limitations of flash storage.
    /var, /tmp and /home can be linked to /usr, swap is hardware anyway.
    This much I know how to do.

    Early on there was much concern about "wearing out" flash storage.
    In practice, it's turned out to be a minor issue. Write delays
    can be a problem, but it really bites hard only on network traffic.
    Putting the most-written filesystems on a USB disk solves most of
    the problems. It would be nice to not need microSD at all once
    booted, but in practical terms that isn't hugely beneficial.

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Scott@21:1/5 to bp@www.zefox.net on Sat Mar 29 10:55:31 2025
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)


    --
    Mike Scott
    Harlow, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to bp@www.zefox.net on Sat Mar 29 15:09:14 2025
    On 29/03/2025 14:30, bp@www.zefox.net wrote:
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)

    It is

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!

    Yes. and the important bit is that cmdline.txt determines what file
    system is used to boot it *initially*
    e.g.
    console=serial0,115200 console=tty1 root=PARTUUID=778a9e44-02 \
    rootfstype=ext4 fsck.repair=yes rootwait noswap=1

    Note the root=command.
    On the USB drive you must also have the same ID in the /etc/fstab file...


    PARTUUID=778a9e44-02 / ext4 defaults,noatime 0 1


    So an SD card boot on PIOS can use a USB drive to finish the boot and
    mount the root filesystem.

    As for BSD, there must be an equivalent file somewhere

    Thanks for writing,

    bob prohaska



    --
    For every complex problem there is an answer that is clear, simple, and
    wrong.

    H.L.Mencken

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to bp@www.zefox.net on Sat Mar 29 17:03:19 2025
    bp@www.zefox.net wrote:
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!

    Does it show the FreeBSD beastie text-mode screen? https://docs.freebsd.org/images/books/handbook/virtualization/qemu-freebsd02.png

    In which case you can probably set things up in loader.conf: https://docs.freebsd.org/en/books/handbook/boot/index.html#boot-loader

    the same way you do on x86.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Scott@21:1/5 to bp@www.zefox.net on Mon Mar 31 08:54:43 2025
    On 29/03/2025 14:30, bp@www.zefox.net wrote:
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!


    I've just looked at what's on mine:

    root@kirk:/ # df /boot/msdos/
    Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/msdosfs/MSDOSBOOT 51096 25084 26012 49% /boot/msdos

    root@kirk:/ # ls /boot/msdos/
    EFI bcm2710-rpi-3-b-plus.dtb
    fixup.dat fixup_db.dat start4db.elf LICENCE.broadcom bcm2710-rpi-3-b.dtb
    fixup4.dat fixup_x.dat start4x.elf README bcm2711-rpi-4-b.dtb
    fixup4cd.dat overlays start_cd.elf armstub8-gic.bin bootcode.bin
    fixup4db.dat start.elf start_db.elf armstub8.bin config.txt
    fixup4x.dat start4.elf start_x.elf bcm2710-rpi-2-b.dtb dtb
    fixup_cd.dat start4cd.elf u-boot.bin


    So I seem to be running with no cmdline.txt. Boots happily off the
    attached usb drive, no sdcard.

    But I stand corrected.

    Thanks for writing,

    bob prohaska




    --
    Mike Scott
    Harlow, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Theo on Sun Mar 30 18:38:08 2025
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    bp@www.zefox.net wrote:
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:
    On 29/03/2025 04:47, bp@www.zefox.net wrote:
    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Fbsd 13.x on a pi4, booting off a usb disk:

    # cat /boot/msdos//config.txt
    [all]
    arm_64bit=1
    dtparam=audio=on,i2c_arm=on,spi=on
    dtoverlay=mmc
    dtoverlay=disable-bt
    device_tree_address=0x4000
    kernel=u-boot.bin

    [pi4]
    hdmi_safe=1
    armstub=armstub8-gic.bin


    At least, I assume that's the equivalent file. :-)

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!

    Does it show the FreeBSD beastie text-mode screen? https://docs.freebsd.org/images/books/handbook/virtualization/qemu-freebsd02.png

    In which case you can probably set things up in loader.conf: https://docs.freebsd.org/en/books/handbook/boot/index.html#boot-loader

    the same way you do on x86.

    Might it be possible to let the machine boot from microSD to the
    loader prompt, next re-load the kernel from the USB drive, then
    start the new kernel and finally mountroot from USB?

    That seems too easy. I must be missing something.

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to bp@www.zefox.net on Mon Mar 31 00:10:38 2025
    bp@www.zefox.net wrote:
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    bp@www.zefox.net wrote:

    AIUI, config.txt sets up the Pi, cmdline.txt furnishes
    runtime arguments to the kernel when that kernel is
    linux. If this isn't true somebody please correct me!

    Does it show the FreeBSD beastie text-mode screen?
    https://docs.freebsd.org/images/books/handbook/virtualization/qemu-freebsd02.png

    In which case you can probably set things up in loader.conf:
    https://docs.freebsd.org/en/books/handbook/boot/index.html#boot-loader

    the same way you do on x86.

    Might it be possible to let the machine boot from microSD to the
    loader prompt, next re-load the kernel from the USB drive, then
    start the new kernel and finally mountroot from USB?

    That seems too easy. I must be missing something.

    Well, it's less easy than I thought, but it does seem to work.

    The method is to interrupt boot just before the kernel starts.
    Next, unload the kernel, set the currdev to disk0s2a, set
    the root device to da0s2a, load the kernel again (from the
    new root device and boot.

    Setting currdev and rootdev can be done in /boot/loader.conf
    on the microSD's FreeBSD, I've asked on the freebsd-arm mailing
    list where the unload and load commands should go.

    There are still some problems with usb disk discovery failing,
    but this is a big improvement.

    Thank you Theo!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to bp@www.zefox.net on Mon Mar 31 12:27:23 2025
    On 31/03/2025 01:10, bp@www.zefox.net wrote:
    The method is to interrupt boot just before the kernel starts.
    Next, unload the kernel, set the currdev to disk0s2a, set
    the root device to da0s2a, load the kernel again (from the
    new root device and boot.

    Ugly...
    Setting currdev and rootdev can be done in /boot/loader.conf
    on the microSD's FreeBSD, I've asked on the freebsd-arm mailing
    list where the unload and load commands should go.

    So that is the same as cmdline.txt
    There are still some problems with usb disk discovery failing,
    but this is a big improvement.
    I think that is the rootwait switch on the Linux system

    https://forums.freebsd.org/threads/how-to-delay-mountroot.92152/

    Has some info that might be useful

    --
    Outside of a dog, a book is a man's best friend. Inside of a dog it's
    too dark to read.

    Groucho Marx

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to The Natural Philosopher on Mon Mar 31 15:34:29 2025
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 31/03/2025 01:10, bp@www.zefox.net wrote:
    The method is to interrupt boot just before the kernel starts.
    Next, unload the kernel, set the currdev to disk0s2a, set
    the root device to da0s2a, load the kernel again (from the
    new root device and boot.

    Ugly...

    Absolutely agreed!

    Setting currdev and rootdev can be done in /boot/loader.conf
    on the microSD's FreeBSD, I've asked on the freebsd-arm mailing
    list where the unload and load commands should go.

    So that is the same as cmdline.txt

    Similar, in the sense that loader.conf on FreeBSD permits one to
    set variables that are passed as flag options to the kernel on startup.

    There are still some problems with usb disk discovery failing,
    but this is a big improvement.
    I think that is the rootwait switch on the Linux system

    https://forums.freebsd.org/threads/how-to-delay-mountroot.92152/

    Has some info that might be useful

    The disk discovery seems to happen during the bootcode.bin or u-boot
    stage. By the time loader starts up, if the usb disk hasn't been found,
    loader fails to report its existence in an lsusb query.

    There is a variable in loader.conf called
    kern.cam.boot_delay
    which can be set to wait in milliseconds for the disk to spin up,
    but that only affects behavior after bootcode.bin and u-boot are
    long gone.

    This situation is what prompted me to post earlier about boot managers
    for the RPi family. Bootcode.bin seems to do a rather unreliable job
    of exploring the system for bootable media. U-boot likewise takes its
    cues from bootcode.bin, apparently.

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to Mike Scott on Mon Mar 31 15:02:16 2025
    Mike Scott <usenet.16@scottsonline.org.uk.invalid> wrote:


    So I seem to be running with no cmdline.txt. Boots happily off the
    attached usb drive, no sdcard.

    On a Pi4 usb boot is no problem at all. The Pi2 has always been
    troublesome. I'm interested in the problem only because I have
    four of them and would like to keep them in service.

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bp@www.zefox.net@21:1/5 to bp@www.zefox.net on Tue Apr 1 16:02:05 2025
    bp@www.zefox.net wrote:
    Chris Elvidge <chris@internal.net> wrote:
    On 28/03/2025 at 15:19, bp@www.zefox.net wrote:
    Theo <theom+news@chiark.greenend.org.uk> wrote:

    I believe that config.txt is consumed by the GPU-side firmware, which is >>>> start*.elf. bootcode.bin is just enough to be able to load start.elf
    and config.txt from storage. I'd guess that if that storage is USB, it's >>>> too early to have read config.txt.

    It looks like the path of least resistance is to let FreeBSD boot from
    microSD, mount that as root and then mount the USB disk as /usr, with
    /var/, /tmp/ and swap mounted from the USB device, either as links
    to /usr or maybe as hard partitions.

    That worked fine in the very early days of FreeBSD on the Pi2.
    There isn't much write activity to the root filesystem in a
    "production" environment, only during OS upgrades. If the microSD
    is sufficiently oversized it'll last long enough.

    I'd hoped bootcode.bin could be upgraded/tuned to boot from a
    USB3 disk on a Pi2, but apparently not.

    Thanks to everyone for writing!

    bob prohaska




    Perhaps I'm coming here too late, but the way I did it was to keep the
    whole of the /boot directory on the SD card and put the whole of /
    (minus /boot contents) onto the USB SSD. Change the PARTUUID parameter
    in cmdline.txt to the new SSD partuuid and of course update the SSD
    /etc/fstab to the new values. Worked fine for Pi2B and Pi2B+.

    I've yet to figure out what the FreeBSD equivalent to cmdline.txt
    is. That might be the key to making your approach work.

    Is this what fstab would look like?

    /dev/da0s2a mounted on /
    /dev/mmcsd0s2a mounted on /boot
    /dev/mmcsd0s1 mounted on /boot/efi
    /dev/da0s2d mounted on /usr

    That doesn't look impossible, but .....
    Somehow it seems wrong to me, as it requires access to /boot
    "out of order". Maybe the loader can do it.

    It turns out in FreeBSD that setting
    currdev="disk0s2a"
    and
    vfs.root.mountfrom="ufs:/dev/da0s2a"
    in /boot/loader.conf of the microSD card does what's wanted.

    Provided da0 is found immediately, the kernel is loaded from /da0s2a/boot/kernel
    and then started. After the kernel has populated /dev root is
    then mounted on /da0s2a. So far, so good.

    If da0 is not detected by bootcode.bin, the kernel loads from
    mmcsd0, but by the time of mountroot the kernel has found
    da0 so the mountroot on da0 succeeds anyway. That mismatches
    kernel and world, but if the revisions are close the boot will
    succeed anyway and the system will run correctly.

    For now, that's what I'm trying to do.

    Integrating the microSD's msdos filesystem seems easy, just
    mount /dev/mmcsd0s1 on /boot/msdos. But, since FreeBSD never
    touches /boot/msdos, there isn't much point.

    Mounting /dev/mmcsd0s0s2a on /boot becomes a problem, however.
    It would end up at /boot/boot if the intact microSD partition
    is mounted, which isn't updateable using the existing system
    upgrade scripts. If the files in the microSD's boot partition
    are raised to the top of the disk, the paths will be wrong if
    the machine ends up booting from the microSD alone. That I think
    will trigger a boot failure if da0 isn't detected by bootcode.bin.

    Perhaps it would work to mount mmcsd0s2a on /microSD, with a
    symbolic link from /boot to /dev/mmcsd0s2a/boot. Updates
    to FreeBSD's /boot files would go on the microSD. If da0
    isn't found the paths are correct for microSD boot alone.
    But, I'd really like to keep kernel files off flash storage.

    It would be much better to fix the da0 detection failures.
    Most of them seem to happen on warm boot. Cold boots have
    so far all succeeded. I _think_ it's got something to do with
    the Pi2's usb2 interface talking to a usb3-sata bridge.
    A second Pi2 with a very old usb2-pata bridge has worked
    for five years without fault.

    In hindsight, I think this is what motivated my question
    about standalone Raspberry Pi boot managers.

    Thanks for reading, and everybody's help!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)