swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 1 | SOURCES = boot.o \ |
| 2 | main.o \ |
| 3 | descriptor_tables.o \ |
| 4 | io.o \ |
| 5 | vga.o \ |
| 6 | gdt_flush.o \ |
| 7 | idt.o \ |
swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 8 | log.o \ |
| 9 | irq.o \ |
swissChili | defeb0d | 2021-02-18 15:28:36 -0800 | [diff] [blame] | 10 | pic.o \ |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 11 | timer.o \ |
| 12 | paging.o \ |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame^] | 13 | switch_table.o \ |
| 14 | scan_codes.o |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 15 | CFLAGS = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding -m32 -O2 -g |
| 16 | LDFLAGS = -Tlink.ld -melf_i386 |
| 17 | ASMFLAGS = -felf |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 18 | QEMUFLAGS = -d cpu_reset |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 19 | |
| 20 | kernel.elf: $(SOURCES) |
| 21 | ld $(LDFLAGS) -o $@ $^ |
| 22 | |
| 23 | clean: |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 24 | rm -f *.o *.bin *.elf ../bin/*.iso |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 25 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 26 | debug: kernel.elf |
| 27 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 28 | @echo run "target remote localhost:1234" to connect to qemu |
| 29 | gdb |
| 30 | @pkill qemu-system-i38 |
| 31 | |
| 32 | qemu: kernel.elf |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 33 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 34 | |
| 35 | qemu-iso: install |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 36 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio ../bin/bluejay.iso |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 37 | |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame^] | 38 | scan_codes.c: gen_scan_codes.py scan_codes.tsv |
| 39 | python3 $< > $@ |
| 40 | |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 41 | .s.o: |
| 42 | nasm $(ASMFLAGS) $< |
| 43 | |
| 44 | install: kernel.elf |
| 45 | cp kernel.elf ../boot/ |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 46 | rm -f ../bin/bluejay.iso |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 47 | grub-mkrescue -o ../bin/bluejay.iso .. |
| 48 | |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 49 | .PHONY: install qemu clean qemu-iso debug |