swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 1 | init(kernel, kernel.elf) |
| 2 | |
| 3 | preset(freestanding) |
| 4 | preset(optimize) |
| 5 | preset(debug) |
| 6 | preset(32) |
| 7 | preset(warn) |
| 8 | preset(nasm) |
| 9 | |
| 10 | archetype(c) |
| 11 | archetype(asm) |
| 12 | |
| 13 | depends(initrd, $(ROOT)/boot/initrd, initrd.img) |
swissChili | 1a3f07f | 2021-04-05 20:01:55 -0700 | [diff] [blame] | 14 | depends(ata_pio, dri/ata_pio, ata_pio.a) |
| 15 | |
| 16 | CFLAGS += -I $(ROOT)/include/kernel |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 17 | |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 18 | LDFLAGS += -Tlink.ld -melf_i386 |
swissChili | 7be3274 | 2021-04-03 21:17:24 -0700 | [diff] [blame] | 19 | ASMFLAGS += -felf -Fdwarf |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 20 | QEMUFLAGS = -d cpu_reset |
| 21 | |
| 22 | OBJECTS = boot.o \ |
| 23 | main.o \ |
| 24 | descriptor_tables.o \ |
| 25 | io.o \ |
| 26 | vga.o \ |
| 27 | gdt_flush.o \ |
| 28 | idt.o \ |
| 29 | log.o \ |
| 30 | irq.o \ |
| 31 | pic.o \ |
| 32 | timer.o \ |
| 33 | paging.o \ |
| 34 | switch_table.o \ |
| 35 | scan_codes.o \ |
| 36 | kheap.o \ |
| 37 | alloc.o \ |
| 38 | vfs.o \ |
| 39 | multiboot.o \ |
swissChili | 6422869 | 2021-03-16 08:19:23 -0700 | [diff] [blame] | 40 | vfs_initrd.o \ |
swissChili | e20b79b | 2021-03-17 21:20:13 -0700 | [diff] [blame] | 41 | syscall.o \ |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 42 | task.o \ |
swissChili | 1a3f07f | 2021-04-05 20:01:55 -0700 | [diff] [blame] | 43 | task_api.o \ |
| 44 | lib(ata_pio) |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 45 | |
| 46 | type(custom_link) |
| 47 | |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 48 | debug-wait: kernel.elf |
| 49 | qemu-system-i386 -s -S -kernel kernel.elf |
| 50 | |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 51 | debug: kernel.elf |
| 52 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 53 | @echo run "target remote localhost:1234" to connect to qemu |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 54 | gdb $< |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 55 | @pkill qemu-system-i38 |
| 56 | |
| 57 | qemu: kernel.elf |
| 58 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot |
| 59 | |
| 60 | qemu-iso: install |
| 61 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso |
| 62 | |
| 63 | scan_codes.c: gen_scan_codes.py scan_codes.tsv |
| 64 | python3 $< > $@ |
| 65 | |
| 66 | install: kernel.elf lib(initrd) |
| 67 | cp kernel.elf $(ROOT)/boot/ |
| 68 | rm -f $(ROOT)/bin/bluejay.iso |
| 69 | grub-mkrescue -o $(ROOT)/bin/bluejay.iso $(ROOT) |
| 70 | |
| 71 | finish |