From 2f6c8b3301eb8844c76956ec83b1b1aff24edebb Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Mon, 19 Jun 2023 11:55:45 -0400 Subject: [PATCH] hvk: add reboot option to compile script --- scripts/hvk-compile.sh | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/scripts/hvk-compile.sh b/scripts/hvk-compile.sh index 11b2ce6..7e6b400 100755 --- a/scripts/hvk-compile.sh +++ b/scripts/hvk-compile.sh @@ -4,6 +4,45 @@ SCRIPT="`readlink -e $0`" SCRIPTPATH=$(dirname ${SCRIPT}) source ${SCRIPTPATH}/hvk-common.sh +print_usage() +{ + echo "${PROG_NAME} -- U-Boot/kernel compile script" + echo "Usage: ${PROG_NAME} [OPTIONS...] [IP ADDRESS]" + echo + echo "Options:" + echo " -h display this help and exit" + echo " -r reboot after deploying files" + echo +} + +reboot=0 + +while getopts "hr" flag ;do + case ${flag} in + h) + print_usage + exit 0 + ;; + r) + reboot=1 + ;; + ?) + echo "${PROG_NAME}: Invalid option: ${OPTARG}." + echo "Try \`${PROG_NAME} -h' for more information." + exit 1 + ;; + esac +done +shift `expr "${OPTIND}" - 1` + +# `$#' now represents the number of arguments after the options. +# `$1' is the first argument, etc. +if [ $# -gt 1 ]; then + echo "${PROG_NAME}: Too many arguments." + echo "Try \`${PROG_NAME} -h' for more information." + exit 1 +fi + ${KMAKE} if [ x"${mode}" = x"linux" ]; then @@ -37,4 +76,8 @@ if [ ${#} -eq 1 ]; then # Switch to latest kernel and DTB: ssh root@${EVK_IP} "fw_setenv image Image-latest; fw_setenv fdt_file latest.dtb" + + if [ x"${reboot}" = x"1" ]; then + ssh root@${EVK_IP} "reboot" + fi fi -- 2.20.1