Files
jsix/src/kernel/wscript
Justin C. Miller 585abe9a18 Simple ELF program loader
Now any initrd file is treated like a program image and passed to the
loader to load as a process. Very rudimentary elf loading just allocates
pages, copies sections, and sets the ELF's entrypoint as the RIP to
iretq to.
2018-09-06 01:35:56 -07:00

52 lines
1.3 KiB
Python

def configure(ctx):
pass
def build(bld):
from os.path import join
sources = bld.path.ant_glob("**/*.cpp")
sources += bld.path.ant_glob("**/*.s")
lds = join(bld.env.ARCH_D, 'kernel.ld')
bld.program(
source = sources,
name = 'kernel',
includes = '.',
target = bld.env.KERNEL_FILENAME,
use = [
'kutil',
'initrd',
'elf',
],
linkflags = "-T {}".format(lds),
)
from waflib.Task import Task
class objdump(Task):
color = 'PINK'
def keyword(self):
return "Dumping"
def __str__(self):
node = self.outputs[0]
return node.path_from(node.ctx.launch_node())
def run(self):
from subprocess import check_output
args = self.env.objdump + [
"--source",
"-D",
"-M", "intel",
self.inputs[0].abspath()]
with file(self.outputs[0].abspath(), 'w') as output:
output.write(check_output(args))
out = bld.path.get_bld()
dump = objdump(env=bld.env)
dump.set_inputs([out.make_node(bld.env.KERNEL_FILENAME)])
dump.set_outputs([out.make_node("kernel.dump")])
bld.add_to_group(dump)
# vim: ft=python et