swissChili | f3d6576 | 2022-07-03 22:34:54 -0700 | [diff] [blame^] | 1 | # -*- tcl -*- |
| 2 | |
| 3 | init kernel kernel.elf |
| 4 | |
| 5 | presets freestanding debug 32 warn nasm |
| 6 | |
| 7 | cflags -I$root/include/kernel -I$root/include -O0 -Wno-ignored-qualifiers -Wno-sign-compare |
| 8 | |
| 9 | ldflags -Tlink.ld -melf_i386 |
| 10 | asmflags -felf -Fdwarf |
| 11 | set qemuflags "-drive file=hd0_ext2.img,format=raw" |
| 12 | |
| 13 | depends sys $root/src/libsys libsys.a |
| 14 | depends initrd $root/boot/initrd initrd.img |
| 15 | depends ata_pio dri/ata_pio ata_pio.a |
| 16 | depends pci dri/pci pci.a |
| 17 | depends ide dri/ide ide.a |
| 18 | depends ext2 dri/fs/ext2 ext2.a |
| 19 | |
| 20 | option FS ext2 |
| 21 | |
| 22 | srcs 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 | |
| 48 | objs [lib ext2] \ |
| 49 | [lib ide] \ |
| 50 | [lib ata_pio] \ |
| 51 | [lib pci] \ |
| 52 | [lib sys] |
| 53 | |
| 54 | type custom_link |
| 55 | |
| 56 | rule debug-wait kernel.elf { |
| 57 | shell "qemu-system-i386 -s -S $::qemuflags -kernel kernel.efl" |
| 58 | } |
| 59 | rule 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 | |
| 66 | rule 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 | |
| 70 | rule scan_codes.c "gen_scan_codes.py scan_codes.tsv" { |
| 71 | shell "python3 $::first_src > $::target" |
| 72 | } |