This repository has been archived on 2025-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
portland-os/makefile

40 lines
1.5 KiB
Makefile

disk: kernel boot fs-
mkdir -p obj out
/sbin/mkfs.fat -C -f 1 -F 16 -n "PORTLAND OS" -R 17 -s 1 -S 512 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/disk.img
mcopy -i out/disk.img -s out/fs/bleh.txt ::/
vdi-file: disk
VBoxManage convertfromraw out/disk.img out/disk.vdi --uuid a61929ed-3bf2-45ff-b98a-44f87c616dba
debug: disk
gdb -x qemu-debug.gdb
fs-:
cp -r fs out/fs
kgccargs = -m32 -ffreestanding -fno-asynchronous-unwind-tables
kernel:
mkdir -p obj/kernel out
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
nasm src/boot.asm -o out/boot.bin
clean:
rm -r obj out