From f339c707b7fec2600bdf6bdf7087c2a758f2e444 Mon Sep 17 00:00:00 2001 From: shibedrill Date: Tue, 11 Feb 2025 23:31:16 -0500 Subject: [PATCH] Replace shell script with makefile --- .gitignore | 3 +-- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ build_iso.sh | 31 ------------------------------- src/display.rs | 1 + 4 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 Makefile delete mode 100755 build_iso.sh diff --git a/.gitignore b/.gitignore index 608f24a..abba15c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /target -/iso -/gila.iso \ No newline at end of file +/build \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a446a16 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ + +TARGET ?= "x86_64-unknown-none" + +all: clean prepare gila iso run + +# Prepare toolchain +prepare: + rustup install nightly + rustup target add $(TARGET) + +# Run the ISO in an emulator. +run: build/gila.iso + qemu-system-x86_64 -drive file=build/gila.iso,format=raw,index=0,media=disk + +# Build the bootable kernel image. +.PHONY: build/iso/gila +gila: prepare $(wildcard src/*.rs) + mkdir -p build/iso/ + cargo build --release -Z unstable-options --target=$(TARGET) --artifact-dir build/iso/ + +# Build a bootable ISO and install Limine. +.PHONY: build/gila.iso +iso: build/iso/gila gila limine.conf + mkdir -p build/iso/limine + mkdir -p build/iso/EFI/BOOT + cp ./limine.conf build/iso/ + cp /usr/share/limine/limine-bios.sys build/iso/limine/ + cp /usr/share/limine/limine-bios-cd.bin build/iso/limine/ + cp /usr/share/limine/limine-uefi-cd.bin build/iso/limine/ + xorriso -as mkisofs -b limine/limine-bios-cd.bin -no-emul-boot \ + -boot-load-size 4 -boot-info-table --efi-boot \ + limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image \ + --protective-msdos-label build/iso -o build/gila.iso + limine bios-install build/gila.iso + +clean: + rm -rf build + cargo clean \ No newline at end of file diff --git a/build_iso.sh b/build_iso.sh deleted file mode 100755 index ff26208..0000000 --- a/build_iso.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ]; then - echo "Argument 1 must be the Rust target triple." - exit 1 -fi - -SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1 ; pwd -P )" -cd "$SCRIPTPATH" || exit 1 - -rm -rf ./iso/ -rm ./gila.iso -#cargo clean - -set -euxo pipefail - -mkdir -p ./iso/limine/ -cp ./limine.conf ./iso/ -cp /usr/share/limine/limine-bios.sys ./iso/limine/ -cp /usr/share/limine/limine-bios-cd.bin ./iso/limine/ -cp /usr/share/limine/limine-uefi-cd.bin ./iso/limine/ - -cargo build --target="$1" --release -cp target/"$1"/release/gila ./iso/ - -xorriso -as mkisofs -b limine/limine-bios-cd.bin -no-emul-boot \ - -boot-load-size 4 -boot-info-table --efi-boot \ - limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image \ - --protective-msdos-label iso -o gila.iso - -limine bios-install gila.iso \ No newline at end of file diff --git a/src/display.rs b/src/display.rs index 1603c11..02162e7 100644 --- a/src/display.rs +++ b/src/display.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] +#![allow(unused_variables)] use vga; pub use vga::writers::TextWriter;