From 29e28bc9c67378d0d9a7174dec6a0b541fb7f4d5 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Fri, 10 Mar 2023 19:26:31 +0100 Subject: a minimal working demo on bare metal --- Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7a10efb --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +# this is an prototype makefile with hardcodings.. +# TODO reorganize... +# + +all: bootdisk.iso + + +bootdisk.iso : kernel + cp kernel isofiles/boot/ + grub-mkrescue /usr/lib/grub/i386-pc -o bootdisk.iso isofiles + +kernel : rust_kernel startup.o + ld -static -e startup -T sections -o ./kernel startup.o target/x86_64_rustubs/debug/librustubs.rlib + +rust_kernel: + cargo rustc --target=x86_64_rustubs.json -- -C link-arg=-nostartfiles --emit=obj + +startup.o: + nasm -f elf64 -o startup.o src/arch/x86_64/asm/startup.s + +clean: + cargo clean + rm bootdisk.iso + rm startup.o + rm system + rm isofiles/boot/system + +qemu: bootdisk.iso + qemu-system-x86_64 -drive file=./bootdisk.iso,format=raw -k en-us -- cgit v1.2.3-70-g09d2