How ddn44/monix works
Main Components
• Bootloader: The “boot” directory contains assembly files (boot.asm, bootloader.asm, multiboot.asm) that are responsible for early boot processes and complying with the multiboot spec.
• Kernel: The “kernel” directory is central and includes C and assembly files. There are subdirectories and files for interrupt handling (kernel/asm/idt.asm, kernel/irq.c), memory management (kernel/mem/mem.c), process management (kernel/procman.c) and terminal output (kernel/term/term.c). The linker script (kernel/kernel.ld) also hints at how the kernel binary is linked.
• Drivers: The “drivers” directory (with files like ata.c, keyboard.c, serial.c) implements hardware device interactions.
• Filesystem: The “fs” directory contains code for handling disks and FAT file systems (files like disk.c, fat.c, file.c), supported also by include files in the “Include” directory (fs.h, fat.h).
• /Headers: The “Include” directory aggregates header files for various subsystems (e.g., ata.h, irq.h, mem.h, syscalls.h) shared across boot, kernel, and drivers.
• Build and Deployment: Files such as CMakeLists.txt, build scripts (buildboot.sh, buildkernel.sh, makedisk.sh, makeiso.sh, etc.) and configuration files (like bx_enh_dbg.ini and bochsrc.txt) illustrate how the project is built and tested/emulated (via qemu scripts).
• ISO/Boot Image: The “iso” directory with grub configuration and kernel image (kernel.elf) indicates the final packaged output, likely for deployment via bootloaders like GRUB.
Relationships and Interactions
• Boot Process: Start with the Bootloader component that initializes hardware and loads the kernel into memory.
• Kernel Core: The kernel then takes over, setting up low-level functions such as global descriptor table (kernel/gdt.c), interrupt service routines (kernel/irq.c), memory management, and process management.
• Device Drivers: Within the kernel, device drivers (from the “drivers” directory) handle interactions with hardware (ATA interfaces, keyboard, and serial ports). These modules are likely invoked by interrupt routines.
• Filesystem Operations: The filesystem code (in both “fs” directory and corresponding header files) provides access to disk storage, working closely with drivers and kernel space to read/write data.
• Build Process: The build scripts, linker files and configuration (CMakeLists.txt, linker scripts, .bat/.sh files) tie together the compilation and linking phases necessary to generate the operating system image (os.img, kernel.elf).
Architectural Patterns and Design Principles
• Modularity: The project is broken into clear modules (bootloader, kernel, drivers, filesystem) to isolate concerns.
• Layered Architecture: There’s a natural layering from hardware initialization (bootloader) up to the high-level kernel operations and drivers.
• Interaction through Defined Interfaces: The inclusion of header files (“Include”) for each subsystem suggests that explicit interfaces are used for communication across different layers.
Relevant Technologies and Frameworks
• Assembly and C Integration: Use of assembly (boot and some kernel parts) alongside C for kernel logic.
• Multiboot Standard: The bootloader components hint at compliance with the multiboot specification.
• Emulation Tools: Configuration and scripts for QEMU indicate testing under emulation.