mirror of
https://github.com/justinian/jsix.git
synced 2025-12-12 09:24:31 -08:00
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.
52 lines
1.3 KiB
Python
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
|