We're working slowly towards support for USB boot, but the situation is complicated by our use of u-boot. In Eoan I changed the kernel command line and fstab (as
procount and
smoore have noticed) to use FS labels to identity the boot and root partitions, so those no longer need changing. I also updated the u-boot script so that
in theory it can now boot from USB as well as SD/MMC.
Unfortunately there's still one missing bit: u-boot itself, despite having USB support compiled in (and despite apparently having USB mass-storage compiled in) ... doesn't see any mass storage devices whenever I've tested it! I've not yet had time to dig into this (beyond examining the compile time flags), but if anyone fancies a delve I'd love to hear any ideas!
In the meantime, if you want to try USB boot your best bet is to do so on a Pi3+ (where USB mass storage boot is supported "out of the box"), and to skip u-boot on startup (it isn't strictly required on classic - however it is on core for the A/B booting capability and the classic & core boot sequences derive from the same source). To do this:
- burn the image to your chosen USB device
- un-plug and re-plug the device in to mount it cleanly
- open config.txt on the boot partition and comment out/delete all the [pi*] sections
- add kernel=vmlinuz in the [all] section
- add initramfs initrd.img followkernel in the [all] section
You should wind up with something looking like this:
Code: Select all
# Please DO NOT modify this file; if you need to modify the boot config, the
# "usercfg.txt" file is the place to include user changes. Please refer to
# the README file for a description of the various configuration files on
# the boot partition.
# The unusual ordering below is deliberate; older firmwares (in particular the
# version initially shipped with bionic) don't understand the conditional
# [sections] below and simply ignore them. The Pi4 doesn't boot at all with
# firmwares this old so it's safe to place at the top. Of the Pi2 and Pi3, the
# Pi3 uboot happens to work happily on the Pi2, so it needs to go at the bottom
# to support old firmwares.
#[pi4]
#kernel=uboot_rpi_4_32b.bin
#max_framebuffers=2
#
#[pi2]
#kernel=uboot_rpi_2.bin
#
#[pi3]
#kernel=uboot_rpi_3_32b.bin
[all]
device_tree_address=0x03000000
kernel=vmlinuz
initramfs initrd.img followkernel
# The following settings are "defaults" expected to be overridden by the
# included configuration. The only reason they are included is, again, to
# support old firmwares which don't understand the "include" command.
enable_uart=1
cmdline=nobtcmd.txt
include syscfg.txt
include usercfg.txt
At this point you can simply plug your USB device into your Pi3+, remove any SD card, and it should boot happily (the rainbow screen takes a bit longer to go away as it takes time for the firmware to notice there's no SD, to fire up USB, enumerate devices, etc. but it does get there - I've tried this with an SSD and a flash drive).
A warning: right now this will work on both armhf and arm64. However, in future this
will break on arm64. The reason is to do with kernel compression: the armhf image is currently a self-extracting gzipped image; that's fine as both u-boot and the pi's firmware bootloader can handle that. However, the arm64 image is currently uncompressed. The reason is simply that self-extracting kernels aren't supported on arm64 (upstream's view is roughly "bootloaders should handle that, and we never should have added self-extractors on all those other archs in the first place").
While it's uncompressed, things will work okay (both u-boot and the pi's firmware bootloader can read that), but we're planning to ship it compressed (not self-extracting, just compressed) in future because the uncompressed kernel is pretty large and that's causing issues on some of the images with minimal boot partitions. Once it's shipped compressed, u-boot will be required to uncompress it before launching it (the pi's firmware bootloader doesn't currently know how to deal with a compressed kernel), and obviously that's going to break the instructions above which skip u-boot. You could work around this by un-compressing the kernel image after an upgrade, but it's an annoying hoop to jump through (I'd rather just fix u-boot to read USB devices properly).
For those wanting to try this on a Pi4:
I would caution against trying this on a Pi4 at the moment. Booting from USB mass storage isn't (currently) supported on that model (although it is planned), so you wind up having to use an SD card to load the kernel and initrd, then continue the boot on the USB device.
It is possible to get this working (though because things are now relying on FS label you have to be careful not to duplicate those!), but you will wind up with issues every time the kernel gets upgraded or the initrd rebuilt because flash-kernel gets confused about where the boot partition "really" is (FWIW I wound up with similar problems when I tried this in Raspian even without flash-kernel - basically having two boot partitions, or a boot partition on a separate device to the root partition winds up painful whichever way you go). Yes, it's possible to work around these issues if you remember to jump through some more hoops, but while it was an interesting experiment I'd rather just wait for official USB boot support on the 4 which will make everything much simpler and should mean you can follow a similar path to the 3+ above.
Dave.