コード例 #1
0
def merge(spec_file, options):
    """Based on a given spec file, process it and merge into
    the output_file."""
    pools = weaver.pools.Pools()
    machine = weaver.machine.Machine()
    bootinfo = weaver.bootinfo.BootInfo()
    image = weaver.image.Image(options.program_header_offset)

    namespace = weaver.namespace.ObjectNameSpace(None)
    device_namespace = namespace.add_namespace("dev")

    # parsed is an in memory tree of Element Objects
    # which is created from spec_file
    if options.spec_is_string:
        parsed = parse_spec_xml_string(spec_file)
    else:
        parsed = parse_spec_xml(spec_file)

    collect_image_objects(parsed, options.ignore_name,
                          options.kernel_heap_size, namespace, image, machine,
                          pools, bootinfo)
    bootinfo.create_dynamic_segments(namespace, image, machine, pools,
                                     bootinfo)
    image.layout(machine, pools)

    if options.remove_section_headers:
        image.remove_section_headers()

    # The ELF file must be prepared to calculate the offset value of
    # the segment info records in the environment.
    image.prepare(machine)

    bootinfo.generate(image, machine, bootinfo)

    image.apply_patches()
    image.write_out_image(options.output_file, machine)

    # If wanted, print out the final tree.
    if options.dump_layout:
        image.dump()

    if options.last_phys:
        pools.print_last_phys()
コード例 #2
0
ファイル: merge.py プロジェクト: dafyddcrosby/L4OS
def merge(spec_file, options):
    """Based on a given spec file, process it and merge into
    the output_file."""
    pools    = weaver.pools.Pools()
    machine  = weaver.machine.Machine()
    bootinfo = weaver.bootinfo.BootInfo()
    image    = weaver.image.Image(options.program_header_offset)

    namespace = weaver.namespace.ObjectNameSpace(None)
    device_namespace = namespace.add_namespace("dev")

    # parsed is an in memory tree of Element Objects
    # which is created from spec_file
    if options.spec_is_string:
        parsed = parse_spec_xml_string(spec_file)
    else:
        parsed = parse_spec_xml(spec_file)

    collect_image_objects(parsed, options.ignore_name,
                          options.kernel_heap_size,
                          namespace, image, machine, pools, bootinfo)
    bootinfo.create_dynamic_segments(namespace, image, machine, pools, bootinfo)
    image.layout(machine, pools)

    if options.remove_section_headers:
        image.remove_section_headers()


    # The ELF file must be prepared to calculate the offset value of
    # the segment info records in the environment.
    image.prepare(machine)

    bootinfo.generate(image, machine, bootinfo)

    image.apply_patches()
    image.write_out_image(options.output_file, machine)

    # If wanted, print out the final tree.
    if options.dump_layout:
        image.dump()

    if options.last_phys:
        pools.print_last_phys()
コード例 #3
0
ファイル: merge.py プロジェクト: BruceYi/okl4
def merge(spec_file, options):
    """Based on a given spec file, process it and merge into
    the output_file."""
    image = weaver.image.Image(options.program_header_offset)

    namespace = weaver.namespace.ObjectNameSpace(None, '/')

    # parsed is an in memory tree of Element Objects
    # which is created from spec_file

    Machine.register()
    VirtualPool.register()
    PhysicalPool.register()
    Kernel.register()

    if options.spec_is_string:
        parsed = parse_spec_xml_string(spec_file)
    else:
        parsed = parse_spec_xml(spec_file)

    machine, kernel, pools, found_cells = \
        collect_image_objects(parsed, options.ignore_name,
                              options.kernel_heap_size,
                              namespace, image)

    # Resolve unknown cap names.  This will generate references to
    # kernel caps, which are needed by kernel.layout_cells_pre().
    for cell in found_cells:
        cell.env.snap(cell)

    kernel.layout_cells_pre()

    # For each found cell generate any dynamic segments that need processing
    for cell in found_cells:
        cell.generate_dynamic_segments(namespace, machine, pools, kernel, image)

    # Kernel dynamic elements need to be performed after all the cells
    # have been completed in order for the cell's enviornment memsections
    # to be populated before we generate the kernel's init script
    kernel.create_dynamic_segments(namespace, image, machine, pools)

    image.layout(machine, pools)
    notes = NotesSection(kernel)
    notes.set_mempool(image.phys_pool_stack.bot())
    image.get_elf().add_section(notes.encode_section(image.get_elf()))

    # The ELF file must be prepared to calculate the offset value of
    # the segment info records in the environment.
    image.prepare()

    kernel.layout_cells_post(image)

    # Perform any generation code that needs to be run for each found cell
    for cell in found_cells:
        cell.generate_init(machine, pools, kernel, image)
    kernel.generate_init_script(image, machine)

    image.apply_patches()
    image.write_out_image(options.output_file, image, kernel, machine)

    # If wanted, print out the final tree.
    if options.dump_layout:
        image.dump()

    if options.last_phys:
        pools.print_last_phys()
コード例 #4
0
ファイル: merge.py プロジェクト: openbox00/oktest
def merge(spec_file, options):
    """Based on a given spec file, process it and merge into
    the output_file."""
    image = weaver.image.Image(options.program_header_offset)

    namespace = weaver.namespace.ObjectNameSpace(None, '/')

    # parsed is an in memory tree of Element Objects
    # which is created from spec_file

    Machine.register()
    VirtualPool.register()
    PhysicalPool.register()
    Kernel.register()

    if options.spec_is_string:
        parsed = parse_spec_xml_string(spec_file)
    else:
        parsed = parse_spec_xml(spec_file)

    machine, kernel, pools, found_cells = \
        collect_image_objects(parsed, options.ignore_name,
                              options.kernel_heap_size,
                              namespace, image)

    # Resolve unknown cap names.  This will generate references to
    # kernel caps, which are needed by kernel.layout_cells_pre().
    for cell in found_cells:
        cell.env.snap(cell)

    kernel.layout_cells_pre()

    # For each found cell generate any dynamic segments that need processing
    for cell in found_cells:
        cell.generate_dynamic_segments(namespace, machine, pools, kernel,
                                       image)

    # Kernel dynamic elements need to be performed after all the cells
    # have been completed in order for the cell's enviornment memsections
    # to be populated before we generate the kernel's init script
    kernel.create_dynamic_segments(namespace, image, machine, pools)

    image.layout(machine, pools)
    notes = NotesSection(kernel)
    notes.set_mempool(image.phys_pool_stack.bot())
    image.get_elf().add_section(notes.encode_section(image.get_elf()))

    # The ELF file must be prepared to calculate the offset value of
    # the segment info records in the environment.
    image.prepare()

    kernel.layout_cells_post(image)

    # Perform any generation code that needs to be run for each found cell
    for cell in found_cells:
        cell.generate_init(machine, pools, kernel, image)
    kernel.generate_init_script(image, machine)

    image.apply_patches()
    image.write_out_image(options.output_file, image, kernel, machine)

    # If wanted, print out the final tree.
    if options.dump_layout:
        image.dump()

    if options.last_phys:
        pools.print_last_phys()