From b11a2a876e7bd14078d26e12eab62db997a4dc76 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 14 Apr 2020 23:42:03 +0200 Subject: Switched to grub This really isn't what I wanted because grub is very big and bloaty but my own bootloader was very poorly written and I really want to implement a filesystem like ext2 which wouldn't work with my own bootloader. Furthermore this commit fixes many small issues including the one occurring due to the statically linked user binary (I just removed the linking for now). --- run | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'run') diff --git a/run b/run index 8c2a8c9..91f1f73 100755 --- a/run +++ b/run @@ -111,43 +111,42 @@ make_build() { compile_with_flags -O2 -c ./"${line}" -I ./src/userspace -o ./build/userspace/"${stripped}" done <./build/tmp rm ./build/tmp - compile_with_flags -emain -O2 ./build/userspace/*.o -T ./src/userspace/linker.ld -I ./src/userspace -o ./build/user.bin + compile_with_flags -emain -O2 ./build/userspace/*.o -I ./src/userspace -o ./build/user.bin # Create ISO - mkdir -p ./iso/boot/ - mv ./build/melvix.bin ./iso/boot/kernel.bin - nasm ./src/bootloader/cd.asm -f bin -o ./iso/boot/cd.bin || exit 1 - nasm ./src/bootloader/hdd1.asm -f bin -o ./iso/boot/hdd1.bin || exit 1 - nasm ./src/bootloader/hdd2.asm -f bin -o ./iso/boot/hdd2.bin || exit 1 - cp ./build/user.bin ./iso/user.bin || exit 1 - cp ./build/font.bin ./iso/font.bin || exit 1 - genisoimage -quiet -input-charset utf-8 -no-emul-boot -b boot/cd.bin -o ./build/melvix.iso ./iso + mkdir -p ./iso/boot/grub/ + cp ./build/melvix.bin ./iso/boot/kernel.bin + cp ./src/bootloader/grub.cfg ./iso/boot/grub/ + cp ./build/user.bin ./iso/user.bin + cp ./build/font.bin ./iso/font.bin + grub-mkrescue -o ./build/melvix.iso ./iso/ head -c 10485760 /dev/zero >./build/hdd10M.img printf "Build finshed successfully!\n\n" } make_test() { - qemu_with_flags -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw + qemu_with_flags -cdrom ./build/melvix.iso #-drive file=./build/hdd10M.img,format=raw } make_debug() { - qemu_with_flags -s -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw + qemu_with_flags -s -cdrom ./build/melvix.iso #-drive file=./build/hdd10M.img,format=raw } make_image_debug() { - qemu_with_flags -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw - qemu_with_flags -drive file=./build/hdd10M.img,format=raw + qemu_with_flags -cdrom ./build/melvix.iso #-drive file=./build/hdd10M.img,format=raw + #qemu_with_flags -drive file=./build/hdd10M.img,format=raw } make_image() { - start=$(date +%s.%N) - qemu_with_flags -nographic -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw >install.log - end=$(date +%s.%N) - cat install.log - printf "[LOG END]\n\n" - tail install.log | grep -q "Installation successful!" && echo Booted and installed within "$(echo "$end - $start" | bc -l)" seconds || echo Installation failed! && exit 1 - rm install.log + #start=$(date +%s.%N) + #qemu_with_flags -nographic -cdrom ./build/melvix.iso -drive file=./build/hdd10M.img,format=raw >install.log + #end=$(date +%s.%N) + #cat install.log + #printf "[LOG END]\n\n" + #tail install.log | grep -q "Installation successful!" && echo Booted and installed within "$(echo "$end - $start" | bc -l)" seconds || echo Installation failed! && exit 1 + #rm install.log + echo "This test is currently disabled" } make_sync() { -- cgit v1.2.3