blob: 21b7ebedbdaf0792ab44fc9e1391d8f01752c89a [file] [log] [blame]
swissChilif3d65762022-07-03 22:34:54 -07001# -*- tcl -*-
2
3init kernel kernel.elf
4
5presets freestanding debug 32 warn nasm
6
7cflags -I$root/include/kernel -I$root/include -O0 -Wno-ignored-qualifiers -Wno-sign-compare
8
9ldflags -Tlink.ld -melf_i386
10asmflags -felf -Fdwarf
11set qemuflags "-drive file=hd0_ext2.img,format=raw"
12
13depends sys $root/src/libsys libsys.a
14depends initrd $root/boot/initrd initrd.img
15depends ata_pio dri/ata_pio ata_pio.a
16depends pci dri/pci pci.a
17depends ide dri/ide ide.a
18depends ext2 dri/fs/ext2 ext2.a
19
20option FS ext2
21
22srcs boot.s \
23 main.c \
24 descriptor_tables.c \
25 io.c \
26 vga.c \
27 gdt_flush.s \
28 tss_flush.s \
29 idt.s \
30 log.c \
31 irq.c \
32 pic.c \
33 timer.c \
34 paging.c \
35 switch_table.s \
36 scan_codes.c \
37 kheap.c \
38 alloc.c \
39 vfs.c \
40 multiboot.c \
41 vfs_initrd.c \
42 syscall.c \
43 task.c \
44 task_api.s \
45 faults.c \
46 sync.c
47
48objs [lib ext2] \
49 [lib ide] \
50 [lib ata_pio] \
51 [lib pci] \
52 [lib sys]
53
54type custom_link
55
56rule debug-wait kernel.elf {
57 shell "qemu-system-i386 -s -S $::qemuflags -kernel kernel.efl"
58}
59rule debug kernel.elf {
60 shell "qemu-system-i386 -s -S $::qemuflags -kernel kernel.efl"
61 shell "echo run target remote localhost:1234 to connect to qemu"
62 shell "gdb $::first_src"
63 shell "pkill qemu-system-i386"
64}
65
66rule qemu "kernel.elf hd0_$::options(FS).img" {
67 shell "qemu-system-i386 $::qemuflags -d cpu_reset -monitor stdio -kernel kernel.elf -no-reboot"
68}
69
70rule scan_codes.c "gen_scan_codes.py scan_codes.tsv" {
71 shell "python3 $::first_src > $::target"
72}