Page 1 of 1
Dividing my kernel
Posted: Fri May 22, 2009 1:25 am
by computafreak
So far, I've got a fairly stable kernel working, with enough for me to implement a simple TUI. But when I compile it, it's compiled as a single file. I don't really like this - I don't want a monolithic kernel. How would I offload my console, keyboard, PC speaker, et al. drivers onto separate files? My first thought would be to make GrUB load the .o files as modules, then dynamically load and link them. Is this the simplest way to do it? If so, how would I alter my makefile to prevent LD linking them in with the main kernel? I've got some other questions, but I want to make certain I'm on the right track before I ask them
Re: Dividing my kernel
Posted: Fri May 22, 2009 1:42 am
by Brendan
Hi,
computafreak wrote:So far, I've got a fairly stable kernel working, with enough for me to implement a simple TUI. But when I compile it, it's compiled as a single file. I don't really like this - I don't want a monolithic kernel. How would I offload my console, keyboard, PC speaker, et al. drivers onto separate files? My first thought would be to make GrUB load the .o files as modules, then dynamically load and link them. Is this the simplest way to do it? If so, how would I alter my makefile to prevent LD linking them in with the main kernel? I've got some other questions, but I want to make certain I'm on the right track before I ask them
It sounds like you're getting things confused... There's monolithic kernels where everything is in one binary, there's monolithic kernel's that support dynamically loaded modules, and there's micro-kernels where things like device drivers are completely separate binaries that are isolated from the kernel itself in some way (for example, they might run in their own address space like a normal process).
If you want a monolithic kernel that supports dynamically loaded modules, then you could ask GRUB to load the object files as modules and then dynamically link them. If you want a micro-kernel, then you'd need to compile them as lots of different binaries and ask GRUB to load these binaries as modules (or collect them into a boot image or ram disk or something and ask GRUB to load the boot image); and provide some way to isolate them from the kernel, and some sort of kernel API that these binaries can use to access public kernel functions.
Cheers,
Brendan
Re: Dividing my kernel
Posted: Fri May 22, 2009 2:04 am
by computafreak
Whoops. At the moment I have a traditional monolithic kernel. This is what I referred to in my original post. What I'm trying to create is a modular monolithic kernel, with dynamically loaded modules. So, would linking them into the kernel's address space be the best way to load them?