Pi Boot from USB?
Jess Hampshire (158) 865 posts |
Hi I recently discovered that the more recent versions of the Raspberry Pi can boot from a USB drive. (with no SD card) Does RISC OS support this? |
Stuart Painting (5389) 714 posts |
The short answer is “Well, sort of…” Updating the Pi’s Write-Once memory to allow “boot from USB” has to be done from Raspbian. The USB boot drive needs to be set up in exactly the same way as the boot SD (i.e. with a FAT32 partition for the Pi boot loader, and the rest of the disc in Filecore format). SystemDisc should do this for you. Where you might come unstuck are the CMOS RAM settings. RISC OS stores CMOS RAM settings on the boot SD: this is (a) hard-coded, and (b) not the same place that the Pi boot loader will be loading them from. You can (sort of) get round this by leaving the SD card plugged in and remembering to copy !Boot.Loader.CMOS to the USB drive every time you make a configuration change, but if your aim was to get rid of the SD card altogether this won’t fit the bill. |
Rick Murray (539) 13840 posts |
http://heyrick.ddns.net/files/SDCMOS.ffa It’s a copy of the standard SDCMOS with extra nulls added after the paths, so… Load it into Zap, you’ll see this (some stuff above, some below): 00000048 : (15 : 20353128 : EORCSS R3,R5,R8,LSR #2 0000004C : Oct : 2074634F : RSBCSS R6,R4,PC,ASR #6 00000050 : 2016 : 36313032 : Undefined instruction 00000054 : )... : 00000029 : ANDEQ R0,R0,R9,LSR #32 00000058 : .... : 00000001 : ANDEQ R0,R0,R1 0000005C : SDFS : 53464453 : MOVTPL R4,#&6453 00000060 : :$.C : 432E243A : Undefined instruction 00000064 : MOS. : 00534F4D : SUBEQS R4,R3,R13,ASR #30 00000068 : .... : 00000000 : ANDEQ R0,R0,R0 0000006C : .... : 00000000 : ANDEQ R0,R0,R0 00000070 : .... : 00000000 : ANDEQ R0,R0,R0 00000074 : .... : 00000000 : ANDEQ R0,R0,R0 00000078 : .... : 00000000 : ANDEQ R0,R0,R0 0000007C : SDFS : 53464453 : MOVTPL R4,#&6453 00000080 : :$.! : 212E243A : Undefined instruction 00000084 : Boot : 746F6F42 : STRVCBT R6,[PC],#-3906 00000088 : .Loa : 616F4C2E : Undefined instruction 0000008C : der. : 2E726564 : CDPCS CP5,7,C6,C2,C4,3 00000090 : CMOS : 534F4D43 : MOVTPL R4,#&FD43 00000094 : .... : 00000000 : ANDEQ R0,R0,R0 00000098 : .... : 00000000 : ANDEQ R0,R0,R0 0000009C : .... : 00000000 : ANDEQ R0,R0,R0 000000A0 : .... : 00000000 : ANDEQ R0,R0,R0 000000A4 : .... : 00000000 : ANDEQ R0,R0,R0 000000A8 : .... : 00000000 : ANDEQ R0,R0,R0 000000AC : Save : 65766153 : LDRVSB R6,[R6,#-339]! 000000B0 : CMOS : 534F4D43 : MOVTPL R4,#&FD43 Switch to ASCII mode (normally Sh-Ctrl-F1) and Overwrite mode (press Insert – title should say “(uao)” at the end). Locate the first path (SDFS:$.CMOS) and change it as necessary within its limitations. Then do the same for the second path (the !Boot.Loader.CMOS one). Switch back to Code mode (Sh-Ctrl-F5) and verify the second starts at offset &7C, and the SaveCMOS text starts at offset &AC. If they’re both good, save the module and then get it to load early in the boot sequence – an easy way is to drop the module into !Boot.Choices.Boot.PreDesk with an “!!” prefix. You’ll note that DeepKeys does exactly this. If that looks scary, then… isn’t USB a SCSI device? If so, here’s an UNTESTED version with the “SDFS” replaced by “SCSI”. It might work. |
John Sandgrounder (1650) 574 posts |
It is a lot simpler to let the Pi boot from an SD card, but then to configure RISCOS to use a USB Drive. (*configure filesystem SCSI) You do not then need either the SD card or the USB drive to be ‘partitioned’. For best reliability use an SSD rather than a Flash memory stick. |
Chris (2061) 72 posts |
Just reviving this as recently my SD card slot has become unusable. Is there no way to kickstart the boot from supervisor? |
Chris Gransden (337) 1207 posts |
You should be able to just type, *SCSI |
Barry Smith (13881) 10 posts |
Hi, I am trying to get my RPi4 to boot RISC OS 5 from an external USB drive. I have done lots of searching on various web forums to try and put together the correct process, which is kind of working. I have: If I try to run !Boot, I get a message saying “the drive is empty”. How do I make the changes to the USB config so that it can see the firmware and CMOS files on the USB? I have tried to *configure the “filesystem to SCSI” and “SCSIFSdrive 4”. This returned no errors so I was hopeful that it was sorted, but a restart put me back in the same position. Any assistance that you can offer, as to what I should change to make this work, would be most welcomed. Cheers, Barry. |
Chris Mahoney (1684) 2165 posts |
What are you trying to accomplish? A. Free up the SD slot by not using an SD card at all, or If it’s B, then things are a bit easier to set up. You can store the ROM and CMOS on an SD card (which you can optionally hide the icon for), and use the USB SSD for everything else. I like this option because it works similarly to real Acorn hardware. If you prefer option A then I believe it’s doable, but things are a bit more complicated, so can you please confirm which option you want to use? |
David Pitt (9872) 363 posts |
The Pi ROM on startup reads CMOS from a file in the same folder as the Pi ROM image. The little catch is that the Pi ROM is hardwired to write CMOS settings only to SDFS locations. The necessary changes to have RISC OS start from USB are set but the the ROM attempts to write them to SDFS, the USB CMOS file is unaware of the changes so the settings appear to have failed. The way around this is to configure the SCSI and drive number changes then manually save the CMOS to the USB Fat partition with a For example :- SaveCMOS SCSI::4.$.!Boot.Loader.CMOS There is just one slight snag in that if there is no real time clock the Pi will startup in 1970, until Network time setting completes. On startup the ROM normally reads the time stamp of the only CMOS file it knows about on SDFS and sets its clock initially to that. There is no such CMOS file in a USB only boot if the CMOS slot is empty. It is not a real problem, it just looks a bit odd. |
Barry Smith (13881) 10 posts |
Chris & David, Thanks for your replies. @Chris – In answer to your question, I was hoping to leave the SD drive empty and boot 100% from the USB. This would then allow me to use the SD drive as a way to move data between machines. @David – Thanks for your detailed process. I have carried it out and created the !cmos-save (Obey) file in PostDesk with the SaveCMOS instruction in it. Even with this change, at startup, It still stops at the Supervisor and with *desktop, takes me to the greyed desktop and that error message “the drive is empty” and !Boot doesn’t run. Is this because the RISCOS.IMG is still trying to run a CMOS file from the SDFS? Is it possible to get an edited IMG file that looks at SCSI::4 instead? I am at a loss as to how to proceed. I guess someone has done it before, but I can’t find a page that explains the best step by step solution. Any further assistance would be welcomed. Cheers, Barry. |
David Pitt (9872) 363 posts |
“the drive is empty” means just that, the drive being called is not there, something is adrift in the settings. Having got to the desktop the drives should be visible on the icon bar. Clicking Menu on the drive icons will show the filing systems and drive numbers. The intended boot drive should seen.
No. The SCSI hard drive is only definitely 4 if there are no other devices. USB booting is not supported, it requires the user to set it up and cannot easily be supplied as working out of the box. SDFS, on the other, just works. |
Andrew McCarthy (3688) 605 posts |
Edit: I initially couldn’t find these, but there’s also instruction here It has been a while since I’ve done this using Partition Manager Here is what I did. Use RISC OS from an SD card to run Partition Manager, then use the Menu Mouse button (scroll wheel) to find the option Initialise Pi Boot Drive, with the pointer hovering over the drive you need to Initialise. Once you’ve set the options you need and it completes, shut down, switch off, remove the SD card and power up. My setup: an SSD, USB attached via a HUB to a Pi4. My workflow on reaching the desktop: Ctrl-F12 to open a task window. Enter the following based on the knowledge of your system: co. filesystem SCSI # and press the return key. co. SCSIFSDrive 4 # The number 4 may differ from your setup. co. MonitorType EDID co. AutoDST savecmos …!Boot.Loader.CMOS # The full path to the CMOS location is required. Reboot- shut down and restart the computer. Good luck. |
David Jackson (3317) 22 posts |
PS there’s a one-time programmable memory on the Rpi that sets where to look for the BOOT |
Barry Smith (13881) 10 posts |
David, Excellent progress. Restarted and it booted without the keyboard error and to the correct desktop. However, I only see one disk on the Iconbar, and that is the “PiBoot” FAT partition, as created by the RPi Imager and which contains the CMOS, Firmware and Config files. Application icons on the desktop also run. Do you know of a way in which I can access both FAT & ADFS partitions? Would I be better to just use FAT for the whole drive or is that an issue for RISC OS applications? Sorry if these are silly questions. Still learning. Thanks for all your help. Barry. |
Graeme (8815) 106 posts |
The FAT partition is with a Select-Click (left mouse button) and ADFS is Adjust-Click (right mouse button). There is *FatSwopMouseButtons to set which icons you want this behaviour swapped for. Some good help for USB boot is under section 4.2 at: https://www.riscosopen.org/wiki/documentation/show/Raspberry%20Pi%20questions%20and%20answers#TOC4 |
David Pitt (9872) 363 posts |
That did not work here. Is there a Configure option required for Fat32FS? |
Graeme (8815) 106 posts |
Oh sorry, forgot about one thing. If you left-click and it opens the FAT partition, then both left and right clicks will open the FAT partition. You can reset it by going to the menu on the drive and selecting dismount. Now the right click should open the ADFS filer window. |
David Pitt (9872) 363 posts |
It does but only once. After a Select click it reverts to only opening the Fat partition with either click. Checked with Fat32FS 1.64 |
David Pitt (9872) 363 posts |
Without Fat32FS both Select and Adjust open the SCSI partition, the Fat partition is visible as the Loader directory in !Boot. |
Barry Smith (13881) 10 posts |
Thanks to you all for your assistance. I have kept Fat32FS running as I have a 1Tb FAT32 external drive which I am using for data storage. I am getting used to using the right key to open the SCSIFS partition, but dismount has become my friend!! RPi 4 now boots from SSD alone and the CMOS is being saved and loaded from the SSD, so that is all good. :) Thanks again for your help. Much appreciated. Cheers, Barry. |
Barry Smith (13881) 10 posts |
@Rick,
I have tried downloading this file to see if I can apply this change to my USB drive, but it appears the file is no longer available from this location. Does anyone know of a different location, or have a copy of this file I can use? Cheers, Barry Smith. |
Rick Murray (539) 13840 posts |
I had a bit of a problem with my new fibre connection recently, so the server was turned off because of that and thunderstorms, haven’t yet gotten around to (read: remembered) to turn it back on. You can do it yourself. Just load a softload version of the module (not the ROM one) into an editor and change “SDFS” to “SCSI”. That’s all I did. |
Barry Smith (13881) 10 posts |
@Rick, Thanks for the info. I will take a look at it when I am back in front of my RPi. Cheers, Barry. |