serial-refactor: Move kernelDTSList to arm
Currently dts support is only for arm so makes sense to move into arm config.cmake. Will eventually add RISC-V to the dts list too.
This commit is contained in:
parent
51aec8221f
commit
282d6a902c
2 changed files with 39 additions and 42 deletions
|
|
@ -276,48 +276,6 @@ add_custom_target(xml_headers_target DEPENDS ${xml_headers})
|
|||
add_dependencies(kernel_headers xml_headers_target)
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen_headers")
|
||||
|
||||
if (DEFINED KernelDTSList)
|
||||
find_program(DTC_TOOL dtc)
|
||||
if ("${DTC_TOOL}" STREQUAL "DTC_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'dtc' program.")
|
||||
endif()
|
||||
|
||||
foreach(entry ${KernelDTSList})
|
||||
get_absolute_source_or_binary(dts_tmp ${entry})
|
||||
list(APPEND dts_list ${dts_tmp})
|
||||
endforeach()
|
||||
|
||||
# Generate final DTS based on Linux DTS + seL4 overlay[s]
|
||||
set(KernelDTSIntermediate "kernel.dts")
|
||||
add_custom_command(OUTPUT ${KernelDTSIntermediate}
|
||||
COMMAND cat ${dts_list} > "${KernelDTSIntermediate}"
|
||||
COMMENT "Generate kernel DTS"
|
||||
DEPENDS ${dts_list})
|
||||
|
||||
# Compile DTS to DTB
|
||||
set(KernelDTBPath "kernel.dtb")
|
||||
add_custom_command(OUTPUT ${KernelDTBPath}
|
||||
COMMAND ${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
|
||||
DEPENDS ${KernelDTSIntermediate})
|
||||
|
||||
# Generate devices_gen header based on DTB
|
||||
set(device_dest "gen_headers/plat/machine/devices_gen.h")
|
||||
set(config_file "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware.yml")
|
||||
set(config_schema "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware_schema.yml")
|
||||
add_custom_command(OUTPUT ${device_dest}
|
||||
COMMAND ${PYTHON} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --output "${device_dest}" --config "${config_file}" --schema "${config_schema}"
|
||||
DEPENDS "${HARDWARE_GEN_PATH}" "${KernelDTBPath}" "${config_file}" "${config_schema}"
|
||||
COMMENT "Generate hardware description"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Construct target for the generated hardware header
|
||||
add_custom_target(hardware_gen_target DEPENDS "${device_dest}")
|
||||
# Add the hardware header to all the kernel headers
|
||||
add_dependencies(kernel_headers hardware_gen_target)
|
||||
list(APPEND gen_files_list "${device_dest}")
|
||||
endif()
|
||||
|
||||
#######################
|
||||
# Prune list generation
|
||||
#######################
|
||||
|
|
|
|||
|
|
@ -96,6 +96,45 @@ include(src/plat/tx2/config.cmake)
|
|||
include(src/plat/zynq7000/config.cmake)
|
||||
include(src/plat/zynqmp/config.cmake)
|
||||
|
||||
if (DEFINED KernelDTSList)
|
||||
set(KernelDTSIntermediate "${CMAKE_CURRENT_BINARY_DIR}/kernel.dts")
|
||||
set(KernelDTBPath "${CMAKE_CURRENT_BINARY_DIR}/kernel.dtb")
|
||||
set(device_dest "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/devices_gen.h")
|
||||
set(config_file "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware.yml")
|
||||
set(config_schema "${CMAKE_CURRENT_SOURCE_DIR}/tools/hardware_schema.yml")
|
||||
|
||||
find_program(DTC_TOOL dtc)
|
||||
if ("${DTC_TOOL}" STREQUAL "DTC_TOOL-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find 'dtc' program.")
|
||||
endif()
|
||||
|
||||
foreach(entry ${KernelDTSList})
|
||||
get_absolute_source_or_binary(dts_tmp ${entry})
|
||||
set(dts_list "${dts_list} ${dts_tmp}")
|
||||
endforeach()
|
||||
|
||||
# Generate final DTS based on Linux DTS + seL4 overlay[s]
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/"
|
||||
)
|
||||
execute_process(
|
||||
COMMAND bash -c "cat ${dts_list} > ${KernelDTSIntermediate}"
|
||||
)
|
||||
|
||||
# Compile DTS to DTB
|
||||
execute_process(
|
||||
COMMAND ${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
|
||||
)
|
||||
|
||||
# Generate devices_gen header based on DTB
|
||||
execute_process(
|
||||
COMMAND ${PYTHON} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --output "${device_dest}" --config "${config_file}" --schema "${config_schema}"
|
||||
OUTPUT_VARIABLE compatibility_strings
|
||||
)
|
||||
|
||||
include(src/drivers/serial/config.cmake)
|
||||
endif()
|
||||
|
||||
# Now enshrine all the common variables in the config
|
||||
config_set(KernelArmCortexA7 ARM_CORTEX_A7 "${KernelArmCortexA7}")
|
||||
config_set(KernelArmCortexA8 ARM_CORTEX_A8 "${KernelArmCortexA8}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue