How do you organize your kernel's code?

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
User avatar
riparoony
Posts: 15
Joined: Wed Jul 04, 2012 9:50 pm
Location: Salt Lake City
Contact:

How do you organize your kernel's code?

Post by riparoony »

I'm talking structurally here - how does everybody structure their code? This could mean directory structures, namespacing, etc. I'm curious as to what seems to be the most common ways used here.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: How do you organize your kernel's code?

Post by BrightLight »

My kernel is in assembly. The source code is structured like this:

Code: Select all

boot/
os/
drivers/
ex86/
You know your OS is advanced when you stop using the Intel programming guide as a reference.
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: How do you organize your kernel's code?

Post by moondeck »

I have my kernel written in C, and i only have a /kernelio directory and a /power directory. Will make some subdirectories in /kernelio thou.
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: How do you organize your kernel's code?

Post by Techel »

My operating system is composed of multiple modules, which may interact with eachother. It's implemented in C++.
User avatar
CorruptedByCPU
Member
Member
Posts: 79
Joined: Tue Feb 11, 2014 4:59 pm

Re: How do you organize your kernel's code?

Post by CorruptedByCPU »

assembly:

Code: Select all

/bootloader
/build
   /disk with omega.raw
   /kernel.bin
/engine
   /drivers
      /network
   /daemons
/library
/locale
/software

config.asm
kernel.asm
https://github.com/akasei/Cyjon
simply for me
https://blackdev.org/ - system programming, my own 64 bit kernel and software.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How do you organize your kernel's code?

Post by Combuster »

Unless you want to rewrite an existing OS for the sake of it, there's always something specific to your OS that will be reflected in your folder structure. Most important thing here is not to be afraid to refactor your structure when you notice something doesn't quite work anymore.

I notice the above folder listings are for relatively smaller projects. Here's a larger example, but I don't expect you to make yours like that straight away.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply