hvk: add option to specify deploy folder
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 9 Oct 2024 16:07:13 +0000 (12:07 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 9 Oct 2024 16:07:24 +0000 (12:07 -0400)
Can be usefull when deploying to local NFS server, for example.

scripts/hvk-compile.sh

index cdc4470..b915b87 100755 (executable)
@@ -14,6 +14,7 @@ print_usage()
     echo "Usage: ${PROG_NAME} [OPTIONS...] [IP ADDRESS]"
     echo
     echo "Options:"
+    echo "  -f   deploy folder (default is ./rootfs)"
     echo "  -h   display this help and exit"
     echo "  -r   reboot after deploying files"
     echo "  -w   compile with W=1"
@@ -24,13 +25,17 @@ print_usage()
 reboot=0
 warnings_opts=""
 archive=0
+deploydir=${DEPLOYDIR}
 
-while getopts "hrwz" flag ;do
+while getopts "f:hrwz" flag ;do
     case ${flag} in
        h)
            print_usage
             exit 0
            ;;
+       f)
+            deploydir=${OPTARG}
+           ;;
        r)
             reboot=1
            ;;
@@ -97,21 +102,20 @@ elif [ x"${mode}" = x"uboot" ]; then
 fi
 
 function rootfs_install() {
-    rm -rf ${DEPLOYDIR}/lib
-    mkdir -p ${DEPLOYDIR}
+    mkdir -p ${deploydir}
 
     if [ x"${CONFIG_MODULES}" = x"1" ]; then
-        ${KMAKE} INSTALL_MOD_PATH=${DEPLOYDIR} modules_install
+        ${KMAKE} INSTALL_MOD_PATH=${deploydir} modules_install
     fi
 
-    mkdir -p ${DEPLOYDIR}/boot
+    mkdir -p ${deploydir}/boot
 
-    cp ${BOOT_SRC}/Image ${DEPLOYDIR}/boot/Image-latest
-    cp ${DTB_SRC}        ${DEPLOYDIR}/boot/latest.dtb
+    cp ${BOOT_SRC}/Image ${deploydir}/boot/Image-latest
+    cp ${DTB_SRC}        ${deploydir}/boot/latest.dtb
 }
 
 function rootfs_archive() {
-    pushd ${DEPLOYDIR}
+    pushd ${deploydir}
     tar cf - * | xz > ../${ARCHIVE}
     popd
 }