x86: gen_mmu_x86.py: simplify usage

We don't need the build system to pull out the mmu
region specifiers from the kernel binary when the
script can just as easily do this itself.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-02-24 11:37:42 -08:00 committed by Andrew Boie
commit a77914c140
2 changed files with 3 additions and 27 deletions

View file

@ -104,24 +104,6 @@ add_bin_file_to_the_next_link(gen_idt_output irq_int_vector_map)
add_bin_file_to_the_next_link(gen_idt_output irq_vectors_alloc)
if(CONFIG_X86_MMU)
# Use gen_mmu.py and objcopy to generate mmu_tables.o from from the
# elf file ${ZEPHYR_PREBUILT_EXECUTABLE}, creating the temp files mmu_tables.bin
# and mmulist.bin along the way.
#
# ${ZEPHYR_PREBUILT_EXECUTABLE}.elf -> mmulist.bin -> mmu_tables.bin -> mmu_tables.o
add_custom_command(
OUTPUT mmulist.bin
COMMAND
${CMAKE_OBJCOPY}
-I ${OUTPUT_FORMAT}
-O binary
-j mmulist
$<TARGET_FILE:${ZEPHYR_PREBUILT_EXECUTABLE}>
mmulist.bin
DEPENDS ${ZEPHYR_PREBUILT_EXECUTABLE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
if(CONFIG_X86_KPTI)
set(user_mmu_tables_bin user_mmu_tables.bin)
endif()
@ -139,13 +121,11 @@ if(CONFIG_X86_MMU)
COMMAND
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/arch/x86/gen_mmu_x86.py
-i mmulist.bin
-k $<TARGET_FILE:${ZEPHYR_PREBUILT_EXECUTABLE}>
-o mmu_tables.bin
-u user_mmu_tables.bin
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-v>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS mmulist.bin
DEPENDS ${ZEPHYR_PREBUILT_EXECUTABLE}
)

View file

@ -394,10 +394,7 @@ class PageMode_PAE:
#*****************************************************************************#
def read_mmu_list(filename):
with open(filename, 'rb') as fp:
mmu_list_data = fp.read()
def read_mmu_list(mmu_list_data):
regions = []
# Read mmu_list header data
@ -480,8 +477,6 @@ def parse_args():
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("-i", "--input",
help="Input file from which MMU regions are read.")
parser.add_argument("-k", "--kernel",
help="Zephyr kernel image")
parser.add_argument("-o", "--output",
@ -502,8 +497,9 @@ def main():
with open(args.kernel, "rb") as fp:
kernel = ELFFile(fp)
syms = get_symbols(kernel)
irq_data = kernel.get_section_by_name("mmulist").data()
pd_start_addr, regions = read_mmu_list(args.input)
pd_start_addr, regions = read_mmu_list(irq_data)
# select the page table needed
page_table = PageMode_PAE(pd_start_addr, regions, syms, False)