Update AC_CONFIG_SRCDIR after scripts/vs removal
[hvutilities.git] / scripts / hvk-compile.sh
index f9076d3..f2b6cab 100755 (executable)
@@ -48,6 +48,10 @@ if [ $# -gt 1 ]; then
     exit 1
 fi
 
+if [ ${#} -eq 1 ]; then
+    EVK_IP="${1}"
+fi
+
 if [ ! -f .config ]; then
     echo "Missing configuration file .config."
     echo "Configure your kernel by running 'hvk-init.sh'"
@@ -56,11 +60,19 @@ fi
 
 KMAKE="${KMAKE} ${warnings_opts}"
 
+if grep -q '^CONFIG_MODULES=y' .config; then
+    CONFIG_MODULES=1
+else
+    CONFIG_MODULES=0
+fi
+
 ${KMAKE}
 
 if [ x"${mode}" = x"linux" ]; then
-    ${KMAKE} modules_prepare
-    ${KMAKE} modules
+    if [ x"${CONFIG_MODULES}" = x"1" ]; then
+        ${KMAKE} modules_prepare
+        ${KMAKE} modules
+    fi
 
     if [ x"${DTB_SRC}" != x"" ]; then
         ${KMAKE} dtbs
@@ -69,26 +81,31 @@ elif [ x"${mode}" = x"uboot" ]; then
     ${KMAKE} u-boot-initial-env
 fi
 
-if [ ${#} -eq 1 ]; then
-    EVK_IP="${1}"
-
+if [ "${EVK_IP}" != "" ]; then
     scp ${BOOT_SRC}/Image root@${EVK_IP}:${BOOT_DEST}/Image-latest
 
     scp ${DTB_SRC} root@${EVK_IP}:${BOOT_DEST}/latest.dtb
 
-    rm -rf modules-tmp
-    ${KMAKE} INSTALL_MOD_PATH=modules-tmp modules_install
-    pushd modules-tmp/lib/
-    tar cf - modules/* | gzip -9 > /tmp/modules.tar.gz
-    popd
+    if [ x"${CONFIG_MODULES}" = x"1" ]; then
+        rm -rf modules-tmp
+        ${KMAKE} INSTALL_MOD_PATH=modules-tmp modules_install
+        pushd modules-tmp/lib/
+        tar cf - modules/* | gzip -9 > /tmp/modules.tar.gz
+        popd
 
-    scp /tmp/modules.tar.gz root@${EVK_IP}:/tmp
+        scp /tmp/modules.tar.gz root@${EVK_IP}:/tmp
 
-    ssh root@${EVK_IP} "cd /lib && tar -xf /tmp/modules.tar.gz"
-    rm /tmp/modules.tar.gz
+        ssh root@${EVK_IP} "cd /lib && tar -xf /tmp/modules.tar.gz"
+        rm /tmp/modules.tar.gz
+    fi
+
+    # Determine if using extlinux on target:
+    ssh -q root@${EVK_IP} [[ -f /boot/extlinux/extlinux.conf ]] && EXTLINUX=1 || EXTLINUX=0;
 
-    # Switch to latest kernel and DTB:
-    ssh root@${EVK_IP} "sed -i -e 's@^DEFAULT.*@DEFAULT test@' /boot/extlinux/extlinux.conf"
+    if [ "${EXTLINUX}" = "1" ]; then
+        # Switch to latest kernel and DTB:
+        ssh root@${EVK_IP} "sed -i -e 's@^DEFAULT.*@DEFAULT test@' /boot/extlinux/extlinux.conf"
+    fi
 
     if [ x"${reboot}" = x"1" ]; then
         ssh root@${EVK_IP} "reboot"