diff options
author | natrixaeria <upezu@student.kit.edu> | 2019-10-24 17:32:11 +0200 |
---|---|---|
committer | natrixaeria <upezu@student.kit.edu> | 2019-10-24 17:32:11 +0200 |
commit | 756408c5a9d5fad16a26caaaad791f53833a46d9 (patch) | |
tree | 501f5db18e51d7af17b444b11971489b85ce3707 | |
parent | 865280798e136eede0897b23e9957b7d9ff8c890 (diff) |
Create a build sh script
-rwxr-xr-x | kernel/build.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kernel/build.sh b/kernel/build.sh new file mode 100755 index 0000000..069180b --- /dev/null +++ b/kernel/build.sh @@ -0,0 +1,44 @@ +#!/usr/bin/sh + +cleanup_temp() { + rm -f target/temp/* 2>&1 > /dev/null +} + +build_kernel() { + nasm -felf64 multiboot_header.asm -o target/temp/multiboot_header.o + nasm -felf64 boot.asm -o target/temp/boot.o + ld -n -o target/kernel.bin -T linker.ld target/temp/*.o + cleanup_temp +} + +build_all() { + build_kernel +} + +not_exec=true + +for arg in "$@"; do + case "$arg" in + "kernel") build_kernel;; + "all") build_all;; + *) + echo "warn: ignoring unknown option '$arg'" + continue;; + esac + not_exec=false + break +done + +print_help() { + echo "usage: $0 option" + echo "options: " + echo " kernel build the kernel" + echo " all build kernel" +} + +if $not_exec; then + echo "error: please specify an argument" + echo + print_help + exit -1 +fi |