forked from Imagelibrary/seL4
Ensure execute_process is error checked
Check the return value from execute_process calls and fail with an appropriate message. This makes debugging of cmake failures much easier. Signed-off-by: Ben Leslie <benno@brkawy.com>
This commit is contained in:
@@ -135,14 +135,22 @@ if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
|
|||||||
execute_process(
|
execute_process(
|
||||||
COMMAND
|
COMMAND
|
||||||
${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
|
${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
|
||||||
|
RESULT_VARIABLE error
|
||||||
)
|
)
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Failed to compile DTS to DTB: ${KernelDTBPath}")
|
||||||
|
endif()
|
||||||
# Track the size of the DTB for downstream tools
|
# Track the size of the DTB for downstream tools
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND
|
COMMAND
|
||||||
${STAT_TOOL} -c '%s' ${KernelDTBPath}
|
${STAT_TOOL} -c '%s' ${KernelDTBPath}
|
||||||
OUTPUT_VARIABLE KernelDTBSize
|
OUTPUT_VARIABLE KernelDTBSize
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
RESULT_VARIABLE error
|
||||||
)
|
)
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Failed to determine KernelDTBSize: ${KernelDTBPath}")
|
||||||
|
endif()
|
||||||
string(
|
string(
|
||||||
REPLACE
|
REPLACE
|
||||||
"\'"
|
"\'"
|
||||||
|
|||||||
@@ -34,7 +34,14 @@ if(KernelPlatformQEMUArmVirt)
|
|||||||
set(KernelArmCortexA53 ON)
|
set(KernelArmCortexA53 ON)
|
||||||
set(KernelArchArmV8a ON)
|
set(KernelArchArmV8a ON)
|
||||||
endif()
|
endif()
|
||||||
execute_process(COMMAND qemu-system-${QEMU_ARCH} -version OUTPUT_VARIABLE QEMU_VERSION_STR)
|
execute_process(
|
||||||
|
COMMAND qemu-system-${QEMU_ARCH} -version
|
||||||
|
OUTPUT_VARIABLE QEMU_VERSION_STR
|
||||||
|
RESULT_VARIABLE error
|
||||||
|
)
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Failed to determine qemu version (qemu-system-${QEMU_ARCH})")
|
||||||
|
endif()
|
||||||
string(
|
string(
|
||||||
REGEX
|
REGEX
|
||||||
MATCH
|
MATCH
|
||||||
@@ -69,14 +76,22 @@ if(KernelPlatformQEMUArmVirt)
|
|||||||
${QEMU_BINARY} -machine virt,dumpdtb=${DTBPath},${QEMU_VIRT_OPTION} -m ${QEMU_MEMORY}
|
${QEMU_BINARY} -machine virt,dumpdtb=${DTBPath},${QEMU_VIRT_OPTION} -m ${QEMU_MEMORY}
|
||||||
-cpu ${ARM_CPU} -smp ${QEMU_SMP_OPTION} -nographic
|
-cpu ${ARM_CPU} -smp ${QEMU_SMP_OPTION} -nographic
|
||||||
ERROR_VARIABLE QEMU_OUTPUT_MESSAGE
|
ERROR_VARIABLE QEMU_OUTPUT_MESSAGE
|
||||||
|
RESULT_VARIABLE error
|
||||||
)
|
)
|
||||||
string(STRIP ${QEMU_OUTPUT_MESSAGE} QEMU_OUTPUT_MESSAGE)
|
string(STRIP ${QEMU_OUTPUT_MESSAGE} QEMU_OUTPUT_MESSAGE)
|
||||||
message(STATUS ${QEMU_OUTPUT_MESSAGE})
|
message(STATUS ${QEMU_OUTPUT_MESSAGE})
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Failed to dump DTB using ${QEMU_BINARY})")
|
||||||
|
endif()
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND
|
COMMAND
|
||||||
dtc -q -I dtb -O dts ${DTBPath}
|
dtc -q -I dtb -O dts ${DTBPath}
|
||||||
OUTPUT_FILE ${DTSPath}
|
OUTPUT_FILE ${DTSPath}
|
||||||
|
RESULT_VARIABLE error
|
||||||
)
|
)
|
||||||
|
if(error)
|
||||||
|
message(FATAL_ERROR "Failed to convert DTB to DTS (${DTBPath})")
|
||||||
|
endif()
|
||||||
list(APPEND KernelDTSList "${DTSPath}")
|
list(APPEND KernelDTSList "${DTSPath}")
|
||||||
list(APPEND KernelDTSList "src/plat/qemu-arm-virt/overlay-qemu-arm-virt.dts")
|
list(APPEND KernelDTSList "src/plat/qemu-arm-virt/overlay-qemu-arm-virt.dts")
|
||||||
if(KernelArmHypervisorSupport)
|
if(KernelArmHypervisorSupport)
|
||||||
|
|||||||
Reference in New Issue
Block a user