blob: ddbc34313f260f143b0e67e3b4c3e87edd25af8f [file] [log] [blame]
swissChili2b5acc82021-03-13 17:06:42 -08001init(kernel, kernel.elf)
2
3preset(freestanding)
4preset(optimize)
5preset(debug)
6preset(32)
7preset(warn)
8preset(nasm)
9
10archetype(c)
11archetype(asm)
12
13depends(initrd, $(ROOT)/boot/initrd, initrd.img)
swissChili1a3f07f2021-04-05 20:01:55 -070014depends(ata_pio, dri/ata_pio, ata_pio.a)
swissChilie8491742021-04-08 20:38:06 -070015depends(pci, dri/pci, pci.a)
16# AHCI not yet implemented
17# depends(ahci, dri/ahci, ahci.a)
swissChili1a3f07f2021-04-05 20:01:55 -070018
swissChili402a3832021-05-29 21:41:31 -070019TEST ?=
20test_defines = $(TEST:%=-DTEST_%)
21
22CFLAGS += -I $(ROOT)/include/kernel $(test_defines)
swissChili2b5acc82021-03-13 17:06:42 -080023
swissChili64228692021-03-16 08:19:23 -070024LDFLAGS += -Tlink.ld -melf_i386
swissChili7be32742021-04-03 21:17:24 -070025ASMFLAGS += -felf -Fdwarf
swissChili2b5acc82021-03-13 17:06:42 -080026QEMUFLAGS = -d cpu_reset
27
28OBJECTS = boot.o \
29 main.o \
30 descriptor_tables.o \
31 io.o \
32 vga.o \
33 gdt_flush.o \
34 idt.o \
35 log.o \
36 irq.o \
37 pic.o \
38 timer.o \
39 paging.o \
40 switch_table.o \
41 scan_codes.o \
42 kheap.o \
43 alloc.o \
44 vfs.o \
45 multiboot.o \
swissChili64228692021-03-16 08:19:23 -070046 vfs_initrd.o \
swissChilie20b79b2021-03-17 21:20:13 -070047 syscall.o \
swissChilicfd3c3c2021-04-03 15:04:24 -070048 task.o \
swissChili1a3f07f2021-04-05 20:01:55 -070049 task_api.o \
swissChiliaed6ff32021-05-29 17:51:04 -070050 faults.o \
swissChilie8491742021-04-08 20:38:06 -070051 lib(ata_pio) \
52 lib(pci)
swissChili2b5acc82021-03-13 17:06:42 -080053
54type(custom_link)
55
swissChilicfd3c3c2021-04-03 15:04:24 -070056debug-wait: kernel.elf
57 qemu-system-i386 -s -S -kernel kernel.elf
58
swissChili2b5acc82021-03-13 17:06:42 -080059debug: kernel.elf
60 qemu-system-i386 -s -S -kernel kernel.elf &
61 @echo run "target remote localhost:1234" to connect to qemu
swissChilicfd3c3c2021-04-03 15:04:24 -070062 gdb $<
swissChili2b5acc82021-03-13 17:06:42 -080063 @pkill qemu-system-i38
64
65qemu: kernel.elf
66 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
67
68qemu-iso: install
69 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso
70
71scan_codes.c: gen_scan_codes.py scan_codes.tsv
72 python3 $< > $@
73
74install: kernel.elf lib(initrd)
75 cp kernel.elf $(ROOT)/boot/
76 rm -f $(ROOT)/bin/bluejay.iso
77 grub-mkrescue -o $(ROOT)/bin/bluejay.iso $(ROOT)
78
79finish