Files
2025-02-25 01:14:52 +00:00

23 lines
536 B
Bash
Executable File

#!/bin/bash
set -e
# Set root directory
cd "$(dirname "$0")/.."
# Create build directory if it doesn't exist
mkdir -p build/bios
# Assemble stage1
nasm -f elf32 boot/bios/stage1/stage1.s -o build/bios/stage1.o
# Link to binary
ld -m elf_i386 -T boot/bios/stage1/stage1.ld build/bios/stage1.o -o build/bios/stage1.bin
# Verify size
size=$(wc -c < build/bios/stage1.bin)
if [ "$size" -gt 446 ]; then
echo "Error: stage1.bin is larger than 446 bytes ($size bytes)"
exit 1
fi
echo "Successfully built stage1.bin ($size bytes)"