How to boot Quirky Linux from a USB flash drive on a Pi3
Part I. Some technical background (for just the practical part, skip to Part II)
When the Broadcom BCM2837 SoC (CPU/GPU chip on the Pi3) was designed, a small amount of experimental boot code was added in ROM. This code cannot be modified once the SoC is manufactured, so the designers decided to keep the new boot modes disabled (using a register bit) until they could test that the code worked as planned before publicizing how to enable these boot modes.
Turns out the new boot modes work well enough so that the Pi3 can now boot from USB (flash drive or hard disk), over Ethernet and well as from an SD card.
Quoting Gordon Hollingworth, the Director of Software at Raspberry Pi, on adding the code for the extra boot modes: "Needless to say, it’s not easy squeezing SD boot, eMMC boot, SPI boot, NAND flash, FAT filesystem, GUID and MBR partitions, USB device, USB host, Ethernet device, and mass storage device support into a mere 32kB."
Ref:
https://www.raspberrypi.org/blog/pi-3-b ... rage-boot/
Part II. Enabling the new boot modes
To enable the new boot modes, follow the tutorial in this link:
https://www.raspberrypi.org/documentati ... des/msd.md
To summarize, you put Raspbian on an SD card, boot it on a Pi3, then install special versions of 'start.elf' and 'bootcode.bin', and edit 'config.txt' adding a line. You then reboot and the previously mentioned register bit will be enabled allowing the new boot modes to work.
Part III. Preparing Quirky Linux to boot from a USB flash drive
What needs to be done is to copy Quirky Linux to an 8GB (or bigger) USB flash drive, then replace all files except '
kernel7.img', '
cmdline.txt' & '
config.txt' on the 1st, FAT32, partition with ones from the SD card (containing the modified Raspbian used in Part II). I also copied over the 'overlays' folder but don't know if that was really neccessary.
Then edit 'cmdline.txt', replacing
with
Now, on the 2nd, ext4, partition of the USB flash drive, edit /etc/fstab changing the line
Code: Select all
/dev//dev/sdb2 / ext4 defaults,noatime 0 1
to
Code: Select all
/dev//dev/sda2 / ext4 defaults,noatime 0 1
(that's changing 'sd
b2' to 'sd
a2')
That's it! Just remove any SD card still inserted in your Pi3, plug in the USB flash drive with the modified Quirky Linux on it and connect power. The Pi3 now-enabled boot code will look on the FAT partitions of any connected devices it finds for 'bootcode.bin' (in this case, the USB flash drive) and boot from it.
Here's a link explaining the boot code flow:
https://github.com/raspberrypi/document ... ootflow.md
Booting is faster from an SD card than from a USB flash drive for the usual reason: about 5 seconds needed to wait while detecting a USB drive.
Hope I didn't miss anything.
Edited: Oops, need to keep Barry's kernel too!