blob: 3759fd657b3921105dd21f7c7bd84aadf5cfa1f4 [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)
swissChili5fe85a12021-05-31 08:10:27 -070016depends(ide, dri/ide, ide.a)
swissChilie8491742021-04-08 20:38:06 -070017# AHCI not yet implemented
18# depends(ahci, dri/ahci, ahci.a)
swissChili1a3f07f2021-04-05 20:01:55 -070019
swissChili402a3832021-05-29 21:41:31 -070020TEST ?=
21test_defines = $(TEST:%=-DTEST_%)
22
23CFLAGS += -I $(ROOT)/include/kernel $(test_defines)
swissChili2b5acc82021-03-13 17:06:42 -080024
swissChili64228692021-03-16 08:19:23 -070025LDFLAGS += -Tlink.ld -melf_i386
swissChili7be32742021-04-03 21:17:24 -070026ASMFLAGS += -felf -Fdwarf
swissChili2b5acc82021-03-13 17:06:42 -080027QEMUFLAGS = -d cpu_reset
28
29OBJECTS = boot.o \
30 main.o \
31 descriptor_tables.o \
32 io.o \
33 vga.o \
34 gdt_flush.o \
35 idt.o \
36 log.o \
37 irq.o \
38 pic.o \
39 timer.o \
40 paging.o \
41 switch_table.o \
42 scan_codes.o \
43 kheap.o \
44 alloc.o \
45 vfs.o \
46 multiboot.o \
swissChili64228692021-03-16 08:19:23 -070047 vfs_initrd.o \
swissChilie20b79b2021-03-17 21:20:13 -070048 syscall.o \
swissChilicfd3c3c2021-04-03 15:04:24 -070049 task.o \
swissChili1a3f07f2021-04-05 20:01:55 -070050 task_api.o \
swissChiliaed6ff32021-05-29 17:51:04 -070051 faults.o \
swissChilie8491742021-04-08 20:38:06 -070052 lib(ata_pio) \
swissChili5fe85a12021-05-31 08:10:27 -070053 lib(pci) \
54 lib(ide)
swissChili2b5acc82021-03-13 17:06:42 -080055
56type(custom_link)
57
swissChilicfd3c3c2021-04-03 15:04:24 -070058debug-wait: kernel.elf
59 qemu-system-i386 -s -S -kernel kernel.elf
60
swissChili2b5acc82021-03-13 17:06:42 -080061debug: kernel.elf
62 qemu-system-i386 -s -S -kernel kernel.elf &
63 @echo run "target remote localhost:1234" to connect to qemu
swissChilicfd3c3c2021-04-03 15:04:24 -070064 gdb $<
swissChili2b5acc82021-03-13 17:06:42 -080065 @pkill qemu-system-i38
66
67qemu: kernel.elf
68 qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
69
70qemu-iso: install
71 qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso
72
73scan_codes.c: gen_scan_codes.py scan_codes.tsv
74 python3 $< > $@
75
76install: kernel.elf lib(initrd)
77 cp kernel.elf $(ROOT)/boot/
78 rm -f $(ROOT)/bin/bluejay.iso
79 grub-mkrescue -o $(ROOT)/bin/bluejay.iso $(ROOT)
80
81finish