restructure build scripts

This commit is contained in:
Steve Biedermann
2025-11-23 10:24:48 +01:00
parent b1ebd61763
commit e5c4ef7e74
13 changed files with 156 additions and 67 deletions

View File

@@ -66,12 +66,10 @@ x86) before running on bare metal.
## Building and Running
### Prerequisites
You will need QEMU for aarch64 emulation, dosfstools to create the virtual file system
and gcc-aarch64-linux-gnu to compile bash for the image.
You will need QEMU for aarch64 emulation and dosfstools to create the virtual file system.
```bash
# Install QEMU (Ubuntu/Debian), dosfstools and gcc-aarch64-linux-gnu
sudo apt install qemu-system-aarch64 dosfstools gcc-aarch64-linux-gnu
sudo apt install qemu-system-aarch64 dosfstools
```
Additionally you will need a version of the [aarch64-none-elf](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) toolchain installed.
@@ -87,6 +85,27 @@ Run the following command
nix shell nixpkgs#pkgsCross.aarch64-embedded.stdenv.cc nixpkgs#pkgsCross.aarch64-embedded.stdenv.cc.bintools
```
### Preparing the image
First, run the following script to prepare the binaries for the image:
```bash
./scripts/build-deps.sh
```
This will download and build the necessary dependencies for the kernel and put them
into the `build` directory.
Once that is done, you can create the image using the following command:
```bash
sudo ./scripts/create-image.sh
```
This will create an image file named `moss.img` in the root directory of the project,
format it as VFAT 32 and create the necessary files and directories for the kernel.
This script needs to run with sudo to mount the image through a loop device,
which is required to properly create the image for the kernel to work.
### Running via QEMU
To build the kernel and launch it in QEMU: