documentation/build-instructions.md

64 lines
2.0 KiB
Markdown

# NOXOS Build Instructions
**DISCLAIMER:** To build this project you need a linux system (WSL could work for Windows users, but I haven't tested it).
## Workspace setup
First create a directory and name it something like `noxos`.
Then clone at least the following repositories into that directory:
```bash
git clone https://git.nerdcult.net/noxos/kernel
git clone https://git.nerdcult.net/noxos/libraries
git clone https://git.nerdcult.net/noxos/userspace
git clone https://git.nerdcult.net/noxos/drivers
```
After that `cd` into the `kernel` directory.
There are a few tools required, that need to be installed:
* **gcc** - compiler
* **ld** - linker
* **nasm** - assembler
* **cmake** - build system
* **xorriso** - ISO creation tools
* **qemu** - emulator
* **ovmf** - UEFI firmware
you can check if you have all tools installed, with `./build.sh check`.
# Compiling NOXOS
The build system is based on CMake and uses a bash script to automate the kernel, libraries and drivers compilation and image creation process.
You can run the script with the following command:
```bash
./build.sh
```
All temporary data will be written into a directory called `build`.
If the Bootloader ([limine](https://github.com/limine-bootloader/limine)) isn't downloaded yet, the script will download it.
The final ISO file will be written to the `build` directory.
# Running NOXOS
After compiling, you can run NOXOS using `/run.sh`.
## BIOS Emulation
To emulate a BIOS system, you can run `./run.sh bios`.
# Debugging
## Logs
When running through the script, qemu is configured to write the kernels logs to *STDOUT* and a file called *noxos.log*.
## GDB
You can connect GDB to qemu.
To achieve this, run `./run.sh debug`.
QEMU will wait until you connect GDB to it as a 'remote' target on `localhost:1234`.
```bash
gdb build/cmake/kernel/kernel
target remote localhost:1234
c
```
(note, that the last to commands have to be 'executed' in gdb not in your shell)
**Warning:** QEMU + GDB debugging seems to be kinda broken after an update.