On Sun, Mar 05, 2017 at 09:23:13AM +0100, Otto Moerbeek wrote: > On Sun, Mar 05, 2017 at 07:00:46PM +1100, Jonathan Gray wrote: > > > On Sun, Mar 05, 2017 at 08:37:30AM +0100, Otto Moerbeek wrote: > > > On Sat, Mar 04, 2017 at 06:40:57PM -0500, Joe Gidi wrote: > > > > > > > After jsg@ mentioned that booting a Raspberry Pi 3 from a USB device > > > > might be > > > > possible, I decided to find out how deep the rabbit hole is. > > > > As it turns out, > > > > it's currently a bit convoluted, but it can be made > > > > to work with OpenBSD. > > > > First off, USB boot support is just now getting fully ironed out. > > > > You'll need > > > > to update the firmware on your Pi to make it work. I > > > > installed the latest > > > > (2017-03-02) Raspbian image to an SD card and > > > > booted the Pi from that. While > > > > booted in Raspbian, update the > > > > firmware: > > > > > > > > sudo apt-get update > > > > sudo apt-get > > > > install rpi-update > > > > sudo rpi-update > > > > > > > > It's then necessary to actually enable USB > > > > boot support. Add the > > > > following 2 lines to /boot/config.txt to enable USB boot > > > > mode and set > > > > a 5-second timeout to allow time for USB device initialization: > > > > program_usb_boot_mode=1 > > > > program_usb_boot_timeout=1 > > > > > > > > NOTE: Apparently these > > > > variables are set in the Pi's OTP memory, which > > > > means once they're set, they > > > > can't ever be unset. > > > > > > > > Reboot for the changes to take effect. At this point the > > > > Pi should be > > > > ready to support USB booting. > > > > > > > > While you still have a working > > > > Raspbian install, grab a copy of the > > > > /boot/bootcode.bin and /boot/start.elf > > > > files for later use; apparently > > > > we need these special versions of those two > > > > files for USB boot > > > > support. At this point we're done with Raspbian and can > > > > shut it down > > > > to install OpenBSD. > > > > > > > > Next, write the OpenBSD miniroot60.fs to an > > > > SD card, plug in your USB > > > > drive, and boot the Pi. You should be greeted with > > > > the usual OpenBSD > > > > installer, and you should be able to install to your USB > > > > drive > > > > (probably sd0). Once the installer is done, run 'halt', unplug the Pi, > > > > and remove the SD card and USB drive. > > > > > > > > To make your USB drive bootable, you'll > > > > need to plug it into another > > > > system and mount its 'i' partition (the FAT32 > > > > boot partition) to make > > > > a few changes. Replace the bootcode.bin and start.elf > > > > files with the > > > > ones from Raspbian, and add the u-boot.bin file from the 'i' > > > > partition > > > > of your miniroot60.fs SD card. > > > > > > > > With those changes made, your Pi > > > > should be able to boot OpenBSD > > > > directly from a USB drive with no SD card > > > > needed. Note that it seems > > > > to take around 10 seconds for the Pi to reach the > > > > OpenBSD bootloader > > > > and fire up the kernel. > > > > > > > > Hope this information is helpful > > > > to someone... > > > > > > > > -- > > > > Joe Gidi > > > > j...@entropicblur.com > > > > > > > > "You cannot buy skill." > > > > -- Ross Seyfried > > > > > > Thanks, I'll try this out soon, > > > > > > Some notes of things I saw when trying to boot from a sd-card using > > > various a USB devices to install to: > > > > > > Some USB devices do seem to hang the rpi3 sometimes while u-boot is > > > scanning the usb bus, in my case an old USB flash stick. > > > > > > With a disk enclosure (2.5" usb bus powered with spinning disk), the > > > hangs did not occur. But I saw another problem that looked to be > > > caused by the reset of the usb bus while the kernel was booting (from > > > sd-card). The disk enclosure did not get recognized in time when the > > > kernel reached the ask root device questions, making it imposible to > > > select the usb drive as boot device. > > > > > > I manged to boot the machine using an externally powered enclosure > > > with a 3.5 disk. I'll be buying a SSD today to see how that goes. > > > > > > -Otto > > > > > > > You don't need to bother with linux, the files are in the > > raspberrypi-firmware package with version 1.20170215. And the next > > snapshot will include the newer firmware. > > > > Though that will take a few days, due to -current moving to 6.1 a > > xenocara build will have to be done as well and that tends to trigger > > problems with stuck and segfaulting processes. > > Will the fidding with > > > > program_usb_boot_mode=1 > > > program_usb_boot_timeout=1 > > still be neccesary? > > -Otto >
Unless the parts of the miniroot/ramdisk which create config.txt are changed to do so yes. I'm not clear on the downsides of irreversibly setting these otp bits. Not being able to use older firmware versions? >From what I've read the boot rom will still try to load from the sd slot first before trying to probe usb when it is set.