Kernel from scratch written in rust
git clone https://github.com/alisterd51/gratOS.git
cd gratOS
make runwget https://github.com/alisterd51/gratOS/releases/download/nightly/gratos.x86.grub.iso
qemu-system-i386 -cdrom gratos.x86.grub.iso- KFS-1 (gratOS:0.1.0):
- Mandatory:
- Install GRUB on an virtual image
- Write an ASM boot code that handles multiboot header, and use GRUB to init and call main function of the kernel itself
- Write basic kernel code of the choosen language.
- Compile it with correct flags, and link it to make it bootable.
- Once all of those steps above are done, you can write some helpers like kernel types or basic functions (strlen, strcmp, ...)
- string.h
- memcpy
- memmove
- memset
- memcmp
- string.h
- Your work must not exceed 10 MB.
- Code the interface between your kernel and the screen.
- vga text_mode driver
- Display "42" on the screen.
- clean screen
- print "42"
- Makefile: Your makefile must compile all your source files with the right flags and the right compiler. Keep in mind that your kernel will use at least two different languages (ASM and whatever-you-choose), so make (<- joke) your Makefile’s rules correctly
- Bonus:
- Add scroll and cursor support to your I/O interface.
- scroll
- cursor
- history
- interprete escape sequences such as
CSI n A - add consts such as:
CURSOR_UP = "\x1B[A"
- Add colors support to your I/O interface.
- interpret color escape sequences such as
CSI n m - add consts such as:
FG_RED = "\x1b[31m" - add default color
- add tests in debug mode
- interpret color escape sequences such as
- Add helpers like printf / printk in order to print information / debug easily
- print!
- println!
- Handle keyboard entries and print them.
- Handle different screens, and keyboard shortcuts to switch easily between then.
- Add scroll and cursor support to your I/O interface.
- Mandatory:
- KFS-2 (gratOS:0.2.0):
- Mandatory:
- create a Global Descriptor Table
- Your GDT must contain:
- Kernel Code
- Kernel Data
- Kernel stack
- User code
- User data
- User stack
- Your work must not exceed 10 MB.
- You must declare your GDT to the BIOS.
- The GDT must be set at address 0x00000800.
- When this is done, you have to code a tool to print the kernel stack, in a human-friendly way. (Tip: If you haven’t made a printk yet, now is a good time !)
- Bonus:
- Assuming your keyboard work correctly in your Kernel, and you able to catch an entry, let’s code a Shell ! Not a POSIX Shell, just a minimalistic shell with a few commands, for debugging purposes.
- For example, you could implement the print-kernel-stack-thing in this shell, and some other things like reboot, halt and such.
- hello
- print-kernel-stack-thing
- reboot
- halt
- Mandatory:
- KFS-3 (gratOS:0.3.0):
- Mandatory:
- You must enable memory paging in your Kernel
- You must code a memory structure that handle paging and memory rights (Careful, you don’t have the tools yet to know who’s accessing the memory, so all of this is theoric at the moment)
- You must define Kernel and User space
- You must implement a function to create / get memory pages
- You must implement functions to
allocate,freeandgetsize of a variable - You must implement those functions for
virtualandphysicalmemory - You must handle "kernel panics" (Print, stop the kernel)
- A complete memory code structure, with pagination handling
- Read and Write rights on memory
- User space memory and Kernel space memory
- Physical and Virtual memory
- Code helpers for physical memory:
- kmalloc
- kfree
- ksize
- kbrk
- Code helpers for virtual memory:
- vmalloc
- vfree
- vsize
- vbrk
- Kernel Panic handling
- Your work should not exceed 10 MB
- Bonus:
- try to implement
memorydumpinganddebugin the last "mini-shell" subject
- try to implement
- Mandatory:
- Other:
- add CI to build and serve an iso of gratOS