im bored so lets learn comp arch and make an OS
The Makefile contains the bulk of the logic for automated builds and
runs. The scripts within it can be used to compile the kernel and create
a bootable ISO.
Each GitHub actions workflow run also generates an artifact of the ISO image that can be downloaded.
Important
I'm on macOS where the toolchain is missing the ELF binaries for Limine, so I set the Makefile
to use the TOOLCHAIN_PREFIX := x86_64-elf- by default (you can install the GCC cross-compiler
with brew install x86_64-elf-gcc).
If you are not using macOS you can change this variable or specify the empty prefix in your make commands
(e.g. make TOOLCHAIN_PREFIX="" iso).
To create the bootable ISO image:
- Run
make -C limineif you haven't before to build the limine utility. - Run
make isowhich will handle the rest and generate the file inout/thonkOS.iso.
To run the OS using QEMU you can use the make run script (automatically rebuilds ISO when necessary).
Tip
I created a really useful run config for CLion that combines gdb and QEMU's built in gdb server with CLion for native debugging in the IDE.
The run configuration is located at .run/GDB.run.xml, so take advantage of the goated CLion debugger UI.
Using bear you can generate a compile_commands.json file for the clangd language server to use.
make clean; bear -- make