My OS development
The following dependencies need to be installed for building and development:
- x86 Assembler: NASM
- Disk writer:
dd
- C cross-compiler: i386-elf-binutils, i386-elf-gcc, i386-elf-gdb
- x86 PC enumerator: QEMU, bochs
The directory newlib
contains the Newlib source code which
is used to port a standard C lib for building OS applications. It is also used to generate
no-host version of the lib which is used by the kernel for some OS independent standard string
and memory manipulation functions.
Once all prerequisites have been installed, the make
utility can be used to build and run project.
- To run OS on Emulator. This will auto-builds the kernel image and load it on Emulator:
$ make run
- To build kernel image only:
$ make build
- To cleanup project builds:
$ make clean
The build process creates a build\<target>
directory where all header files, libraries and kernel image are placed appropriately. Thus this directory acts as our OS root using which an OS image is created. The <target>
here refers to the CPU arch for which the kernel is being built.
There are couple of ways to debug the kernel. One is using the cross-compiled gdb
utility (e.g. i386-elf-gdb), the other is using the internal debugger of Bochs emulator.
-
Phase I - Basics
- Setting up a Cross-Toolchain
- Creating a Hello World kernel
- Setting up a Project
- i386
- x86_64 - Long Mode
- Calling Global Constructors
- Terminal Support
- Stack Smash Protector
- Multiboot
- Global Descriptor Table
- Interrupts
- Memory Management
- Multithreaded Kernel
- Keyboard
- Internal Kernel Debugger
- Filesystem Support
-
Phase II - User-Space
-
Phase III - Extending your Operating System
-
Phase IV - Bootstrapping
- Porting Software
- Porting GCC
- Compiling your OS under your OS
- Fully Self-hosting