86 lines
2.4 KiB
Markdown
86 lines
2.4 KiB
Markdown
# Building MontaukOS
|
|
|
|
## Build Dependencies
|
|
|
|
### Toolchain
|
|
|
|
| Dependency | Purpose |
|
|
|---|---|
|
|
| `gcc` / `g++` | C/C++ compiler (C++20, GNU11) |
|
|
| `nasm` | x86_64 assembly |
|
|
| `make` | Build system |
|
|
| `git` | Fetching dependencies (Limine, freestanding headers, cc-runtime) |
|
|
| `curl` or `wget` | Downloading `limine.h` header |
|
|
|
|
### ISO/Disk Image Creation
|
|
|
|
| Dependency | Purpose |
|
|
|---|---|
|
|
| `xorriso` | Creating bootable ISO images |
|
|
| `mtools` | Creating FAT-formatted HDD images (`mformat`, `mcopy`, `mmd`) |
|
|
| `gdisk` | GPT partitioning for HDD images (`sgdisk`) |
|
|
|
|
### Running in QEMU
|
|
|
|
| Dependency | Purpose |
|
|
|---|---|
|
|
| `qemu-system-x86-64` | x86_64 emulation |
|
|
| `ovmf` | UEFI firmware for QEMU |
|
|
|
|
For other architectures, install the corresponding QEMU system emulator (`qemu-system-aarch64`, `qemu-system-riscv64`, etc.).
|
|
|
|
## Ubuntu / Debian
|
|
|
|
Install all build dependencies with:
|
|
|
|
```bash
|
|
sudo apt install build-essential nasm git curl xorriso mtools gdisk qemu-system-x86 ovmf
|
|
```
|
|
|
|
`build-essential` provides `gcc`, `g++`, and `make`.
|
|
|
|
## Building
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone https://github.com/danihamm/MontaukOS.git
|
|
cd MontaukOS
|
|
```
|
|
|
|
2. Build the ISO:
|
|
```bash
|
|
make
|
|
```
|
|
This will automatically fetch dependencies (Limine bootloader, freestanding headers, cc-runtime) and produce an ISO image.
|
|
|
|
3. Run in QEMU:
|
|
```bash
|
|
make run
|
|
```
|
|
|
|
### Other Targets
|
|
|
|
| Target | Description |
|
|
|---|---|
|
|
| `make all-hdd` | Build a raw HDD image instead of ISO |
|
|
| `make run-hdd` | Run the HDD image in QEMU |
|
|
| `make run-bios` | Run in QEMU with legacy BIOS (x86_64 only) |
|
|
| `make clean` | Remove build artifacts |
|
|
| `make distclean` | Remove everything including downloaded dependencies |
|
|
|
|
### Cross-Architecture Builds
|
|
|
|
The kernel is split into architecture-neutral code and per-architecture
|
|
ports under `kernel/src/Arch/` (see [porting.md](porting.md)). x86_64 is the
|
|
only complete port. `aarch64` is a skeleton: the whole kernel compiles and
|
|
links for it, but paging, exception vectors, the GIC and the timer are not
|
|
written yet, so it does not boot. Userspace is x86_64-only.
|
|
|
|
Non-x86 kernels are built with LLVM (`clang`, plus `ld.lld` for the link):
|
|
|
|
```bash
|
|
make kernel ARCH=aarch64 # kernel/bin-aarch64/kernel
|
|
make kernel ARCH=aarch64 KERNEL_LD=/path/to/ld.lld
|
|
./scripts/check-arch-neutral.sh # boundary check + aarch64 compile
|
|
```
|