diff options
Diffstat (limited to 'kernel/build.sh')
-rwxr-xr-x | kernel/build.sh | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/kernel/build.sh b/kernel/build.sh deleted file mode 100755 index d8086b6..0000000 --- a/kernel/build.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/sh - -ASM_PATH="src/" -TARGET_PATH="target" -TMP_PATH="$TARGET_PATH/temp/" -OBJ_PATH="$TMP_PATH" -LINK_SCRIPT_PATH="src/" -GRUB_CFG_PATH="src/grub.cfg" -ARCH="x86_64" -TARGET="$ARCH-uff" -RUST_BIN="$TARGET_PATH/$TARGET/debug/libkernel.a" - -remove_target() { - rm -rf $TMP_PATH/* &> /dev/null - rm -f $TARGET_PATH/uff.iso &> /dev/null -} - -create_target() { - mkdir $TARGET_PATH &> /dev/null - mkdir $TMP_PATH &> /dev/null -} - -cleanup_temp() { - rm -f $TMP_PATH/* &> /dev/null -} - -# --------------------------------------------------- - -build_kernel_elf() { - create_target - for f in $ASM_PATH/*.asm; do - nasm -felf64 "$f" -o $OBJ_PATH/"$(basename -s .asm $f)".o - done - ld -n -o $TARGET_PATH/kernel.bin -gc-sections -T $LINK_SCRIPT_PATH/linker.ld $OBJ_PATH/*.o $RUST_BIN - cleanup_temp -} - -build_kernel_iso() { - if test ! -e $TARGET_PATH/kernel.bin; then - build_kernel_elf - fi - create_target - mkdir $TMP_PATH/isofiles &> /dev/null - mkdir $TMP_PATH/isofiles/boot &> /dev/null - mkdir $TMP_PATH/isofiles/boot/grub &> /dev/null - cp $TARGET_PATH/kernel.bin $TMP_PATH/isofiles/boot &> /dev/null - cp $GRUB_CFG_PATH $TMP_PATH/isofiles/boot/grub/grub.cfg &> /dev/null - grub-mkrescue -d /usr/lib/grub/i386-pc -o $TARGET_PATH/uff.iso $TMP_PATH/isofiles - cleanup_temp -} - -build_init() { - create_target -} - -build_launch() { - qemu-system-x86_64 -cdrom $TARGET_PATH/uff.iso -} - -build_run() { - if test ! -e $TARGET_PATH/uff.iso; then - build_kernel_iso - fi - build_launch -} - -build_clean() { - remove_target -} - -build_build() { - cargo xbuild - rm -rf $TARGET_PATH/sysroot - rm -rf $TARGET_PATH/kernel.bin - rm -rf $TARGET_PATH/uff.iso - build_run -} - -build_all() { - build_kernel_elf -} - -not_exec=true - -for arg in "$@"; do - case "$arg" in - "kernel-elf") build_kernel_elf;; - "kernel-iso") build_kernel_iso;; - "init") build_init;; - "launch") build_launch;; - "run") build_run;; - "clean") build_clean;; - "build") build_build;; - "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 " init initialise directory" - echo " clean cleanup binaries" - echo " launch launch iso in qemu" - echo " run creates iso if necessary and runs it in qemu" - echo - echo " kernel-elf build the kernel-elf" - echo " kernel-iso build the kernel-elf if necessary and the kernel-iso" - echo " build build the kernel-iso with rust binaries" - echo " all build kernel" -} - -if $not_exec; then - echo "error: please specify an argument" - echo - print_help - exit -1 -fi |