My pet project in bootstrapping a bare-bones OS. The goal is for this to eventually become a POSIX compliant OS
[ ] Use APIC instead of PIC
[ ] Improve malloc to use slab allocation
[ ] Use buddy allocator for PMM (use stack instead of Bitmap)
[ ] Basic Windowing Graphics
[ ] File-system support (FAT/ext2/ntfs?)
[ ] TCP/IP networking stack
Development takes place on a *nix environment, preferably linux. WSL works too.
In order to develop asOS you will need a cross-compiler. You can find detailed instructions on how to build your cross-compiler (preferably GCC) from wiki.osdev.org. Alternatively I have pre-compiled and packaged the necessary binary tools on the releases page.
Once you have the cross-compiler successfully built and installed, you will need to modify the project makefile to point to the appropriate directory.
The $(CROSS_CC_DIR)
var should point to the bin directory of the cross-compiler.
You will need the following programs as well
The best way for you to run the asOS is to run the generated ISO in your VM of choice. I have currently tested this on both QEMU and Bochs. Once the build system is in place the make
commands can both build and run the OS.
Set the path of the qemu/bochs executable in the makefile. If you are using WSL you can use the windows .exe and Windows will figure out how to call it. Then you can run with make bochs-run
or make qemu-run
.
Both Bochs and QEMU can be used to debug. Assuming either tool is installed and configured in the makefile, all you have to do is call either of
make qemu-dbg
make bochs-dbg
. When using qemu-dbg, the os will be paused waiting for GDB or another interface to continue execution. You can connect to qemu through GDB on port 1234
, then execute as normal. QEMU debugging is useful for stepping through the code to check your application logic while Bochs is useful.
Because I develop on VSCode (inside WSL2), while QEMU is running on Windows (to make use of the graphical environment) we are subject to this bug where we cannot access localhost on the Windows side of things through WSL. To fix this you can do any of the below steps
wsl --shutdown
in powershellipconfig
in powershell (search for Ethernet adapter vEthernet (WSL)
) and use that instead of localhost/etc/hosts
in WSL2 by removing the IPv4 entry for localhost
and add localhost
to the IPv6 entry.make qemu-termdbg
. This limits you to the console thoughBochs debugging is useful when debugging hardware i.e making sure your CPU is in the correct state, exceptions are being handled, investigate triple-faults etc... It has it's own built in debugger which is similar to GDB, but not 100% compatible.