66 lines
1.3 KiB
Python
66 lines
1.3 KiB
Python
import sys
|
|
|
|
Import('env')
|
|
|
|
kern_env = env.Clone()
|
|
|
|
src = [ ]
|
|
|
|
src_amd64 = [
|
|
# Multiboot requires multiboot.S to be the first file
|
|
"amd64/multiboot.S",
|
|
"amd64/mbentry.c",
|
|
# AMD64
|
|
"amd64/critical.c",
|
|
"amd64/debug.c",
|
|
"amd64/disasm.c",
|
|
"amd64/ioapic.c",
|
|
"amd64/irq.c",
|
|
"amd64/lapic.c",
|
|
"amd64/machine.c",
|
|
"amd64/pci.c",
|
|
"amd64/pmap.c",
|
|
"amd64/switch.S",
|
|
"amd64/thread.c",
|
|
"amd64/time.c",
|
|
"amd64/trap.c",
|
|
"amd64/trapentry.S",
|
|
"amd64/xmem.c",
|
|
# Devices
|
|
"dev/x86/debugcons.c",
|
|
"dev/x86/sercons.c",
|
|
"dev/x86/vgacons.c",
|
|
"dev/x86/ide.c",
|
|
]
|
|
|
|
src_common = [
|
|
"kern/debug.c",
|
|
"kern/disk.c",
|
|
"kern/libc.c",
|
|
"kern/loader.c",
|
|
"kern/palloc.c",
|
|
"kern/printf.c",
|
|
"kern/spinlock.c",
|
|
"kern/syscall.c",
|
|
"kern/thread.c",
|
|
"dev/ahci.c",
|
|
"dev/console.c",
|
|
"dev/pci.c",
|
|
]
|
|
|
|
if (env["ARCH"] == "amd64"):
|
|
src.append(src_amd64)
|
|
src.append(src_common)
|
|
ldscript = "#sys/amd64/kernel.lds"
|
|
|
|
kern_env.Append(LINKFLAGS = ['-T', ldscript[1:], '-N', '-nostdlib'])
|
|
kern_env.Append(CPPFLAGS = ['-ffreestanding', '-fno-builtin', '-nostdinc',
|
|
'-mno-red-zone', '-mno-mmx', '-mno-sse',
|
|
'-mcmodel=large'])
|
|
# '-target', 'amd64-orion-eabi'
|
|
kern_env.Append(CPPPATH = ['#build/include'])
|
|
|
|
kernel = kern_env.Program("castor", src)
|
|
Depends(kernel, ldscript)
|
|
|