Dividing my kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
computafreak
Member
Member
Posts: 76
Joined: Sun Dec 14, 2008 1:53 pm

Dividing my kernel

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Dividing my kernel

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
computafreak
Member
Member
Posts: 76
Joined: Sun Dec 14, 2008 1:53 pm

Re: Dividing my kernel

Post 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?
Post Reply