summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile30
1 files changed, 21 insertions, 9 deletions
diff --git a/makefile b/makefile
index 0de951a..503fcca 100644
--- a/makefile
+++ b/makefile
@@ -1,20 +1,32 @@
-qemu: floppy
- qemu-system-i386 out/floppy.img
-
-floppy: kernel boot
+disk: kernel boot
mkdir -p obj out
- /sbin/mkfs.fat -C -R 17 -n "PORTLAND OS" obj/shadow.img 1440
+ /sbin/mkfs.fat -C -f 1 -F 12 -n "PORTLAND OS" -R 17 obj/shadow.img 8192
echo -n -e '\xeb\x3c' > obj/jmp.bin
dd if=obj/jmp.bin of=obj/shadow.img obs=2 conv=notrunc
dd if=out/boot.bin of=obj/shadow.img obs=1 seek=62 conv=notrunc
dd if=out/kernel.bin of=obj/shadow.img seek=1 conv=notrunc
- mv obj/shadow.img out/floppy.img
+ mv obj/shadow.img out/disk.img
+
+vbox-image: disk
+ VBoxManage convertfromraw out/disk.img out/disk.vdi --uuid a61929ed-3bf2-45ff-b98a-44f87c616dba
+
+kdump: kernel
+ objdump -M intel -d obj/kernel.elf > out/kernel.dasm
+kgccargs = -m32 -ffreestanding -fno-asynchronous-unwind-tables
kernel:
mkdir -p obj/kernel out
- gcc -m32 -ffreestanding -c src/kernel/main.c -o obj/kernel/main.o
- gcc -m32 -ffreestanding -c src/kernel/vga.c -o obj/kernel/vga.o
- ld -T src/kernel/link.ld obj/kernel/main.o obj/kernel/vga.o -o out/kernel.bin
+ gcc ${kgccargs} -c src/kernel/main.c -o obj/kernel/main.o
+ gcc ${kgccargs} -c src/kernel/vga.c -o obj/kernel/vga.o
+ gcc ${kgccargs} -c src/kernel/fat.c -o obj/kernel/fat.o
+ gcc ${kgccargs} -c src/kernel/fs.c -o obj/kernel/fs.o
+ gcc ${kgccargs} -c src/kernel/ata.c -o obj/kernel/ata.o
+ gcc ${kgccargs} -c src/kernel/util.c -o obj/kernel/utilc.o
+ gcc ${kgccargs} -c src/kernel/panic.c -o obj/kernel/panic.o
+ gcc ${kgccargs} -c src/kernel/serial.c -o obj/kernel/serial.o
+ nasm -f elf32 src/kernel/util.asm -o obj/kernel/utila.o
+ ld -T src/kernel/link.ld obj/kernel/main.o obj/kernel/vga.o obj/kernel/fat.o obj/kernel/fs.o obj/kernel/ata.o obj/kernel/utilc.o obj/kernel/panic.o obj/kernel/utila.o obj/kernel/serial.o -o obj/kernel.elf
+ objcopy -O binary -j .entry -j .bin obj/kernel.elf out/kernel.bin
boot:
mkdir -p out