58 lines
2.1 KiB
Makefile
58 lines
2.1 KiB
Makefile
disk: kernel boot skel hello
|
|
mkdir -p obj out
|
|
/sbin/mkfs.fat -C -f 1 -F 16 -n "PORTLAND OS" -R 65 -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/* ::/
|
|
|
|
vdi-file: disk
|
|
VBoxManage convertfromraw out/disk.img out/disk.vdi --uuid a61929ed-3bf2-45ff-b98a-44f87c616dba
|
|
|
|
debug: disk
|
|
gdb -x qemu-debug.gdb
|
|
|
|
clean:
|
|
rm -r obj out
|
|
|
|
skel:
|
|
mkdir -p out/fs
|
|
cp -r fs-skel/* out/fs/
|
|
|
|
kgccargs = -Wall -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -m32 -Og -ffreestanding -fno-asynchronous-unwind-tables
|
|
ugccargs = ${kgccargs} -Isrc/libc/inc
|
|
nasmargs = -f elf32
|
|
|
|
hello:
|
|
mkdir -p obj/hello out/fs/bin
|
|
nasm ${nasmargs} src/user/hello/hello.asm -o obj/hello/hello.o
|
|
ld -T src/user-elf.ld obj/hello/hello.o -o obj/hello.elf
|
|
objcopy -O binary obj/hello.elf out/fs/bin/hello.ple
|
|
|
|
init:
|
|
#TODO
|
|
|
|
kernel:
|
|
mkdir -p obj/kernel out
|
|
gcc ${kgccargs} -c src/kernel/drive.c -o obj/kernel/drive.o
|
|
gcc ${kgccargs} -c src/kernel/fat.c -o obj/kernel/fat.o
|
|
gcc ${kgccargs} -c src/kernel/ide.c -o obj/kernel/ide.o
|
|
gcc ${kgccargs} -c src/kernel/log.c -o obj/kernel/log.o
|
|
gcc ${kgccargs} -c src/kernel/main.c -o obj/kernel/main.o
|
|
gcc ${kgccargs} -c src/kernel/main2.c -o obj/kernel/main2.o
|
|
gcc ${kgccargs} -c src/kernel/mem.c -o obj/kernel/mem.o
|
|
gcc ${kgccargs} -c src/kernel/panic.c -o obj/kernel/panic.o
|
|
gcc ${kgccargs} -c src/kernel/pci.c -o obj/kernel/pci.o
|
|
gcc ${kgccargs} -c src/kernel/plef.c -o obj/kernel/plef.o
|
|
gcc ${kgccargs} -c src/kernel/serial.c -o obj/kernel/serial.o
|
|
gcc ${kgccargs} -c src/kernel/task.c -o obj/kernel/task.o
|
|
gcc ${kgccargs} -c src/kernel/util.c -o obj/kernel/util.o
|
|
gcc ${kgccargs} -c src/kernel/vga.c -o obj/kernel/vga.o
|
|
ld -T src/kernel/elf-link.ld obj/kernel/*.o -o obj/kernel.elf
|
|
objcopy -O binary obj/kernel.elf out/kernel.bin
|
|
|
|
boot:
|
|
mkdir -p out
|
|
nasm src/boot.asm -o out/boot.bin
|