From 454c526fda6553589fa3be3f79583b91cb4115c7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 1 Dec 2012 14:18:51 -0500 Subject: [PATCH] build_image: auto-disable bootcache when --noenable_rootfs_verification is used If devs run `./build_image --noenable_rootfs_verification`, they also have to manually specify --noenable_bootcache otherwise the default kicks in. We can make the default logic slightly smarter and only enable bootcache by default if rootfs verification is also enabled. BUG=chromium-os:25441 TEST=`./build_image --board=parrot --enable_rootfs_verification` -> bootcache enabled TEST=`./build_image --board=parrot --noenable_rootfs_verification` -> bootcache disabled TEST=`./build_image --board=parrot` -> bootcache enabled TEST=`./build_image --board=parrot --noenable_bootcache` -> bootcache disabled Change-Id: I97f40c70c045bca294a903ff73e5eff7554617d4 Reviewed-on: https://gerrit.chromium.org/gerrit/39043 Reviewed-by: Paul Taysom Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- build_image | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/build_image b/build_image index b03b6f4726..d6dddd64f6 100755 --- a/build_image +++ b/build_image @@ -32,14 +32,6 @@ DEFINE_boolean standard_backdoor ${FLAGS_TRUE} \ DEFINE_string usb_disk /dev/sdb3 \ "Path syslinux should use to do a usb boot. Default: /dev/sdb3" -FLAGS_bootcache_use_board_default=${FLAGS_TRUE} -case " $* " in - *" --enable_bootcache "*|\ - *" --noenable_bootcache "*) - FLAGS_bootcache_use_board_default=${FLAGS_FALSE} - ;; -esac - FLAGS_HELP="USAGE: build_image [flags] [list of images to build]. This script is used to build a Chromium OS image. Chromium OS comes in many different forms. This scripts can be used to build the following: @@ -77,6 +69,19 @@ DEFINE_string version "" \ # Parse command line. FLAGS "$@" || exit 1 + +# See if we want to default the bootcache flag before we clobber +# the user's command line. We want to default to false if the +# user explicitly disabled rootfs verification otherwise they +# have to manually specify both. +FLAGS_bootcache_use_board_default=${FLAGS_enable_rootfs_verification} +case " $* " in + *" --enable_bootcache "*|\ + *" --noenable_bootcache "*) + FLAGS_bootcache_use_board_default=${FLAGS_FALSE} + ;; +esac + eval set -- "${FLAGS_ARGV}" # Only now can we die on error. shflags functions leak non-zero error codes,