tools: store KernelDTBSize as internal cache var

This is so KernelDTBSize can be consumed by other tools.
This commit is contained in:
Anna Lyons
2019-05-31 15:42:31 +10:00
committed by Japheth Lim
parent d5ded0c4f5
commit daa2f23111

View File

@@ -103,7 +103,10 @@ if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
if("${DTC_TOOL}" STREQUAL "DTC_TOOL-NOTFOUND")
message(FATAL_ERROR "Cannot find 'dtc' program.")
endif()
find_program(STAT_TOOL stat)
if("${STAT_TOOL}" STREQUAL "STAT_TOOL-NOTFOUND")
message(FATAL_ERROR "Cannot find 'stat' program.")
endif()
# Generate final DTS based on Linux DTS + seL4 overlay[s]
foreach(entry ${KernelDTSList})
get_absolute_source_or_binary(dts_tmp ${entry})
@@ -122,6 +125,21 @@ if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
COMMAND
${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
)
# Track the size of the DTB for downstream tools
execute_process(
COMMAND
${STAT_TOOL} -c '%s' ${KernelDTBPath}
OUTPUT_VARIABLE KernelDTBSize
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(
REPLACE
"\'"
""
KernelDTBSize
${KernelDTBSize}
)
set(KernelDTBSize "${KernelDTBSize}" CACHE INTERNAL "Size of DTB blob, in bytes")
endif()
set(deps ${KernelDTBPath} ${config_file} ${config_schema} ${HARDWARE_GEN_PATH})