blob: 8300fd8345324bd9aa442edbaeb1be15340298db [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 \
swissChilie8491742021-04-08 20:38:06 -070047 lib(ata_pio) \
48 lib(pci)
swissChili2b5acc82021-03-13 17:06:42 -080049
50type(custom_link)
51
swissChilicfd3c3c2021-04-03 15:04:24 -070052debug-wait: kernel.elf
53 qemu-system-i386 -s -S -kernel kernel.elf
54
swissChili2b5acc82021-03-13 17:06:42 -080055debug: kernel.elf
56 qemu-system-i386 -s -S -kernel kernel.elf &
57 @echo run "target remote localhost:1234" to connect to qemu
swissChilicfd3c3c2021-04-03 15:04:24 -070058 gdb $<
swissChili2b5acc82021-03-13 17:06:42 -080059 @pkill qemu-system-i38
60
61qemu: kernel.elf
62 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
63
64qemu-iso: install
65 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso
66
67scan_codes.c: gen_scan_codes.py scan_codes.tsv
68 python3 $< > $@
69
70install: 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
75finish