Rick's b.log - 2013/11/05 |
|
It is the 23rd of November 2024 You are 3.14.250.187, pleased to meet you! |
|
mailto:
blog -at- heyrick -dot- eu
Get ready for a geekfest!
We're going to elevate it to the next step - we're going to roll our own RISC OS. Yup, we're going to build this baby from source, install it, and run it.
This guide will assume that you will be placing RISC OS at $.Coding.RISCOS. If this is not correct for your setup, kindly ask your eyeballs to do a search-and-replace all occurances of that with the correct path that you are using.
Using !SparkFS (either the full one or the read-only one), unpack the archive UnTarBz2_106a2.zip into the RISCOS directory. Also place the source archive(s) in there.
Run the !UnTarBZ2 program and drag the BCM2835Dev archive on to the UnTarBZ2 iconbar icon.
A window will appear, that looks like this:
In the second, blank, writable icon, enter the full path to the RISCOS directory, like this:
Don't touch any of the other options (which ought to be as shown above). Just click on "RUN".
If you have a fondleslab or other sort of tablet, fire it up, watch animé or catch up on those episodes of Naniwa Shōnen Tanteidan that you never got around to watching...or is that just me? (^_^)
Why have I suddenly started talking rubbish? Well, the conversion of the bz2 archive to a tar file will take about 28 minutes on a standard Pi with a Class 4 SD card. A better speed SD card would be preferred, but it seems that Class 10 (the wing-zing type) can suffer...shall we say "compatibility issues"? Annoyingly 7-zip did it on a 1.6GHz Atom in 67 seconds... go figure...
Following this is the unpacking proper. There are 8,369 files to be unpacked and moved and attributes/filetypes fiddled to make it all work correctly under RISC OS. Seriously, we're looking at a couple of hours, so while your lowly PC might be able to extract in a handful of minutes, the result will be pure gibberish to RISC OS. Just... set it going and then go watch a movie. A really long movie, like Space Battleship Yamato (live action) or Suzumiya Haruhi no shōshitsu (my review) or The Man From Nowhere (recommended!).
It this point the process will probably bomb out with the error "File 'SDFS::RISCOS.$.Coding.RISCOS.*.Prepare.!run' not found". Don't worry about this. You can close the UnTarBZ2 window.
There is a directory within RISCOS called BCM2835Dev. Open it. Now open the directory Prepare that you now see. Then double-click on the !Run file.
What is happening now is that pieces of your DDE and libraries are being copied into the sources so the build process can find them. Answer Y to set up the build process.
You want to run Builder, so press Y one last time. That done, you can close the TaskWindow.
Click Menu on the Builder icon bar icon (looks like an old-fashioned EPROM with a trowel over it) and select the "Register build tree..." menu option.
NOW SHUT DOWN AND REBOOT. [because if the DDE has been seen, it risks clashing with the builder]
Click on the Builder icon bar icon. A window will appear. For the Environment, click on the menu pop-up icon and choose ROOL.BCM2835:
Now tick the following boxes (unsure the others are not ticked):
Then click on Build.
Just so you know, the string "
If the build fails, it is imperative to correctly resolve the problem and redo the necessary steps. If in doubt, start the build process again from the beginning. It is better to be sure.
Oh, and if the build speed bothers you - try to imagine how it must have been to build RISC OS 3 on a 25MHz machine. Or RISC OS 2 on a 8MHz machine.
In the $.Coding.RISCOS.BCM2835Dev directory is a directory called "Images". Open it, and you ought to see a file with a name like dURZ00-00. The letter at the start increments with each build (aURZ00-00, bURZ00-00, cURZ00-00, etc).
There can be problems with long file names and DOS partitions (would it be "DURZ00-00" or "DURZ00~1"?), so to keep things simple, just rename that to
Open the directory $.!Boot.Loader, and create a folder called "OLDER". Move the existing RISC OS ROM image (probably called "RISCOS/IMG") into the OLDER folder (do not delete it, you'll need it in case something went wrong).
Now copy the new RISCOS/IMG file from the "Images" directory into the "Loader" directory.
Now open the file CONFIG/TXT in a text editor, and ensure that the line that points to the kernel (probably the last line) correctly refers to the file RISCOS.IMG - note that the file must be given in DOS form, so it's a dot not a slash!
Don't worry if your CONFIG/TXT file looks different to mine. I started using composite video, and then moved to an HDMI to VGA adaptor, so there's stuff in there to set all this up correctly.
Don't breathe!
...
If everything goes according to plan, you will see a lot of "
Normally I use 1280×1024 (as that is the native resolution of my monitor). Here is RISC OS running in a 640×512 mode, so that it will fit into this b.log article without scaling.
The simplest recovery method is to remove the SD card from the Pi, place it into a different machine's SD card reader (such as a PC), and then:
If you want to have a crack at doing this again, go back to the "Starting the first build" step, and if there is an error in the build, be sure that you have dealt with it fully.
Building RISC OS on the Pi
A little treat for you, in the run-up to Christmas (yeah... I know it is Christmas because there are more toys than normal in the supermarket, and it is themed into boy/girl, easily determined by virtue of the girl's aisle being pink - anything and everything is bright pink).
You've used RISC OS, right? On a Beagle? On a Pi? Or maybe just on an emulator?
What you will need
Here is what you will need:
So, let's recap:
The Pi is easy enough to get sorted if you are of geeky inclination and don't mind bare boards with wires hanging out - you can get them from all sorts of places, such as CJE Micro's.
If you like RISC OS and prefer a computer that looks like a computer, then CJE Micro's has you covered. I would certainly recommend having an RTC module because the build process uses timestamps to know the 'age' of things, so it is rather important that the date and time are correct. If you buy a bare Pi (from CJE or elsewhere) then look at the first CJE link above, you will find some suitable RTC modules.
[note - I thought I'd better point out that I do not receive a commission from CJE, they have been an Acorn-friendly dealer since forever so it seems only right to recommend them]
If you get a CJE package, you'll be sorted. Otherwise, you have three choices:
Note that the RaspberryPi.org supplied images are old, so old there are cobwebs all over the place.
I made a video to guide you through the process of creating the SD image - watch it here.
This is the point, I suspect, when many will stop reading. You'll need to buy the RISC OS development suite. Sorry, but Acorn wrote their OS to run on their processor and build using their tools, and while there have been attempts to go the gcc route, the macro assembler facilities are used extensively and gcc's assembler just isn't up to something like this.
You have two options. If you plan to write/test code for other RISC OS platforms, you will need the full DDE (C compiler, assembler, debugger, disassembler, and lots of other things). It costs £40+VAT+P&P, details here.
If you only plan to work with a Pi, you can get a better deal with the NutPi package - for only £35+VAT+P&P you can get an incredible selection of RISC OS software including the DDE. The only restriction is that some (don't know how much) of it has been nobbled so that it will only run on a Pi. But this is reasonable enough given the retail price of the packages alone add up to around £600! Details here.
If forty quid seems a lot of outlay for a development package, it is when you compare it with the likes of gcc. I now invite you to compare it with other commercial development packages. You might be in for a shock...
Obviously! We can't do anything without code. Show me the code! Show me the code! Wait...hang on...wrong film. Damn.
Anyway, the source code for all of RISC OS - grab yours here. The one you want is under "Source code archives" and it is called BCM2835Dev.
You can, optionally, download DiscDev for the files that comprise the applications supplied on disc (!Printers, !Maestro, etc). Installing/building this is not covered in this guide; but it is there if you want it.
[if you are following this guide with a view to building RISC OS for a different platform - briefly: IOMDHALDev is for anything based upon the RiscPC architecture, including the emulators; OMAP3Dev is for the Beagle boards (plain and xM; ARMini); OMAP4Dev is for the Pandaboard (ARMiniX); and TungstenDev is for the Iyonix. Do not download the incorrect archive - each board has a variety of system-specific parts within, and as such you will need to have the right archive for what you want to build.]
Ignore the tool that is recommended for unpacking the archives. This one is much better, download it.
I'm not going to tell you what the Menu button is, or how RISC OS paths work. I am assuming that if you plumped for the DDE then you will at least have some degree of familiarity with RISC OS... this know-how may be necessary.
I'm sorry - there is a lot said in this article, but there is equally a lot left unsaid. You are building an operating system! If you don't know what a TaskWindow is, or how to get one, then I suggest you politely back away and go play a nice game (of Chess?) instead...
A brief word about the licence
Just a small point that might be necessary to some - the RISC OS sources are not GPL. They are supplied according to a Castle licence, which you can read here. Basically, it is free for personal private use and hacking is encouraged so long as you grant Castle (and thus ROOL) the ability to merge your modifications into RISC OS to improve the system for everybody. The licence is specifically not an OEM licence, so you cannot distribute RISC OS within embedded products. If this is your wish, you will need the OEM licence (here) plus a licence for the number of copies of RISC OS you will be supplying. Interestingly, the price depends upon how soon you intend to feed your code back into RISC OS, so you can licence "everything" from as little as £3 per copy. Or £2.10 if you only want the kernel (ROM image) stuff. There are further reductions if you intend on supplying devices numbering in the hundreds...
Unpacking the sources
I have all of my DDE and source codes within a directory called "Coding", full path "$.Coding". I recommend that you have something similar to keep your directories tidy.
Within this tidy location, create a directory called "RISCOS".
;-)
If you're stuck for ideas, Avril Lavigne's "Here's To Never Growing Up" is on YouTube (HD too). Watch it, and tell me it isn't a darker remake of "Complicated". Then look for a cat called Maru. Or attempt the Gangnam Style dance. Extra points if you can remember any of the words other than "yoe-ja".
Alternatively... fire up your PC and write a blog post and whinge about how damn long this takes. ;-)
If the filer has not 'seen' the DDE tools, run !SetPaths in the AcornC/C++ directory, then answer Y.
Drag the BCM2835Dev directory to the window that appears, then click Save.
Starting the first build
Open the RISCOS directory, then BCM2835Dev, then Apps (or in other words, SDFS::RISCOS.$.Coding.RISCOS.BCM2835Dev.Apps) and double-click !Builder.
Do not touch the version numbering, leave it set as "ImageName" and "Don't".
A few brief comments on build failures
The build process should not fail - after all, RISC OS is built every night from this source code. The sources that you downloaded to build this version of RISC OS is current as of yesterday, and the same will be true for you, whenever you download the source archive. However, there is always the possibility that something may be checked into the repository by error, so it might fail, once in a blue moon when Saiph is just about to rise... (^_^)
AMU: ***
" (or just "***
") is your pointer to build errors. Some can be ignored, like "Nothing to delete
", but "Not found
" and "exit (1)
" indicate serious problems.
The conclusion of the build
After what seems like an eternity (about 50 minutes), you will see that a lot of modules (135 in this build) were created, pasted together, and prodded into the form of a RISC OS ROM image.
[...pages and pages of stuff above...]
CDFSSoftSCSI FC44E6FC 00002514
CDFS FC450C14 00004268
CDFSFiler FC454E80 00002C60
UnSqzAIF FC457AE4 00000318
BlendTable FC457E00 000006F4
HeroNames FC4584F8 000002B9
Total of 135 modules.
==============================================================================
Starting phase join ...
romlinker: version 0.04 (31 Jul 2011)
romlinker: Standard ROM image construction
romlinker: Image has 686128 bytes spare (670.05K)
romlinker: crc16=8c61
==============================================================================
Finished ROOL.BCM2835 build : Tue Nov 5 18:48:50 2013
------------------------------------------------------------------------------
Closing log file 'SDFS::RISCOS.$.Coding.RISCOS.BCM2835Dev.BuildSys.Logs.dURZ00-00'.
That bit, in bold, is what you want to see.
Installing the new ROM image
Now comes the fun.
RISCOS/IMG
(all upper case).
Here's how:
Now go and download the latest versions of those three files from https://github.com/raspberrypi/firmware/tree/master/boot (click to view 'raw', a download will be offered). Place these in the same directory alongside MYROM/IMG and CONFIG/TXT. If there are other files (512START/ELF and LOADER/BIN, for instance), you can move these files into the backup subdirectory. They don't appear to be required any more (a brief look suggests that LOADER/BIN is now part of START/ELF).
Save the modified configuration file.
Note - you MUST rename the ROM image "RISCOS/IMG"
The reason for this is the SDCMOS file saves configuration information to the end of the ROM image (!) and it only looks for the image "SDFS::0.$.!Boot.Loader.riscos/img".
If you call your ROM something else, it will work but configuration will not persist between sessions.
Going for broke!
Shutdown RISC OS, then click the big inviting Restart button.
init mod:
" messages scroll up the screen, followed by something about callbacks, and then the familiar RISC OS start-up will appear.
Check the date in the Task Manager.
Go on... You know you want to!
Recovery - if nothing happens
If you have not updated your firmware, check it now. Details are above.
At time of writing, the correct firmware is:
If yours differ, or if you have other files (LOADER/BIN, etc) then you may need to update your firmware. Try this first, and if RISC OS still fails to boot.....
Then put the SD card back into your Pi and boot it up.
Rick, 31st December 2013, 21:09 This article (on building RISC OS from scratch) has been revised and updated to correct a few issues and provide additional information, and also to provide screenshots without the watermarks (as it makes things easier to read).Rick, 18th March 2016, 23:59 You should now get your RISC OS ROM images from ROOL directly...
© 2013 Rick Murray |
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted. RIPA notice: No consent is given for interception of page transmission. |