From 350cbaee647d72b9b20bc7d40c1bf847acc31758 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 24 Oct 2024 17:11:48 -0400 Subject: [PATCH] hvk: variables cleanup/reorganisation --- scripts/hvk-common.sh | 22 ++++++++++++++++++++++ scripts/hvk-compile.sh | 17 ++++++++++++----- scripts/hvk-debug.sh | 2 +- scripts/hvk-dt.sh | 16 +++++++++++++--- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/scripts/hvk-common.sh b/scripts/hvk-common.sh index df6e5f3..46653d6 100644 --- a/scripts/hvk-common.sh +++ b/scripts/hvk-common.sh @@ -42,6 +42,28 @@ case ${DEFCONFIG_BOARD} in ;; esac +if [ "${BOOT_SRC}" = "" ]; then + BOOT_SRC="arch/${ARCH}/boot" +fi + +if [ "${BOOT_DEST}" = "" ]; then + BOOT_DEST="boot/test" +fi + +if [ "${DTS_SRC}" = "" ]; then + # DTS_SUBDIR is empty by default. Can be set to manufacturer subdir, + # for example. + DTS_SRC="arch/${ARCH}/boot/dts/${DTS_SUBDIR}" +fi + +if [ "${IMG_SRC}" = "" ]; then + IMG_SRC="Image" +fi + +if [ "${IMG_DEST}" = "" ]; then + IMG_DEST="Image" +fi + # Arg1: src file # Arg2: destination user@host copy_exec() diff --git a/scripts/hvk-compile.sh b/scripts/hvk-compile.sh index 11bf19a..d8143c2 100755 --- a/scripts/hvk-compile.sh +++ b/scripts/hvk-compile.sh @@ -107,15 +107,22 @@ function rootfs_install() { ${KMAKE} INSTALL_MOD_PATH=${deploydir} modules_install fi - mkdir -p ${deploydir}/boot - rm -rf ${deploydir}/boot/* + mkdir -p ${deploydir}/${BOOT_DEST} + rm -rf ${deploydir}/${BOOT_DEST}/* - cp ${BOOT_SRC}/Image ${deploydir}/boot/Image-latest - cp ${DTB_SRC} ${deploydir}${DTB_DEST} + cp ${BOOT_SRC}/${IMG_SRC} ${deploydir}/${BOOT_DEST}/${IMG_DEST} + DTB_MAIN="" for f in ${DTB_FILES}; do - cp ${f}.dtb ${deploydir}/boot + if [ "${DTB_MAIN}" = "" ]; then + DTB_MAIN="${f}.dtb" + fi + + cp ${DTS_SRC}/${f}.dtb ${deploydir}/${BOOT_DEST}/ done + + # Create symbolic link to main DTB: + ln -s ${DTB_MAIN} ${deploydir}/${BOOT_DEST}/test.dtb } function rootfs_archive() { diff --git a/scripts/hvk-debug.sh b/scripts/hvk-debug.sh index 298b6fe..edfb2f3 100755 --- a/scripts/hvk-debug.sh +++ b/scripts/hvk-debug.sh @@ -50,7 +50,7 @@ ${KMAKE} dtbs ${KMAKE} samples if [ x"${EVK_IP}" != x"" ]; then - scp ${DTB_SRC} root@${EVK_IP}:${DTB_DEST} + scp ${DTB_SRC} root@${EVK_IP}:${BOOT_DEST}/${DTB_DEST} if [ -f samples/rtc-test/rtc-test ]; then scp samples/rtc-test/rtc-test root@${EVK_IP}: fi diff --git a/scripts/hvk-dt.sh b/scripts/hvk-dt.sh index 98c3b80..6009f29 100755 --- a/scripts/hvk-dt.sh +++ b/scripts/hvk-dt.sh @@ -5,12 +5,22 @@ SCRIPTPATH=$(dirname ${SCRIPT}) source ${SCRIPTPATH}/hvk-common.sh if [ x"${DTS_BOARD}" != x"" ]; then - DTB_FILES="${DTB_FILES} ${DTS_BOARD}.dtb" + DTB_FILES="${DTB_FILES} ${DTS_BOARD}" fi -if [ x"${DTB_FILES}" != x"" ]; then +if [ "${DTS_SUBDIR}" != "" ]; then + dts_subdir="${DTS_SUBDIR}/" +fi + +# Add .dtb extension to all DTB files: +dtb_files="" +for f in ${DTB_FILES}; do + dtb_files="${dtb_files} ${dts_subdir}${f}.dtb" +done + +if [ x"${dtb_files}" != x"" ]; then # See https://lore.kernel.org/lkml/20221102214654.axyptitp5kpq3wcq@notapiano/T/ - ${KMAKE} CHECK_DTBS=y ${DTB_FILES} + ${KMAKE} CHECK_DTBS=y ${dtb_files} fi DT_CHECKER="${KMAKE} DT_CHECKER_FLAGS=-m dt_binding_check" -- 2.20.1