Loading the HAL as a module?
Posted: Tue Apr 11, 2017 12:31 pm
So I am writing a kernel (trying to follow an Hybrid Kernel design) and I am trying to place all the code that is architecture dependent on a HAL so porting the kernel will be easier down the road. I want to compile the HAL as a module and then load it when the kernel is booted, so I realized I could do the following:
1) Write an ELF module loader.
2) Write the HAL.
3) Compile the HAL as an ELF module and save it to an initrd.
4) At boot time load the initrd, and from there load the HAL (depending on which architecture is being used).
But the way I thought I would implement the initrd requires loading all the files of the ramdisk into memory, but this is not possible since my memory manager resides in the HAL (and also in order to load ELF modules, you need to load them into memory). So how can I implement this idea or is it impossible to do?
And by the way, is it better to include all HAL related functions (ex. paging functions) in a single header file (hal.h) or to place them in different header files?
I am using GRUB as my bootloader.
Thanks
1) Write an ELF module loader.
2) Write the HAL.
3) Compile the HAL as an ELF module and save it to an initrd.
4) At boot time load the initrd, and from there load the HAL (depending on which architecture is being used).
But the way I thought I would implement the initrd requires loading all the files of the ramdisk into memory, but this is not possible since my memory manager resides in the HAL (and also in order to load ELF modules, you need to load them into memory). So how can I implement this idea or is it impossible to do?
And by the way, is it better to include all HAL related functions (ex. paging functions) in a single header file (hal.h) or to place them in different header files?
I am using GRUB as my bootloader.
Thanks