Splitting up !Boot
Pages: 1 2
Chris (121) 472 posts |
I’ve been pondering some of the difficulties people (including myself) have been having with updating their OS to make use of new features like EDID, etc. Particularly on the Pi, it’s a bit fiddly to update the disc image safely, and getting it wrong can result in losing CMOS settings, or a usable display, or even data. I might be getting things wildly wrong, but it seems that most difficulties come from getting stuff mixed-up in the labyrinthine !Boot structure, and so I wondered if there was a way of making this somewhat less all-encompassing? Specifically, it seems to me the problem comes about because !Boot is really a hybrid that: Ideally, users shouldn’t ever need to delve into the directory tree, but in practice it can often be necessary to get things working. If you ever make a mess of things and need to install a fresh !Boot, you might lose all your cherished app preferences and resources. So I wondered if splitting (3) out of the directory might be beneficial. After all, if my app choices and resources such as !AWViewer etc. are safely parked away from the main !Boot, then updating the latter, or even replacing it entirely, becomes a simpler proposition. The proposal would be that !Boot retains elements (1) and (2) above, whereas a new top-level directory (say, !Choices) holds (3). It would need some tidying to make this distinction a clean one, as the current !Boot.Choices is a mix of (2) and (3), but would it be worth looking into? |
Jeffrey Lee (213) 6048 posts |
A couple of years ago, the topic of packaging the boot sequence/disc image came up again, and I shared some of my thoughts about it. Possibly those thoughts are useful here as well: https://www.riscosopen.org/forum/forums/5/topics/3178#posts-41094 |
Chris (121) 472 posts |
Yes, though I don’t fully understand the issues in your proposal, since I don’t fully understand what the Hook directories do :) Is the initial copy from these directories done to ensure that the !Boot structure used matches up with the OS features in ROM? If so, would it be difficult to modify the current system to avoid !Boot copying bits of itself? |
Jeffrey Lee (213) 6048 posts |
Pretty much, yeah.
I’m not sure. Based on what I saw when trying out the EDID stuff, it should be pretty straightforward. But I don’t fully understand the boot sequence either, so some more investigation will be required. |
Stefano Bertinetti (2986) 11 posts |
I never fully understood the !Boot and booting process since it appeared. My 2 cents are: as !Boot is needed but now is a source of problems and misunderstandings, maybe it’s time for a rewriting from scratch. To see what’s really needed and move some stuff away or delete/merge. |
Chris Evans (457) 1614 posts |
AIUI the reason why the hook systems is there dates back to when schools often had networked computers that didn’t have a hard disc (e.g. RISC OS 3.1 A310s, A3000s etc). They could be set to boot from a computer that did have a hard disc and would be given the appropriate resources. I’m surprised no ones mention Rick Murray’s Harinezumi Building logging as standard into Booting would save a lot of people a lot of time! |
Jeffrey Lee (213) 6048 posts |
We aren’t talking about removing the hook folders – just the logic that creates the initial !Boot.Choices.Boot folder by copying some of the content from the hook folder (and any other places where bits of the boot sequence get copied around on first boot) |
Rick Murray (539) 13840 posts |
I think the problem with the Pi is the need to leave the Loader object intact (no moving it, deleting it…). So perhaps what might help is to hook into some relevant FS vectors to block potentially dangerous activities on that file? |
Steffen Huber (91) 1953 posts |
Sounds very complicated. How about adding proper partitioning instead and getting rid of that “Loader” construct? Maybe even adding “link files” that provide access to partitions via things that look like files, which would provide the “Loader” concept without all the associated problems? |
Rick Murray (539) 13840 posts |
Yes, because that’s so much simpler… 🤦 |
Steve Pampling (1551) 8170 posts |
There’s a little module that accompanied the PC card called GuardDD which protects against write/delete actions on image files like the DOS “partition” used by the PC card. ; Claims FileV, traps OS_File 6 (delete) and watches for ; DOS partitions being deleted Of course you could wait for proper partitioning which is a permanent fix and we wouldn’t want to waste a few minutes 32-bitting something if we can wait months (many) for a real fix. |
Sprow (202) 1158 posts |
I already spent many hours doing just that back in 2012, unpicking 15 years of bit rot where all kinds of odd additions had been made without really understanding why (my favourite being the icon sprites being loaded 3 times). I made lots of notes in addition to some of the original design docs which are useful background. I suspect there are some aspects that were obvious at the time that didn’t get written down, for example there are some magic locations that FSLock knows about (!Scrap and Public) when everything else is read only. Some of the work for the never-finished OMAP3Live did make it into !Boot, for example it will now create a default Choices structure on a RAM disc if it finds itself running from a read only medium (eg. ResourceFS). It also needs to cope with network booting, so the order takes account of the network stack not being configured until reasonably late on.
You definitely need the hook directories, otherwise it’s not a universal boot sequence, as the startup (and the places where it looks for things like !Configure) differ from OS version to version. This is handled by building path variables which look back only as far as they should do (eg. RISC OS 5 doesn’t look back to RISC OS 4 stuff). In removing it someone clinging on to RISC OS 5.16 would suddenly find their USB memory sticks don’t work because it was softloaded at that time. The “decade” numbering of the hook directories give an opportunity to make breaking changes by rounding up the OS version number. But still inevitably, if you remove something there’ll be commenters foaming at the mouth that it’s not like a Risc PC did it back in 1994.
Back to the original question: the two things that seem most out of place are !Scrap and Choices. You should already be able to move !Scrap somewhere else (FSLock notwithstanding), it being in BootResources is just a convenience that it gets Filer_Run during booting. I’ve not tried recently, but I don’t remember anything in !Boot actually needing it so it should be movable and just add to the “Run at startup” list in Configure. Choices is a bit of an overlap of boot choices and all the other applications. !ResetBoot wipes both of course. In principle a container !Choices app could be created (like Acorn used to ship on a floppy), though we’d pretty quickly find out who’s abusing Choices: versus Choices$Write or just writing direct into !Boot.Choices.Blah without using either. Plenty of the bundled apps used to get it wrong so I bet all kinds of 3rd party apps do too. |
Chris Mahoney (1684) 2165 posts |
While it’s probably a good idea to tidy things up a bit (MacOS has both System and Library directories, with Library being similar to Resources under RISC OS), can someone just confirm whether I understand things correctly (specifically on the Pi)?
If both of those are true, then isn’t the easiest “quick fix” simply to distribute all updates as !Boot directories with directions to update them through Configure? Basically, avoid people from having up open up !Boot and Loader at all. Obviously there will be cases where manual intervention will be required, but it seems to me that leveraging the existing update installation system will reduce the likelihood of failure. |
Rick Murray (539) 13840 posts |
Hmm… I’ve not seen Steve Revill around here recently. Has he given up reading? ;-)
Hehe… Had to add in a trap on OS_FSControl,26 to stop it being renamed (moved) as well. Tested on a 4MiB DOS file (&FC8) on RAMdisc. No way in hell I’m trying it out on my live Loader file…
|
Steve Pampling (1551) 8170 posts |
Hmmm, never tried a move. I had this feeling you’d look and modify :)
I’m sure someone with a few spare cards will test just that. |
Rick Murray (539) 13840 posts |
The hardest part was grabbing the original sources, given riscos.info is down…again. [http://downforeveryoneorjustme.com/riscos.info] |
John Williams (567) 768 posts |
So, having made this module, like wot I just have, would you recommend putting it in PreDesk or in Tasks? |
Colin Ferris (399) 1814 posts |
Rick – what does line below do? MSR CPSR_f, #(1<<27) ; disable interruptsie I=7 in cpsr_c (RO5) |
Jon Abbott (1421) 2651 posts |
Nothing, the preceding OS_GenerateError doesn’t return. |
Rick Murray (539) 13840 posts |
Yup, you’re right. :-) I was looking at the old 26 bit PSR to see what that bit was as I was expecting to set V or somesuch, but didn’t change it to be the correct I but in 32 bit PSR. Oops. That said, ORRing on I bit (as the original code does)… What re-enables interrupts afterwards? |
David Feugey (2125) 2709 posts |
Choices → !Choices = nice idea. Perhaps that – yes – !Boot could be separated completely from !Resources. !Boot → small static !Boot on disc (could be in ROM under ROS5) Other changes: !Configure → Bye bye. Replace with Resources:$.Configure. Can be accessed with a right click on Apps. Populated with some default static applets (present in !Boot), and some other coming from !System.* things. For example the !Fonts applet will simply call Fonts.!Run, and use the Fonts default sprite. Simple and similar to Resources:$.Apps. So an upgrade is just ‘delete !Boot, put the new one’. Or nothing if in ROM. Nota for $.!System things: version should be easy to check. Today, if I choose Help on !Fonts, I have no idea of the version used. !Fonts should be an independent solution, mixing current !Font and !FontSetup in one product. Click on it, and you configure Fonts. Of course, !Boot will register it automatically (as all other $.!System components) in Resources:$.Configure. And then it will replace the minimal $.Fonts applet integrated in !Boot (needed if Fonts is not installed). I’m not sure I’m clear :)
Nice tool. With a better !Configure applet for Lock, we could have Full lock, Boot Lock and FS defined lock options. Would be great. And – at least – useful. Of course, for security reasons, management tool should be in ROM and password stored in CMOS. Full lock / Boot lock / FS lock / Unlock states could be also fixed in CMOS. FS lock would rely on Protected bits applied to files. So you could protect what you want and be sure that no one will Unprotect it. Just my 2 cents. |
Steffen Huber (91) 1953 posts |
The problem with GuardDD and similar ideas as well as Rick’s quick hack is that it does not solve the problem at all. I can still rename !Boot, install a new !Boot and copy Loader to the new !Boot. Which breaks the Loader concept. I don’t think there is a “quick fix solution” to the problem apart from the real solution, which is partitioning support. Which is hopefully just around the corner, judging by CVS activities. |
Steffen Huber (91) 1953 posts |
Maybe a simple !Boot upgrader would be a viable solution (just like SysMerge). It would need some intelligence to identify the !Boot version it upgrades, it needs to know which files needs to be added and removed, and it needs to understand which changes the user made and which are the places that should not be touched (like Choices). OK, not so simple anymore… We need at least a separation of !Boot into the “system part” and the “user-changeable part”. At the moment, !Boot includes too many things of completely different character. |
Colin Ferris (399) 1814 posts |
HD working partitioning was talked about at the 2017 SW show. |
Jeff Doggett (257) 234 posts |
The SD card that I setup for my Pi is partitioned. 1) Use Hform to format the card for Riscos, but reduce the disc size by (say) 64MB This leaves 64MB unused at the end of the card. 2) Make a new partition table in sector 0 of the card. Partion 1 → the 64MB area at the top of the drive – set it for FAT use. 3) Use a FAT formatter to format the FAT partition |
Pages: 1 2