Long time no news! I'm not dead though, just had a surgery on my knee and now I'm tied to bed for a while. Since I cannot access my desktop yet and work form laptop only, I've decided to spend this week on ARIX hacking.
First of all I wanted to know whether the files I have so far are enough to be started by linux kernel. In order to test that I have picked a linux kernel from linux distro I'm using (OpenSuse Leap 15) as well as few libraries including linux dynamic linker. I have put the libs into a "template" initrd with a /init file being a symbolic link pointing to nowhere. Well, actually it points to /ARIX/System/init, but this one is not existing on the initrd template.
During my ARIX build process a second initrd file is generated, where this one contains whole /ARIX tree built from sources. Both images are subsequently concatenated into one final initrd file. This and the vmlinuz are booted for test purposes directly from qemu, like this:
qemu-system-x86_64 -kernel ../Build/vmlinuz -initrd ../Build/initrd -m 512 -nographic -append "console=ttyS0 loglevel=7"
This gives me a nice boot of linux kernel without graphics and with console written to my terminal. What do I see there? Well, on my notebook 2.2 seconds after the kernel has started ARIX takes over. It doesn't do much yet, but more is to come.
What does the /ARIX/System/init do? Not much yet. It just mounts some filesystems (such as /sys, /dev, /proc etc.) and then it executes the /ARIX/System/ARIX. In order to satisfy the dynamic linker it also exposes one environment variable, the LD_LIBRARY_PATH which now points to the ARIX Libs. It does also one more thing for test purposes. It creates a memfd file descriptor, writes a hello message to it and subsequently seals the descriptor so that any further changes to it are not allowed. This descriptor remains open during execution of ARIX executable so that an initial message can be passed. As I told you, this is just a test for now but may be used in the future when ARIX executables are started within ARIX environment.
What else? I have also added complete set of TagList functions to utility.library, these are just imported from AROS and compiled 1:1, with only slight change of function header (ARIX does not use AROS_L* macros).
The message ports created by exec.library are now remembered. This is for two reasons. One of them is, they will be automatically deleted when application is closed, provided the app code has not done it yet. Second, much more important reason is, the message ports are preserved across the exec.library/Spawn call. But there, in order to stay unique, they need to become new UUIDs. And this is what the Spawn call does. It goes through all ports created and assign new UUIDs for them.
The last thing worth mentioning are threads. They can be created using exec.library/CreateThread call and can receive up to 8 startup parameters, with more features to come. They share all the same address space as well as message ports, files and so on. They use the clone system call of linux kernel. They also mean I have to add proper locking mechanisms now. Until now they were not necessary since every executable was running alone, as a single thread within its own address space. It has changed now :)
Next steps? Proper locking mechanisms implemented and used in the libs where necessary. Further development of dos.library including starting new processes (running executables within ARIX). Ah, and such details as initialisation of the random number generator, otherwise I get some funny warnings from linux kernel :-). Once ready I can start thinking about mounting filesystems and selecting proper boot device.