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:
parent
b8cbf21990
commit
a77914c140
2 changed files with 3 additions and 27 deletions
|
@ -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)
|
add_bin_file_to_the_next_link(gen_idt_output irq_vectors_alloc)
|
||||||
|
|
||||||
if(CONFIG_X86_MMU)
|
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)
|
if(CONFIG_X86_KPTI)
|
||||||
set(user_mmu_tables_bin user_mmu_tables.bin)
|
set(user_mmu_tables_bin user_mmu_tables.bin)
|
||||||
endif()
|
endif()
|
||||||
|
@ -139,13 +121,11 @@ if(CONFIG_X86_MMU)
|
||||||
COMMAND
|
COMMAND
|
||||||
${PYTHON_EXECUTABLE}
|
${PYTHON_EXECUTABLE}
|
||||||
${ZEPHYR_BASE}/arch/x86/gen_mmu_x86.py
|
${ZEPHYR_BASE}/arch/x86/gen_mmu_x86.py
|
||||||
-i mmulist.bin
|
|
||||||
-k $<TARGET_FILE:${ZEPHYR_PREBUILT_EXECUTABLE}>
|
-k $<TARGET_FILE:${ZEPHYR_PREBUILT_EXECUTABLE}>
|
||||||
-o mmu_tables.bin
|
-o mmu_tables.bin
|
||||||
-u user_mmu_tables.bin
|
-u user_mmu_tables.bin
|
||||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-v>
|
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-v>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS mmulist.bin
|
|
||||||
DEPENDS ${ZEPHYR_PREBUILT_EXECUTABLE}
|
DEPENDS ${ZEPHYR_PREBUILT_EXECUTABLE}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -394,10 +394,7 @@ class PageMode_PAE:
|
||||||
|
|
||||||
#*****************************************************************************#
|
#*****************************************************************************#
|
||||||
|
|
||||||
def read_mmu_list(filename):
|
def read_mmu_list(mmu_list_data):
|
||||||
with open(filename, 'rb') as fp:
|
|
||||||
mmu_list_data = fp.read()
|
|
||||||
|
|
||||||
regions = []
|
regions = []
|
||||||
|
|
||||||
# Read mmu_list header data
|
# Read mmu_list header data
|
||||||
|
@ -480,8 +477,6 @@ def parse_args():
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument("-i", "--input",
|
|
||||||
help="Input file from which MMU regions are read.")
|
|
||||||
parser.add_argument("-k", "--kernel",
|
parser.add_argument("-k", "--kernel",
|
||||||
help="Zephyr kernel image")
|
help="Zephyr kernel image")
|
||||||
parser.add_argument("-o", "--output",
|
parser.add_argument("-o", "--output",
|
||||||
|
@ -502,8 +497,9 @@ def main():
|
||||||
with open(args.kernel, "rb") as fp:
|
with open(args.kernel, "rb") as fp:
|
||||||
kernel = ELFFile(fp)
|
kernel = ELFFile(fp)
|
||||||
syms = get_symbols(kernel)
|
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
|
# select the page table needed
|
||||||
page_table = PageMode_PAE(pd_start_addr, regions, syms, False)
|
page_table = PageMode_PAE(pd_start_addr, regions, syms, False)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue