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