rustboot/Makefile
mtgmonkey 2190a5c04d init
2025-05-12 23:05:08 -04:00

24 lines
794 B
Makefile

all:
mkdir temp
nasm -f elf64 src/multiboot_header.asm -o temp/multiboot_header.asm.o
nasm -f elf64 src/long_mode_init.asm -o temp/long_mode_init.asm.o
nasm -f elf64 src/boot.asm -o temp/boot.asm.o
echo "Run 'RUST_TARGET_PATH=<dollar>(pwd)"
cargo update --verbose
cargo build --target x86_64-rustboot
ld -n -o temp/kernel.bin --gc-sections -T linker.ld temp/multiboot_header.asm.o temp/long_mode_init.asm.o temp/boot.asm.o target/x86_64-rustboot/debug/librustboot.a
mkdir isofiles
mkdir isofiles/boot
mkdir isofiles/boot/grub
cp temp/kernel.bin isofiles/boot/kernel.bin
cp src/grub.cfg isofiles/boot/grub/grub.cfg
rm -rf temp
grub-mkrescue -o build/os.iso isofiles 2> /dev/null
rm -rf isofiles
clean:
rm -rf temp
rm -rf isofiles
run:
qemu-system-x86_64 -cdrom build/os.iso