So I spent a lot of time designing my OS and thinking about how I could implement various things.
I've came up with a modular design as described in the wiki. Some important and necessary modules for the boot process are going to be loaded by an initrd.
So my requirements are:
- Kernel procedures should be accessible by the module. It should also be compatible if the symbols inside the kernel change locations so the module doesn't crash(happens when recompiling the kernel but not the modules?). I thought about dynamic linking at runtime?(then I need to somehow export symbol information into my kernel executable so I can use these when loading modules). Also I want to avoid passing a crazy "kernel procedures" structure table to the module(I think it's hacky and "unclean")
- Modules should be relocatable so I can load them wherever I want to. After reading about ELF and ELF relocation I'm a bit confused because I only want to change the program's base address and not the offsets between sections. So why are there so many relocation types and do I need to implement all?
- Also modules should be libraries which you can access by another module. So in addition to the above relocation I need a "shared relocatable library".
I'm asking for some opinions if this is a feasible way and how to create the executable the way I've described(compiler flags etc.?). Is there even something like a "shared relocatable library" and if it exist how do I instruct my compiler to create such. How can I relocate ELF executables to a specific address at runtime(address is also determined at runtime). Point me into the right direction(links, wiki pages etc.)
I hope I've described my problems in a way you'll be able to understand cause English is not my native language.
Greetings,
ostylk.