diff --git a/build.sh b/build.sh index 1c7fc7c..091f84d 100755 --- a/build.sh +++ b/build.sh @@ -30,6 +30,27 @@ workspace_setup() { echo "" } +check_toolchain() { + echo " --> Checking Toolchain" + hash gcc + echo " |--> found gcc" + hash ld + echo " |--> found ld" + hash nasm + echo " |--> found nasm" + hash cmake + echo " |--> found cmake" + hash xorriso + echo " |--> found xorriso" + hash qemu-system-x86_64 + echo " |--> found qemu" + + [ ! -d "/usr/share/ovmf/x64/" ] && echo "OVMF binaries not found!" && exit 255 + echo " |--> found ovmf" + + echo " --> All checks passed" +} + kernel_build() { echo " --> Building kernel" @@ -88,11 +109,18 @@ generate_image() { echo "!=====[ NoxOS build script ]=====!" -workspace_setup -kernel_build -[ ! -d "build/limine" ] && limine_install -generate_initial_ramdisk -generate_image +case $1 in + "check") + check_toolchain + ;; + *) + workspace_setup + kernel_build + [ ! -d "build/limine" ] && limine_install + generate_initial_ramdisk + generate_image + ;; +esac echo "!=====[ Finished ]=====!"