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 | e849174 | 2021-04-08 20:38:06 -0700 | [diff] [blame^] | 47 | lib(ata_pio) \ |
| 48 | lib(pci) |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 49 | |
| 50 | type(custom_link) |
| 51 | |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 52 | debug-wait: kernel.elf |
| 53 | qemu-system-i386 -s -S -kernel kernel.elf |
| 54 | |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 55 | debug: kernel.elf |
| 56 | qemu-system-i386 -s -S -kernel kernel.elf & |
| 57 | @echo run "target remote localhost:1234" to connect to qemu |
swissChili | cfd3c3c | 2021-04-03 15:04:24 -0700 | [diff] [blame] | 58 | gdb $< |
swissChili | 2b5acc8 | 2021-03-13 17:06:42 -0800 | [diff] [blame] | 59 | @pkill qemu-system-i38 |
| 60 | |
| 61 | qemu: kernel.elf |
| 62 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot |
| 63 | |
| 64 | qemu-iso: install |
| 65 | qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso |
| 66 | |
| 67 | scan_codes.c: gen_scan_codes.py scan_codes.tsv |
| 68 | python3 $< > $@ |
| 69 | |
| 70 | install: kernel.elf lib(initrd) |
| 71 | cp kernel.elf $(ROOT)/boot/ |
| 72 | rm -f $(ROOT)/bin/bluejay.iso |
| 73 | grub-mkrescue -o $(ROOT)/bin/bluejay.iso $(ROOT) |
| 74 | |
| 75 | finish |