2014-02-12 21:47:13 +00:00
|
|
|
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
|
2014-07-14 06:16:54 +00:00
|
|
|
"amd64/critical.c",
|
2014-07-13 20:36:43 +00:00
|
|
|
"amd64/debug.c",
|
2014-07-13 23:52:18 +00:00
|
|
|
"amd64/disasm.c",
|
2014-07-24 01:07:07 +00:00
|
|
|
"amd64/ioapic.c",
|
|
|
|
"amd64/irq.c",
|
|
|
|
"amd64/lapic.c",
|
2014-02-12 21:47:13 +00:00
|
|
|
"amd64/machine.c",
|
2014-06-30 22:52:35 +00:00
|
|
|
"amd64/pci.c",
|
|
|
|
"amd64/pmap.c",
|
2014-07-24 01:07:07 +00:00
|
|
|
"amd64/switch.S",
|
|
|
|
"amd64/thread.c",
|
2014-07-25 03:25:17 +00:00
|
|
|
"amd64/time.c",
|
2014-07-24 01:07:07 +00:00
|
|
|
"amd64/trap.c",
|
|
|
|
"amd64/trapentry.S",
|
2014-07-17 00:21:18 +00:00
|
|
|
"amd64/xmem.c",
|
|
|
|
# Devices
|
2014-07-02 21:06:00 +00:00
|
|
|
"dev/x86/debugcons.c",
|
2014-07-13 20:04:14 +00:00
|
|
|
"dev/x86/sercons.c",
|
2014-07-06 01:46:59 +00:00
|
|
|
"dev/x86/vgacons.c",
|
|
|
|
"dev/x86/ide.c",
|
2014-02-12 21:47:13 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
src_common = [
|
2014-07-04 00:36:31 +00:00
|
|
|
"kern/debug.c",
|
2014-07-24 23:38:35 +00:00
|
|
|
"kern/disk.c",
|
2014-07-31 00:19:24 +00:00
|
|
|
"kern/diskcache.c",
|
2014-02-12 21:47:13 +00:00
|
|
|
"kern/libc.c",
|
2014-07-28 00:09:31 +00:00
|
|
|
"kern/loader.c",
|
2014-02-12 21:47:13 +00:00
|
|
|
"kern/palloc.c",
|
|
|
|
"kern/printf.c",
|
2014-07-31 00:19:24 +00:00
|
|
|
"kern/sga.c",
|
2014-07-10 22:55:32 +00:00
|
|
|
"kern/spinlock.c",
|
2014-07-28 21:35:00 +00:00
|
|
|
"kern/syscall.c",
|
2014-07-24 01:07:07 +00:00
|
|
|
"kern/thread.c",
|
2014-07-02 21:06:00 +00:00
|
|
|
"dev/ahci.c",
|
|
|
|
"dev/console.c",
|
|
|
|
"dev/pci.c",
|
2014-02-12 21:47:13 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
if (env["ARCH"] == "amd64"):
|
|
|
|
src.append(src_amd64)
|
|
|
|
src.append(src_common)
|
2014-07-18 20:37:46 +00:00
|
|
|
ldscript = "#sys/amd64/kernel.lds"
|
2014-02-12 21:47:13 +00:00
|
|
|
|
2014-07-18 20:37:46 +00:00
|
|
|
kern_env.Append(LINKFLAGS = ['-T', ldscript[1:], '-N', '-nostdlib'])
|
2014-02-12 21:47:13 +00:00
|
|
|
kern_env.Append(CPPFLAGS = ['-ffreestanding', '-fno-builtin', '-nostdinc',
|
2014-07-18 20:37:46 +00:00
|
|
|
'-mno-red-zone', '-mno-mmx', '-mno-sse',
|
|
|
|
'-mcmodel=large'])
|
2014-02-12 21:47:13 +00:00
|
|
|
# '-target', 'amd64-orion-eabi'
|
2014-07-22 06:43:01 +00:00
|
|
|
kern_env.Append(CPPPATH = ['#build/include'])
|
2014-02-12 21:47:13 +00:00
|
|
|
|
2014-07-18 20:37:46 +00:00
|
|
|
kernel = kern_env.Program("castor", src)
|
|
|
|
Depends(kernel, ldscript)
|
2014-02-12 21:47:13 +00:00
|
|
|
|