fix build scripts and add additional pre-requesites to readme

This commit is contained in:
Steve Biedermann
2025-11-21 14:51:06 +01:00
committed by Bjorn Beishline
parent 71475803e3
commit e98c6668ef
3 changed files with 14 additions and 10 deletions

View File

@@ -66,11 +66,12 @@ x86) before running on bare metal.
## Building and Running
### Prerequisites
You will need QEMU for aarch64 emulation.
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.
```bash
# Install QEMU (Ubuntu/Debian)
sudo apt install qemu-system-aarch64
# Install QEMU (Ubuntu/Debian), dosfstools and gcc-aarch64-linux-gnu
sudo apt install qemu-system-aarch64 dosfstools gcc-aarch64-linux-gnu
```
Additionally you will need a version of the [aarch64-none-elf](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) toolchain installed.

View File

@@ -21,24 +21,27 @@ fi
pushd /tmp/bash
if [ ! -f "$MOUNT/bin/bash" ]; then
if [ ! -f "/tmp/bash/bash" ]; then
./configure --without-bash-malloc --enable-static-link --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc
make
fi
mkdir -p "$MOUNT/bin"
cp bash "$MOUNT/bin"
if [ ! -f "$MOUNT/bin/bash" ]; then
sudo mkdir -p "$MOUNT/bin"
sudo cp bash "$MOUNT/bin"
fi
popd
# busybox -- I couldn't get this to build. I ended up restoring to a third-party static binary which isn't ideal but it get's things running.
pushd "$MOUNT/bin"
if [ ! -f busybox-aarch64-linux-gnu ]; then
pushd "/tmp"
if [ ! -f "$MOUNT/bin/busybox-aarch64-linux-gnu" ]; then
wget https://github.com/shutingrz/busybox-static-binaries-fat/raw/refs/heads/main/busybox-aarch64-linux-gnu
chmod +x busybox-aarch64-linux-gnu
sudo cp busybox-aarch64-linux-gnu "$MOUNT/bin"
fi
popd
mkdir -p "$MOUNT/dev"
sudo mkdir -p "$MOUNT/dev"
if mountpoint -q "$MOUNT"; then
sudo umount "$MOUNT"

View File

@@ -4,7 +4,7 @@ set -e
ELF="$1"
BIN="${ELF%.elf}.bin"
sudo bash -c "./mkrootfs-aarch64.sh"
./mkrootfs-aarch64.sh
# Convert to binary format
aarch64-none-elf-objcopy -O binary "$ELF" "$BIN"