From a77914c140a0d28bbffc16d8a246406b0d27b797 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Sun, 24 Feb 2019 11:37:42 -0800 Subject: [PATCH] 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 --- arch/x86/CMakeLists.txt | 20 -------------------- arch/x86/gen_mmu_x86.py | 10 +++------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/arch/x86/CMakeLists.txt b/arch/x86/CMakeLists.txt index cbad6fcb98c..c948b5f48b5 100644 --- a/arch/x86/CMakeLists.txt +++ b/arch/x86/CMakeLists.txt @@ -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 - $ - 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 $ -o mmu_tables.bin -u user_mmu_tables.bin $<$:-v> WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS mmulist.bin DEPENDS ${ZEPHYR_PREBUILT_EXECUTABLE} ) diff --git a/arch/x86/gen_mmu_x86.py b/arch/x86/gen_mmu_x86.py index 126da2de232..0dfd1fcea57 100755 --- a/arch/x86/gen_mmu_x86.py +++ b/arch/x86/gen_mmu_x86.py @@ -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)