Add D barebones sources and Makefile

This commit is contained in:
josh committed 2022-03-03 11:24:05 -05:00
1 parent 5d7081cf44
commit 9cc2436d33
5 files changed
+96

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
.PHONY: kernel
kernel:
./i686-elf-gcc/bin/i686-elf-gcc -c -o boot.o -ffreestanding boot.S
ldc2 -march=x86 -mcpu=i686 --betterC -c -of=kernel_main.o kernel_main.d
./i686-elf-gcc/bin/i686-elf-gcc -o kernel.elf -ffreestanding -nostdlib -T link.ld boot.o kernel_main.o
.PHONY: image
image: kernel
rm -rf image
mkdir -p image/iso/boot/grub
echo 'set default="0"' >image/iso/boot/grub/grub.cfg
echo 'set timeout=1' >>image/iso/boot/grub/grub.cfg
echo 'menuentry "MyKernel" {' >>image/iso/boot/grub/grub.cfg
echo ' insmod multiboot' >>image/iso/boot/grub/grub.cfg
echo ' multiboot /kernel.elf' >>image/iso/boot/grub/grub.cfg
echo '}' >>image/iso/boot/grub/grub.cfg
cp kernel.elf image/iso
grub-mkrescue -o image.img image/iso
run: image
qemu-system-x86_64 -hda image.img