Add the enable_rootfs_verification flag to cros_download_latest_image.

BUG=chromium-os:10993
TEST=Downloaded a latest image via cros_download_latest_image with
rootfs verification enabled and disabled; confirmed that the results
were as expected.

Change-Id: I489a20452bd29ac13fa45fec66214a045086634d
Reviewed-on: http://gerrit.chromium.org/gerrit/10405
Reviewed-by: Zelidrag Hornung <zelidrag@chromium.org>
Commit-Ready: Rahul Chaturvedi <rkc@chromium.org>
Tested-by: Rahul Chaturvedi <rkc@chromium.org>
This commit is contained in:
Rahul Chaturvedi 2011-10-20 16:44:25 +05:30 committed by Gerrit
parent 4c90853861
commit 1e4d0c0b3d

View File

@ -33,6 +33,8 @@ get_default_board
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \
"The name of the board to check for images." "The name of the board to check for images."
DEFINE_boolean incremental "$FLAGS_FALSE" "Download incremental build" DEFINE_boolean incremental "$FLAGS_FALSE" "Download incremental build"
DEFINE_boolean enable_rootfs_verification "${FLAGS_TRUE}" \
"Enable rootfs verification for the downloaded image."
# Parse command line flags. # Parse command line flags.
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -66,5 +68,30 @@ if [ ! -e $LATEST_IMAGE_DIR/chromiumos_base_image.bin ]; then
|| die "Could not unzip image.zip" || die "Could not unzip image.zip"
fi fi
IMAGE_NAME=chromiumos_qemu_image.bin
IMAGE_FILE="${LATEST_IMAGE_DIR}"/"${IMAGE_NAME}"
ESP_DIR="${LATEST_IMAGE_DIR}/esp"
cleanup() {
"$SCRIPTS_DIR/mount_gpt_image.sh" -u -e "${ESP_DIR}"
}
# This might seem a bit strange, but rootfs verification is already on with the
# image, the only reason we've named this flag 'enable_rootfs_verfication'
# versus 'disable_xyz' is to stay constant with the
# 'noenable_rootfs_verification' flag used in build image to disable it.
if [ "${FLAGS_enable_rootfs_verification}" -eq "${FLAGS_FALSE}" ] ; then
trap cleanup INT TERM EXIT
# We only need to touch the ESP part
"$SCRIPTS_DIR/mount_gpt_image.sh" -i chromiumos_qemu_image.bin \
-f "${LATEST_IMAGE_DIR}" -e "${ESP_DIR}"
# Change the default to boot from the usb instead of vusb, usb is set
# to boot from /dev/sda
sudo sed -i -e 's/vusb/usb/g' "${ESP_DIR}/syslinux/default.cfg"
sync; sync
fi
echo $LATEST_IMAGE_DIR echo $LATEST_IMAGE_DIR
exit 0 exit 0