Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: avoid using bash and output redirection #42

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/Arm/vm_minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ if("${KernelARMPlatform}" STREQUAL "tk1")
add_custom_command(
OUTPUT linux/linux-dtb
COMMAND
bash -c
"which dtc && dtc -I dts -O dtb ${CAMKES_ARM_LINUX_DIR}/${device_tree_src} > linux/linux-dtb"
dtc -I dts -O dtb -o linux/linux-dtb ${CAMKES_ARM_LINUX_DIR}/${device_tree_src}
Comment on lines -35 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anyone know why the which was in there? Is there a danger that there might be multiple dtc commands on the same system and we can get the wrong one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is, it is a smart trick to fail if the dtc program is missing. Because the output redirectection may just produce an empty file, but no error in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right that makes sense. And we would now also fail, so the behaviour is preserved. Happy with that.

VERBATIM
DEPENDS ${CAMKES_ARM_LINUX_DIR}/${device_tree_src}
)
Expand Down Expand Up @@ -150,7 +149,8 @@ elseif("${KernelARMPlatform}" STREQUAL "zcu102")

add_custom_command(
OUTPUT linux/linux-dtb
COMMAND bash -c "which dtc && dtc -q -I dts -O dtb ${dts_file} > linux/linux-dtb"
COMMAND
dtc -q -I dts -O dtb -o linux/linux-dtb ${dts_file}
VERBATIM
DEPENDS ${dts_file}
)
Expand Down