This project is a custom kernel implementation developed as a learning exercise. It includes basic functionalities such as memory management, a simple file system, task scheduling, and a command-line interface.
ml-kernel/
├── bootloader/
│ ├── Makefile
│ ├── boot.asm
│ ├── linker.ld
│ └── loaderer.c
├── build/
│ └── kernel.bin
├── include/
│ ├── filesystem.h
│ ├── gpu.h
│ ├── interrupt.h
│ ├── io.h
│ ├── kernel.h
│ ├── keyboard.h
│ ├── memory.h
│ ├── process.h
│ ├── serial.h
│ ├── string.h
│ ├── syscall.h
│ ├── task.h
│ ├── timer.h
│ └── vga.h
├── iso/
│ ├── boot/
│ │ ├── grub/
│ │ └── kernel.bin
│ └── grub/
│ └── grub.cfg
├── kernel/
│ ├── Makefile
│ ├── drivers/
│ │ ├── gpu.c
│ │ ├── keyboard.c
│ │ ├── serial.c
│ │ ├── timer.c
│ │ └── vga.c
│ ├── filesystem.c
│ ├── interrupt.c
│ ├── kernel.c
│ ├── kernel_helpers.c
│ ├── linker.ld
│ ├── memory.c
│ ├── process.c
│ ├── string.c
│ ├── syscall.c
│ └── task.c
├── tools/
│ ├── create-iso.sh
│ └── qemu-run.sh
└── README.md
- Basic memory management (physical and virtual memory allocation)
- Simple in-memory file system
- Task scheduling
- VGA text mode output
- Keyboard input
- Serial port logging
- Command-line interface with basic commands
To build the kernel, follow these steps:
-
Navigate to the kernel directory:
cd ml-kernel/kernel
-
Run the make command:
make clean make
-
If successful, this will create a
kernel.bin
file in thebuild
directory.
To create a bootable ISO:
-
Copy the kernel binary to the ISO directory:
cp build/kernel.bin iso/boot/
-
Use GRUB to create the ISO:
grub-mkrescue -o mykernel.iso iso
To run the kernel in QEMU:
qemu-system-x86_64 -cdrom mykernel.iso
Once the kernel is running, you can use the following commands:
help
: Display a list of available commandsclear
: Clear the screencreate <filename>
: Create a new filewrite <filename> <content>
: Write content to a fileread <filename>
: Read content from a filedelete <filename>
: Delete a filelist
: List all filesmeminfo
: Display memory informationtest
: Run a series of tests (if implemented)
The kernel includes various debug statements throughout the code. These can be enabled or modified to help diagnose issues during development.
- Implement a more sophisticated file system
- Add support for running user-space programs
- Improve memory management with paging and virtual memory
- Implement more system calls
- Add networking capabilities
This is a personal learning project, but suggestions and improvements are welcome. Please open an issue or submit a pull request if you have any contributions.