@balaton
Wow this topic has taken off.
Quote:
Yes I think I meant ub2lb/parthenope when I said AROS bootloader. But doesn't that just load amigaboot file and launches it? Does it replicate what amigaboot does and loads the kernel modules itself? I've looked at the source but it's not very clear.
No, it can do what amigaboot does, all self contained. So yes it can replicate amigaboot but it did lack FFS2 support. It can do the job of what SLB can do, which would predate amigaboot, on the A1 and Sams. And yes, the parthenope one, as it's also called. I looked at the code years ago. It does load in the kernel modules then launch it. By jumping to the loader code module somehow.
Apart from making AROS bootable it has better support for booting Linux. SLB can boot Linux from simple one liner kernel and options, but ub2lb is slightly more complex like GRUB and has more options. I modified it for use when building a Linux installer on the XE so it would auto boot into menu.
Now, I see you are familiar with the source since you discovered it crashes in the start_unit_scan() debacle from a NULL pointer, after Googling that function. I knew about this. I'm sure I posted about this years ago on AmigaWorld.
Okay just checked and I did in 2017. Found a thread. Sorry link bombing here:
https://amigaworld.net/modules/newbb/v ... wmode=flat&order=0#801942https://amigaworld.net/modules/newbb/v ... wmode=flat&order=0#801965https://amigaworld.net/modules/newbb/v ... wmode=flat&order=0#801974https://amigaworld.net/modules/newbb/v ... wmode=flat&order=0#801993Quote:
The Open Firmware part is clear to me. I tested amigaboot.of with the minimal open firmware in QEMU and know what it misses to run and what OF client interface functions it uses but I don't know what it does with the data it retrieves from OF. That is what kind of structure should it build from the OF device tree and how should it pass to the kernel. So I'd need more info on that part, all the others I don't care about.
I'm not certain if it builds anything from the device tree. The loader at the end can look up the tree itself if it needs too. But the Kick modules are all self contained in that the core ones are compiled for the machine they run on. I don't see a way to pass dynamic strings or objects. Extra options are in nvram variables or embedded in a module as text. I don't even think modules can be passed arguments like a normal command. Fairly rigid design.
But yes what's needed is the data that's passed down the line.
The Kicklayout can be slightly misleading as the comments mention EXEC being the name of the main kernel to use that contains exec.library. This not quite correct. EXEC points to a loader that launches the kernel. The kernel module contains exec.library. The EXEC file doesn't contain the kernel at all in the common configuration.
Quote:
The different versions are probably just to talk to the different firmwares in these machines. There are at least 3 kinds of firmware interfaces so there are that many boot loader versions but these likely only differ in the firmware side which I know for OF, I only need info on the kernel facing side that makes the module list in memory and prepares the info about the machine and starts the kernel. I'd look for info, docs or hints on that, the rest I can handle.
Yes that is the core info you need. And refreshing myself with the ub2lb code it looks like it has almost everything you need. I didn't see it before. It's just slightly complicated looking as it supports 4 things for booting; generic, OS4, AROS and Linux. So it reads in the Kicklayout from menu_load() and then in testboot_aos() it builds the module list. But, this is where I was lost, it loads in the EXEC loader separately and stores it as kernel. Usually this would be first module and also stored in the module list. I'm unsure about the module ID and flags but what is referred to as ID could be file type. So ID could be for binary or data. The struct module you need is in here.
https://github.com/cjg/ub2lb/blob/master/src/parthenope.cWhat needs to be checked is register parameters which would differ in OF ABI. IIRC it's something like; R3* OS string, R4* module list, R5* OF hook.
Quote:
OK then maybe there are only two versions, one for OF and one for U-Boot wuth the U-Boot part already open source but that's not too interesting.
Likely the CFE/X1000 amigaboot is based directly off the Pegasos one. Don't know who made the firmware that way apart from Varisys but OF was hacked into CFE and they kept it that way. This would have made it easier to port and existing amigaboot over and at least two code bases could be merged. On the X5000, the modern UBoot supports OF basics like trees, since OF is so entrenched in PPC and being UBoot is made for Linux, it made sense. This would make it easier to port it as an amigaboot.ub since they can share the same code base. Right now Trevor owns ExecSG and amigaboot with it.
Quote:
I'd need the interface between amigaboot.of and loader.of and to know what structures in memory loader.of needs and where to pass them. The rest is just firmware dependent or trivial.
The list structure (which is an AmigaOS list) will be above with the module structure as nodes. Where they are passed as parameters needs to be checked.
I actually wrote my own CFE emulator when testing a few years back that emulated OF hooks. It could run amigaboot up to a point. Enough to see what it was doing. It was a bit of a hack as it intercepted DSI crashes since the memory mapped differs. But the range was known. Be more cleaner if it used MMU but it did the job. Should clean up source and release it as experimental emulator.
Quote:
Yes this is the part that would be interesting if it was documented in a bit more detail.
Against all odds it turns out parthenope is your friend.
Quote:
quiesce is the OF client interface word for closing down and stop using firmware services after boot so it's not just how Linux calls it. The OF client interface is well documented in its standard.
I see. I wonder if OS4 kernel uses it as well? It could be hidden.
I struggled to find basic technical info years ago about the ABI. Such as the OF hook being in R5. For some reason I just couldn't find the ABI layout. I suppose if you have something like "void *, void *, (*)()" R5 will be hidden. Don't recall exactly. But I do recall I could never figure the memory allocator out. It seemed to be too technical and needed hand holding with memory ranges or something. I expected something like a malloc() that was self managed. I wanted to program OF to allocate some memory. In the end I gave up and just wrote my own allocator using a preset range.
Quote:
I'm not sure about that part, I think I'm still missing the structs and calling convention of loader.of to be able to reimplement amigaboot.of.
Here's an amigaboot.of chain loader.
https://forum.hyperion-entertainment.com/viewtopic.php?t=4672Quote:
Since yaboot probably can't load AmigaOS I don't think it would help much.
No but it does reveal one clue about the Pegasos. The Pegasos is the only platform here with CHRP support that was officially supported by Linux PPC install CDs. They contained extra scripts in FORTH that loaded in a CHRP kernel and booted it. It also needed the extra kernel but it had support. Unlike other platforms like the A1/XE which had no support on official releases. Likely because UBoot was totally different and had no OF emulation. Having built an installer CD for the XE it would be way over the scope of a simple configuration since it needed a fully custom kernel and modules. Though the PegXMac Mac emulator CD did manage to support both Pegasos and XE with one boot CD.