Kernel source directory tree

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
Neroku
Posts: 24
Joined: Tue Dec 01, 2015 4:53 am

Kernel source directory tree

Post by Neroku »

Hello,

how does the directory tree of your kernel look like?

By having a look at the Linux-0.01 source directory tree we found the following:
  • boot
    fs
    include
    • asm
      Linux
      sys
    init
    kernel
    lib
    mm
    tools
Do you have any kind of useful guidelines?


Thanks in advance
currently working on kboot86, the Genesis of my kernel
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Kernel source directory tree

Post by BrightLight »

TBH, mine is disorganized, because each directory contains no subdirectories. It looks like this:

Code: Select all

    boot/                    Bootloader files
    drivers/                 Userspace drivers
    ex86/                    x86 emulator in development
    os/                      OS kernel and core code
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

Re: Kernel source directory tree

Post by Octocontrabass »

This is the source tree for my current kernel project.

Code: Select all

kernel/
  arch/
    i386/
    m68k/
    powerpc/
It doesn't do much of anything yet because I'm still working on the build system (and the bootloaders, which are separate projects).
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Kernel source directory tree

Post by Techel »

Code: Select all

os3.0
  sysinit
    makefile
    x86
      makefile
  modules
    makefile
    x86
      makefile
      some kernel modules
    universal
      makefile
      more kernel modules
  services
    makefile
    some services
  user
    makefile
    some user programs
  visual studio project files, makefile, bochs config file
User avatar
LiamT
Posts: 9
Joined: Sun Jul 12, 2015 2:21 am
Contact:

Re: Kernel source directory tree

Post by LiamT »

I try to keep my code organized by major concerns, but often i find that this splits up other systems. UserSpace is an example here, wherein there are significant multitasking namespace portions of the kernel dedicated to UserSpace, but there is also some code under the system namespace for system calls.

Code: Select all

src
├── boot
│   └── multiboot
├── cpputil
├── fs
│   ├── initrd
│   ├── mountfs
│   ├── qmfs
│   └── vfs
├── hw
│   ├── acpi
│   │   └── aml
│   ├── cpu
│   ├── pc
│   ├── pci
│   ├── storage
│   │   └── ahci
│   └── video
├── init
│   └── kinit
├── interrupt
├── mm
│   ├── paging
│   └── segmentation
├── mt
│   ├── apinit
│   ├── exception
│   ├── process
│   ├── synchronization
│   ├── tasking
│   ├── timing
│   └── userspace
├── system
│   ├── func
│   ├── permissions
│   └── userspace
└── util
    └── string
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Kernel source directory tree

Post by Kazinsal »

Roughly:

Code: Select all

boot
kernel
    arch
        arm
        i686
    fs
    hardware
    include
        arch
            arm
            i686
        fs
        hardware
        include
        net
    net
libraries
    c
    evo
    hash
tools
user
    config
    lua
        libraries
        lua-5.3
            doc
            src
    shell
    utilities
User avatar
deleted
Member
Member
Posts: 82
Joined: Mon Jul 21, 2014 7:23 pm

Re: Kernel source directory tree

Post by deleted »

Mine is pretty simple. I use capital letters on directory names, and its organized so the build-system makes sense to code. But roughly:

Code: Select all

TrailOS
  - Builds
      - kernel.elf
  - Source
      - Kernel
          - Arch
              - x86
                    - (source code)
                    - config.make
                    - Makefile
          - (source code for kernel)
          - Makefile
      - Userspace
          - Program1
          - Program2
          ...
      - Include
          - (headers)
      - Makefile
User avatar
Neroku
Posts: 24
Joined: Tue Dec 01, 2015 4:53 am

Re: Kernel source directory tree

Post by Neroku »

Thanks everyone. It seems your source trees are more expressive than, at least, the very first Linux release.
currently working on kboot86, the Genesis of my kernel
ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: Kernel source directory tree

Post by ggodw000 »

early in the project, right now everything in one folder starting to get unwieldy, will start looking to org soon.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
dseller
Member
Member
Posts: 84
Joined: Thu Jul 03, 2014 5:18 am
Location: The Netherlands
Contact:

Re: Kernel source directory tree

Post by dseller »

Currently, my directory tree is as follows:

Code: Select all

src
  cpu
  device
  drivers
  services
    acpi
    fs
    loader
    memory
    pci
    terminal
include
  cpu
  device
  drivers
  services
    acpi
    fs
    loader
    memory
    pci
    terminal
ttlib
  src
  include
Post Reply