os/build.sh

37 lines
829 B
Bash
Raw Normal View History

2024-09-13 22:18:26 +02:00
#!/bin/bash
set -euo pipefail
2024-12-13 13:00:55 +01:00
target=${OS_TARGET:-release}
2024-06-29 20:50:08 +02:00
rm -rf img
mkdir -p img/boot/efi/boot
2024-10-31 17:13:16 +01:00
cd lib/acpica-build
2024-10-31 17:48:22 +01:00
make -j4
2024-12-20 22:50:51 +01:00
cd ../../init
if [ "$target" = "release" ]; then
cargo build --release
else
cargo build
fi
cd ../kernel
2024-12-13 13:00:55 +01:00
if [ "$target" = "release" ]; then
cargo build --release
else
cargo build
fi
2024-10-31 17:13:16 +01:00
cd ../loader
2024-12-13 13:00:55 +01:00
if [ "$target" = "release" ]; then
cargo build --release
else
cargo build
fi
2024-10-31 17:13:16 +01:00
cd ..
2024-12-13 13:00:55 +01:00
cp target/x86_64-unknown-uefi/$target/loader.efi img/boot/efi/boot/bootx64.efi
2024-06-29 20:50:08 +02:00
cd img
dd if=/dev/zero of=boot.img bs=1M count=16 status=none
mformat -i boot.img
mcopy -si boot.img boot/* ::
dd if=/dev/zero of=os.img bs=1M count=32 status=none
parted -s os.img mklabel gpt
parted -s os.img mkpart primary fat32 2048s 100%
parted -s os.img set 1 esp on
dd if=boot.img of=os.img bs=1M seek=1 conv=notrunc status=none