From 82975f96c5bbed2759b0e579a964ff1ad24ceb0a Mon Sep 17 00:00:00 2001 From: Peter Mayo Date: Tue, 1 May 2012 11:03:31 -0400 Subject: [PATCH] Add root growth option. This allows us to specify a boost size where we know we are growing Chrome, but don't know what the default sizes are, nor whether we are overriding them elsewise. BUG=chromium-os:29829 TEST=try(lumpy-chrome-pfq,lumpy-canary) Change-Id: I3b7c927874fdfedace027e7a2398d9e97a9d3527 Reviewed-on: https://gerrit.chromium.org/gerrit/21519 Reviewed-by: Mike Frysinger Reviewed-by: David James Commit-Ready: Peter Mayo Tested-by: Peter Mayo --- build_image | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/build_image b/build_image index fc6dd05c57..bf077bf4bc 100755 --- a/build_image +++ b/build_image @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -29,6 +29,8 @@ DEFINE_integer rootfs_partition_size 1024 \ "rootfs partition size in MiBs." DEFINE_integer rootfs_size 850 \ "rootfs filesystem size in MiBs." +DEFINE_integer rootfs_boost_size 0 \ + "MiBs by which to increase the rootfs allocations." DEFINE_boolean standard_backdoor ${FLAGS_TRUE} \ "Install standard backdoor credentials for testing" DEFINE_integer statefulfs_size 1024 \ @@ -103,6 +105,27 @@ OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos" . "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 parse_build_image_args + +# Tweak sizes defaulted or given based on any boost given (or defaulted). +# This is syntactic sugar to separate concerns in callers, and unify +# default values here. +if [[ $FLAGS_rootfs_boost_size -gt 0 ]]; then + max() { + echo $(( $1 > $2 ? $1 : $2 )) + } + root_boost() { + echo $(( $1 + ( $1 * $FLAGS_rootfs_boost_size + $FLAGS_rootfs_size - 1 ) \ + / $FLAGS_rootfs_size )) + } + FLAGS_rootfs_hash_pad=$(root_boost $FLAGS_rootfs_hash_pad) + FLAGS_rootfs_partition_size=$(root_boost $FLAGS_rootfs_partition_size) + FLAGS_rootfs_size=$(root_boost $FLAGS_rootfs_size) + FLAGS_rootfs_boost_size=0 + # Push up to the recommended minimum if we did not get there. + FLAGS_rootfs_hash_pad=$(max $FLAGS_rootfs_hash_pad \ + $(( ( $FLAGS_rootfs_size + 99 ) / 100 ))) +fi + # Tweak flags, configure extra USE flags, and add packages for the factory # install shim. EXTRA_PACKAGES=""