From e8c6577617bffa4402c07c7aa20e3c24f03c1c20 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 6 Sep 2020 00:48:07 -0400 Subject: program loading, others big kernel additions: paging, elf loading, separate kernel and user page allocation it now properly loads and runs sd0:bin/init.elf still need to determine which disk was booted from, and start the init on that disk --- makefile | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 502a3cc..c6706ed 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -disk: kernel boot skel hello +disk: kernel boot skel init #psch 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 @@ -15,41 +15,68 @@ debug: disk gdb -x qemu-debug.gdb clean: - rm -r obj out + rm -r obj out || true 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 +ugccargs = ${kgccargs} -Isrc/user/include nasmargs = -f elf32 +partlink = -r -m elf_i386 -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: knob + mkdir -p obj/init out/fs/bin -init: - #TODO + gcc ${ugccargs} -c src/user/init/main.c -o obj/init/main.o + + ld -T src/user/elf.ld obj/init/main.o obj/knob.o -o obj/init.elf + cp obj/init.elf out/fs/bin/init.elf + +psch: knob + mkdir -p obj/psch out/fs/bin + + gcc ${ugccargs} -c src/user/psch/main.c -o obj/psch/main.o + gcc ${ugccargs} -c src/user/psch/data.c -o obj/psch/data.o + + ld -T src/user/elf.ld obj/psch/*.o obj/knob.o -o obj/psch.elf + cp obj/psch.elf out/fs/bin/psch.elf + +knob: + mkdir -p obj/knob + + gcc ${ugccargs} -c src/user/knob/env.c -o obj/knob/env.o + gcc ${ugccargs} -c src/user/knob/file.c -o obj/knob/file.o + gcc ${ugccargs} -c src/user/knob/format.c -o obj/knob/format.o + gcc ${ugccargs} -c src/user/knob/heap.c -o obj/knob/heap.o + gcc ${ugccargs} -c src/user/knob/quit.c -o obj/knob/quit.o + gcc ${ugccargs} -c src/user/knob/user.c -o obj/knob/user.o + nasm ${nasmargs} src/user/knob/entry.asm -o obj/knob/entry.o + + ld ${partlink} obj/knob/*.o -o obj/knob.o 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/idt.c -o obj/kernel/idt.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/pmap.c -o obj/kernel/pmap.o + gcc ${kgccargs} -c src/kernel/paging.c -o obj/kernel/paging.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/elf.c -o obj/kernel/elf.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 + nasm ${nasmargs} src/kernel/isrs.asm -o obj/kernel/isrs.o + ld -T src/kernel/elf-link.ld obj/kernel/*.o -o obj/kernel.elf objcopy -O binary obj/kernel.elf out/kernel.bin -- cgit v1.2.3