hvk: variables cleanup/reorganisation
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 24 Oct 2024 21:11:48 +0000 (17:11 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 25 Oct 2024 15:53:20 +0000 (11:53 -0400)
scripts/hvk-common.sh
scripts/hvk-compile.sh
scripts/hvk-debug.sh
scripts/hvk-dt.sh

index df6e5f3..46653d6 100644 (file)
@@ -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()
index 11bf19a..d8143c2 100755 (executable)
@@ -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() {
index 298b6fe..edfb2f3 100755 (executable)
@@ -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
index 98c3b80..6009f29 100755 (executable)
@@ -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"