blob: 0ae3053bfe37d7f8bc8ba7691864c6379724cde1 [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
19CFLAGS += -I $(ROOT)/include/kernel
swissChili2b5acc82021-03-13 17:06:42 -080020
swissChili64228692021-03-16 08:19:23 -070021LDFLAGS += -Tlink.ld -melf_i386
swissChili7be32742021-04-03 21:17:24 -070022ASMFLAGS += -felf -Fdwarf
swissChili2b5acc82021-03-13 17:06:42 -080023QEMUFLAGS = -d cpu_reset
24
25OBJECTS = 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 \
swissChili64228692021-03-16 08:19:23 -070043 vfs_initrd.o \
swissChilie20b79b2021-03-17 21:20:13 -070044 syscall.o \
swissChilicfd3c3c2021-04-03 15:04:24 -070045 task.o \
swissChili1a3f07f2021-04-05 20:01:55 -070046 task_api.o \
swissChiliaed6ff32021-05-29 17:51:04 -070047 faults.o \
swissChilie8491742021-04-08 20:38:06 -070048 lib(ata_pio) \
49 lib(pci)
swissChili2b5acc82021-03-13 17:06:42 -080050
51type(custom_link)
52
swissChilicfd3c3c2021-04-03 15:04:24 -070053debug-wait: kernel.elf
54 qemu-system-i386 -s -S -kernel kernel.elf
55
swissChili2b5acc82021-03-13 17:06:42 -080056debug: kernel.elf
57 qemu-system-i386 -s -S -kernel kernel.elf &
58 @echo run "target remote localhost:1234" to connect to qemu
swissChilicfd3c3c2021-04-03 15:04:24 -070059 gdb $<
swissChili2b5acc82021-03-13 17:06:42 -080060 @pkill qemu-system-i38
61
62qemu: kernel.elf
63 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
64
65qemu-iso: install
66 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso
67
68scan_codes.c: gen_scan_codes.py scan_codes.tsv
69 python3 $< > $@
70
71install: 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
76finish