SCRIPTPATH=$(dirname ${SCRIPT})
source ${SCRIPTPATH}/hvk-common.sh
+DEPLOYDIR=rootfs
+ARCHIVE=kernel.tar.xz
+
print_usage()
{
echo "${PROG_NAME} -- U-Boot/kernel compile script"
echo " -h display this help and exit"
echo " -r reboot after deploying files"
echo " -w compile with W=1"
+ echo " -z create archive"
echo
}
reboot=0
warnings_opts=""
+archive=0
-while getopts "hrw" flag ;do
+while getopts "hrwz" flag ;do
case ${flag} in
h)
print_usage
w)
warnings_opts="W=1"
;;
+ z)
+ archive=1
+ ;;
?)
echo "${PROG_NAME}: Invalid option: ${OPTARG}."
echo "Try \`${PROG_NAME} -h' for more information."
EVK_IP="${1}"
fi
+if [ "${reboot}" = "1" -a "${archive}" = "1" ]; then
+ echo "${PROG_NAME}: You must specify only one of \"-r\" or \"-z\" option"
+ echo "Try \`${PROG_NAME} -h' for more information."
+ exit 1
+fi
+
if [ ! -f .config ]; then
echo "Missing configuration file .config."
echo "Configure your kernel by running 'hvk-init.sh'"
${KMAKE} u-boot-initial-env
fi
-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
+function rootfs_install() {
+ rm -rf ${DEPLOYDIR}/lib
+ mkdir -p ${DEPLOYDIR}
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
+ ${KMAKE} INSTALL_MOD_PATH=${DEPLOYDIR} modules_install
+ fi
- scp /tmp/modules.tar.gz root@${EVK_IP}:/tmp
+ mkdir -p ${DEPLOYDIR}/boot
- ssh root@${EVK_IP} "cd /lib && tar -xf /tmp/modules.tar.gz"
- rm /tmp/modules.tar.gz
- fi
+ cp ${BOOT_SRC}/Image ${DEPLOYDIR}/boot/Image-latest
+ cp ${DTB_SRC} ${DEPLOYDIR}/boot/latest.dtb
+}
+
+function rootfs_archive() {
+ pushd ${DEPLOYDIR}
+ tar cf - * | xz > ../${ARCHIVE}
+ popd
+}
+
+if [ "${archive}" = "1" ]; then
+ rootfs_install
+ rootfs_archive
+fi
+
+if [ "${EVK_IP}" != "" ]; then
+ rootfs_install
+ rootfs_archive
+
+ scp ${ARCHIVE} root@${EVK_IP}:/tmp
+ ssh root@${EVK_IP} "cd / && tar -xf /tmp/${ARCHIVE}"
# Determine if using extlinux on target:
ssh -q root@${EVK_IP} [[ -f /boot/extlinux/extlinux.conf ]] && EXTLINUX=1 || EXTLINUX=0;