Page 1 of 1

Kernel source directory tree

Posted: Mon Apr 25, 2016 2:24 am
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

Re: Kernel source directory tree

Posted: Mon Apr 25, 2016 4:04 am
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

Re: Kernel source directory tree

Posted: Mon Apr 25, 2016 9:04 am
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).

Re: Kernel source directory tree

Posted: Mon Apr 25, 2016 10:12 am
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

Re: Kernel source directory tree

Posted: Mon Apr 25, 2016 3:11 pm
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

Re: Kernel source directory tree

Posted: Mon Apr 25, 2016 3:20 pm
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

Re: Kernel source directory tree

Posted: Tue Apr 26, 2016 7:32 am
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

Re: Kernel source directory tree

Posted: Sat Apr 30, 2016 2:56 am
by Neroku
Thanks everyone. It seems your source trees are more expressive than, at least, the very first Linux release.

Re: Kernel source directory tree

Posted: Sun May 01, 2016 2:51 am
by ggodw000
early in the project, right now everything in one folder starting to get unwieldy, will start looking to org soon.

Re: Kernel source directory tree

Posted: Sun May 01, 2016 3:47 am
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