Adjust build script slightly

This commit is contained in:
Aaron Bies
2025-10-05 01:16:31 +02:00
parent 4e4acd3624
commit c9e4c1ca4f
Executable → Regular
+8 -7
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env just --justfile
IMG_FILE := 'small.img'
IMG_SIZE := '36'
EFI_NAME := 'bootx64'
EFI_FILE := 'bootx64.efi'
MNT_DIR := 'esp_mnt'
set quiet
default: image
build:
@echo ">>> Building UEFI executable ({{EFI_FILE}})..."
echo ">>> Building UEFI executable ({{EFI_FILE}})..."
zig build-exe -OReleaseFast -target x86_64-uefi-msvc --name {{EFI_NAME}} main.zig
_image-init:
_init:
echo ">>> Creating blank disk image: {{IMG_FILE}} ({{IMG_SIZE}}MB)..."
dd if=/dev/zero of={{IMG_FILE}} bs=1M count={{IMG_SIZE}}
@@ -21,7 +21,7 @@ _image-init:
echo ">>> Creating GPT and EFI System Partition..."
sudo sgdisk --new=1:0:0 --typecode=1:ef00 {{IMG_FILE}}
image: build _image-init
image: build _init
#!/usr/bin/env bash
set -euo pipefail
@@ -36,15 +36,16 @@ image: build _image-init
mkdir -p {{MNT_DIR}}
sudo mount "${LOOP_DEV}p1" {{MNT_DIR}}
echo ">>> Install EFI executable..."
echo ">>> Installing EFI executable..."
sudo mkdir -p {{MNT_DIR}}/EFI/BOOT
sudo cp {{EFI_FILE}} {{MNT_DIR}}/EFI/BOOT/BOOTX64.EFI
sync
run: image
echo ">>> Booting image in qemu..."
qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -drive format=raw,file={{IMG_FILE}}
clean:
@echo ">>> Cleaning up..."
echo ">>> Cleaning up..."
rm -vrf .zig-cache zig-cache zig-out
rm -vf *.efi *.pdb *.img