J. Richard Barnette | 8447777 | 2011-07-25 13:41:33 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 2 | |
Darin Petkov | 61173f6 | 2011-04-29 10:24:26 -0700 | [diff] [blame] | 3 | # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | # Script to build a bootable keyfob-based chromeos system image from within |
| 8 | # a chromiumos setup. This assumes that all needed packages have been built into |
| 9 | # the given target's root with binary packages turned on. This script will |
| 10 | # build the Chrome OS image using only pre-built binary packages. |
| 11 | |
J. Richard Barnette | 8447777 | 2011-07-25 13:41:33 -0700 | [diff] [blame] | 12 | SCRIPT_ROOT=$(dirname "$0") |
| 13 | . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 14 | |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 15 | |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 16 | DEFINE_string board "${DEFAULT_BOARD}" \ |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 17 | "The board to build an image for." |
| 18 | DEFINE_string build_root "/build" \ |
| 19 | "The root location for board sysroots." |
| 20 | DEFINE_integer build_attempt 1 \ |
| 21 | "The build attempt for this image build." |
| 22 | DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ |
| 23 | "Directory in which to place image result directories (named by version)" |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 24 | DEFINE_boolean replace ${FLAGS_FALSE} \ |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 25 | "Overwrite existing output, if any." |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 26 | DEFINE_boolean withdev ${FLAGS_TRUE} \ |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 27 | "Include useful developer friendly utilities in the image." |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 28 | DEFINE_integer jobs -1 \ |
| 29 | "How many packages to build in parallel at maximum." |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 30 | DEFINE_boolean statefuldev ${FLAGS_TRUE} \ |
Chris Sosa | 4bffb8b | 2010-04-07 17:23:54 -0700 | [diff] [blame] | 31 | "Install development packages on stateful partition rather than the rootfs" |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 32 | DEFINE_boolean test ${FLAGS_FALSE} \ |
Hung-Te Lin | 54a83b7 | 2011-06-30 12:00:55 +0800 | [diff] [blame] | 33 | "Modify the image for automated testing" |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 34 | DEFINE_boolean factory ${FLAGS_FALSE} \ |
| 35 | "Modify the image for manufacturing testing" |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 36 | DEFINE_boolean factory_install ${FLAGS_FALSE} \ |
Tom Wai-Hong Tam | f87a367 | 2010-05-17 16:06:33 +0800 | [diff] [blame] | 37 | "Build a smaller image to overlay the factory install shim on; this argument \ |
| 38 | is also required in image_to_usb." |
Zelidrag Hornung | 1d12c1a | 2010-06-02 10:20:29 -0700 | [diff] [blame] | 39 | DEFINE_integer rootfs_partition_size 1024 \ |
Will Drewry | d253bad | 2010-08-17 14:09:41 -0500 | [diff] [blame] | 40 | "rootfs partition size in MiBs." |
Andrew de los Reyes | 0eb6d76 | 2010-11-01 18:27:53 -0700 | [diff] [blame] | 41 | DEFINE_integer rootfs_size 850 \ |
Will Drewry | d253bad | 2010-08-17 14:09:41 -0500 | [diff] [blame] | 42 | "rootfs filesystem size in MiBs." |
Will Drewry | 78992a3 | 2010-07-21 14:02:20 -0500 | [diff] [blame] | 43 | # ceil(0.1 * rootfs_size) is a good minimum. |
| 44 | DEFINE_integer rootfs_hash_pad 8 \ |
Will Drewry | d253bad | 2010-08-17 14:09:41 -0500 | [diff] [blame] | 45 | "MiBs reserved at the end of the rootfs image." |
Eric Li | 5cf288f | 2010-06-28 12:46:26 -0700 | [diff] [blame] | 46 | DEFINE_integer statefulfs_size 1024 \ |
Will Drewry | d253bad | 2010-08-17 14:09:41 -0500 | [diff] [blame] | 47 | "stateful filesystem size in MiBs." |
David James | 0366864 | 2010-07-28 17:08:29 -0700 | [diff] [blame] | 48 | DEFINE_boolean fast ${DEFAULT_FAST} \ |
| 49 | "Call many emerges in parallel" |
Will Drewry | 32d8c11 | 2010-10-11 15:37:17 -0500 | [diff] [blame] | 50 | DEFINE_string boot_args "noinitrd" \ |
| 51 | "Additional boot arguments to pass to the commandline" |
Nick Sanders | f2dee6c | 2010-07-01 00:21:32 -0700 | [diff] [blame] | 52 | |
Will Drewry | 4a675e1 | 2010-07-03 13:35:02 -0500 | [diff] [blame] | 53 | DEFINE_string usb_disk /dev/sdb3 \ |
| 54 | "Path syslinux should use to do a usb boot. Default: /dev/sdb3" |
| 55 | |
Will Drewry | 12f14ce | 2010-08-17 17:27:16 -0500 | [diff] [blame] | 56 | DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ |
Will Drewry | 1670d48 | 2010-07-09 13:08:38 -0700 | [diff] [blame] | 57 | "Default all bootloaders to use kernel-based root fs integrity checking." |
Will Drewry | d07f61d | 2011-01-12 10:39:54 -0600 | [diff] [blame] | 58 | DEFINE_integer verity_error_behavior 3 \ |
Will Drewry | 137eab6 | 2010-11-04 22:06:41 -0500 | [diff] [blame] | 59 | "Kernel verified boot error behavior (0: I/O errors, 1: panic, 2: nothing, \ |
Will Drewry | d07f61d | 2011-01-12 10:39:54 -0600 | [diff] [blame] | 60 | 3: cros) Default: 3" |
Will Drewry | 52c40f8 | 2010-10-06 14:54:38 -0500 | [diff] [blame] | 61 | DEFINE_integer verity_max_ios -1 \ |
| 62 | "Number of outstanding I/O operations dm-verity caps at. Default: -1" |
Will Drewry | 1670d48 | 2010-07-09 13:08:38 -0700 | [diff] [blame] | 63 | DEFINE_string verity_algorithm "sha1" \ |
| 64 | "Cryptographic hash algorithm used for kernel vboot. Default : sha1" |
David Rochberg | cf93237 | 2011-06-30 21:25:08 -0400 | [diff] [blame] | 65 | DEFINE_boolean standard_backdoor ${FLAGS_TRUE} \ |
| 66 | "Install standard backdoor credentials for testing" |
David James | 4dd4c54 | 2011-08-10 10:19:47 -0700 | [diff] [blame] | 67 | DEFINE_string symlink "latest" \ |
| 68 | "Symlink name to use for this image." |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 69 | |
Che-Liang Chiou | 611d5b7 | 2011-07-27 16:03:26 +0800 | [diff] [blame] | 70 | # TODO(clchiou): Remove this flag after buildbot is fixed |
| 71 | DEFINE_boolean crosbug12352_arm_kernel_signing ${FLAGS_TRUE} \ |
| 72 | "A dummy this flag for preventing buildbot fail" |
| 73 | |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 74 | # Parse command line. |
| 75 | FLAGS "$@" || exit 1 |
| 76 | eval set -- "${FLAGS_ARGV}" |
| 77 | |
| 78 | # Only now can we die on error. shflags functions leak non-zero error codes, |
| 79 | # so will die prematurely if 'set -e' is specified before now. |
| 80 | set -e |
| 81 | |
J. Richard Barnette | e4e3dec | 2011-08-08 16:35:02 -0700 | [diff] [blame] | 82 | # Determine build version. |
| 83 | OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos" |
| 84 | . "${OVERLAY_CHROMEOS_DIR}/config/chromeos_version.sh" || exit 1 |
| 85 | |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 86 | # N.B. Ordering matters for some of the libraries below, because |
| 87 | # some of the files contain initialization used by later files. |
J. Richard Barnette | aaef761 | 2011-08-11 17:10:28 -0700 | [diff] [blame] | 88 | . "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1 |
| 89 | . "${BUILD_LIBRARY_DIR}/build_gpt.sh" || exit 1 |
J. Richard Barnette | 5f9dbe4 | 2011-08-22 14:31:33 -0700 | [diff] [blame] | 90 | . "${BUILD_LIBRARY_DIR}/mount_gpt_util.sh" || exit 1 |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 91 | . "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1 |
| 92 | . "${BUILD_LIBRARY_DIR}/base_image_util.sh" || exit 1 |
| 93 | . "${BUILD_LIBRARY_DIR}/dev_image_util.sh" || exit 1 |
| 94 | . "${BUILD_LIBRARY_DIR}/test_image_util.sh" || exit 1 |
J. Richard Barnette | aaef761 | 2011-08-11 17:10:28 -0700 | [diff] [blame] | 95 | . "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 |
J. Richard Barnette | e4e3dec | 2011-08-08 16:35:02 -0700 | [diff] [blame] | 96 | |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 97 | # Look at flags to determine which image types we should build |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 98 | if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 99 | if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 100 | info "Incompatible flags: --factory and --factory_install cannot both be \ |
| 101 | set to True. Resetting --factory to False." |
| 102 | FLAGS_factory=${FLAGS_FALSE} |
| 103 | fi |
| 104 | if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then |
| 105 | info "Incompatible flags: --test and --factory_install cannot both be \ |
| 106 | set to True. Resetting --test to False." |
| 107 | FLAGS_test=${FLAGS_FALSE} |
| 108 | fi |
Vince Laviano | 96d116d | 2011-03-17 11:32:07 -0700 | [diff] [blame] | 109 | # Disable --withdev flag when --factory_install is set to True. Otherwise, the |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 110 | # dev image produced will be based on install shim, rather than a pristine |
| 111 | # image |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 112 | if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
Vince Laviano | 96d116d | 2011-03-17 11:32:07 -0700 | [diff] [blame] | 113 | info "Incompatible flags: --withdev and --factory_install cannot both be \ |
| 114 | set to True. Resetting --withdev to False." |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 115 | FLAGS_withdev=${FLAGS_FALSE} |
| 116 | fi |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 117 | fi |
| 118 | if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 119 | if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then |
| 120 | info "Incompatible flags: --factory implies --test. Resetting --test to \ |
| 121 | True." |
| 122 | FLAGS_test=${FLAGS_TRUE} |
| 123 | fi |
| 124 | fi |
| 125 | if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then |
| 126 | if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then |
| 127 | info "Incompatible flags: --test implies --withdev. Resetting --withdev \ |
| 128 | to True." |
| 129 | FLAGS_withdev=${FLAGS_TRUE} |
| 130 | fi |
| 131 | fi |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 132 | |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 133 | # Reduce the size of factory install shim. |
| 134 | if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 135 | # TODO: Build a separated ebuild for the install shim to reduce size. |
| 136 | INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" |
| 137 | |
| 138 | info "Fixing the rootfs size at 300 MiB for install shim" |
| 139 | FLAGS_rootfs_size=280 |
| 140 | FLAGS_rootfs_partition_size=300 |
| 141 | info "Fixing the statefulfs size at 140 MiB for install shim" |
| 142 | FLAGS_statefulfs_size=140 |
| 143 | fi |
| 144 | |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 145 | if [ $((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) -gt \ |
| 146 | ${FLAGS_rootfs_partition_size} ] ; then |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 147 | die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \ |
| 148 | bigger than partition (${FLAGS_rootfs_partition_size} MiB)." |
Tan Gao | 843b70a | 2010-08-17 09:41:48 -0700 | [diff] [blame] | 149 | fi |
| 150 | |
Chris Sosa | 9673f3b | 2010-05-18 13:24:40 -0700 | [diff] [blame] | 151 | # If we are creating a developer image, also create a pristine image with a |
| 152 | # different name. |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 153 | # TODO(vlaviano): fix all image names to match those in uploaded archive |
Chris Sosa | 9673f3b | 2010-05-18 13:24:40 -0700 | [diff] [blame] | 154 | DEVELOPER_IMAGE_NAME= |
| 155 | PRISTINE_IMAGE_NAME=chromiumos_image.bin |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 156 | if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
Chris Sosa | 9673f3b | 2010-05-18 13:24:40 -0700 | [diff] [blame] | 157 | PRISTINE_IMAGE_NAME=chromiumos_base_image.bin |
| 158 | DEVELOPER_IMAGE_NAME=chromiumos_image.bin |
Vince Laviano | 96d116d | 2011-03-17 11:32:07 -0700 | [diff] [blame] | 159 | # Rename pristine image for factory install shim |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 160 | elif [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
Nick Sanders | ae26a5c | 2010-08-30 21:59:50 -0700 | [diff] [blame] | 161 | PRISTINE_IMAGE_NAME=factory_install_shim.bin |
Tan Gao | 843b70a | 2010-08-17 09:41:48 -0700 | [diff] [blame] | 162 | fi |
| 163 | |
David James | 868d7bb | 2010-06-24 21:48:14 -0700 | [diff] [blame] | 164 | PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" |
| 165 | DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}" |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 166 | TEST_IMG="${OUTPUT_DIR}/${CHROMEOS_TEST_IMAGE_NAME}" |
| 167 | FACTORY_IMG="${OUTPUT_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 168 | |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 169 | ROOT_FS_DIR="${OUTPUT_DIR}/rootfs" |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 170 | STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition" |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 171 | ESP_FS_DIR=${OUTPUT_DIR}/esp |
| 172 | |
Will Drewry | 7ab698d | 2010-08-05 13:57:52 -0500 | [diff] [blame] | 173 | DEVKEYSDIR="/usr/share/vboot/devkeys" |
| 174 | |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 175 | # ${DEV_IMAGE_ROOT} specifies the location of where developer packages will |
| 176 | # be installed on the stateful dir. On a Chromium OS system, this will |
| 177 | # translate to /usr/local. |
| 178 | DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image" |
| 179 | |
J. Richard Barnette | 8e48095 | 2011-08-30 16:00:59 -0700 | [diff] [blame] | 180 | eclean-$BOARD -d packages |
Will Drewry | 12f14ce | 2010-08-17 17:27:16 -0500 | [diff] [blame] | 181 | |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 182 | check_blacklist |
| 183 | |
| 184 | # Check that the build root is sane. |
| 185 | "${BUILD_LIBRARY_DIR}/test_build_root" --root="${BOARD_ROOT}" |
| 186 | |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 187 | # Hack to fix bug where x86_64 CHOST line gets incorrectly added. |
| 188 | # ToDo(msb): remove this hack. |
| 189 | PACKAGES_FILE="${BOARD_ROOT}/packages/Packages" |
| 190 | sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}" |
| 191 | |
| 192 | # Handle existing directory. |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 193 | if [[ -e "${OUTPUT_DIR}" ]]; then |
| 194 | if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then |
| 195 | sudo rm -rf "${OUTPUT_DIR}" |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 196 | else |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 197 | echo "Directory ${OUTPUT_DIR} already exists." |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 198 | echo "Use --build_attempt option to specify an unused attempt." |
| 199 | echo "Or use --replace if you want to overwrite this directory." |
| 200 | exit 1 |
| 201 | fi |
| 202 | fi |
| 203 | |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 204 | # Create the output directory and temporary mount points. |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 205 | mkdir -p "${OUTPUT_DIR}" |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 206 | mkdir -p "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}" |
Don Garrett | 3f41e15 | 2010-06-21 14:54:34 -0700 | [diff] [blame] | 207 | |
Will Drewry | 7ab698d | 2010-08-05 13:57:52 -0500 | [diff] [blame] | 208 | # Create the boot.desc file which stores the build-time configuration |
| 209 | # information needed for making the image bootable after creation with |
| 210 | # cros_make_image_bootable. |
| 211 | create_boot_desc |
| 212 | |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 213 | create_base_image "$PRISTINE_IMAGE_NAME" |
Tan Gao | 843b70a | 2010-08-17 09:41:48 -0700 | [diff] [blame] | 214 | |
Will Drewry | 4a675e1 | 2010-07-03 13:35:02 -0500 | [diff] [blame] | 215 | |
Che-Liang Chiou | e51bdf2 | 2011-07-26 21:19:24 +0800 | [diff] [blame] | 216 | BOOT_FLAG= |
| 217 | if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
| 218 | BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h |
| 219 | info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to \ |
Vince Laviano | 96d116d | 2011-03-17 11:32:07 -0700 | [diff] [blame] | 220 | load_kernel_test" |
Che-Liang Chiou | 451f36e | 2011-07-21 19:53:37 +0800 | [diff] [blame] | 221 | fi |
Che-Liang Chiou | 2d2e825 | 2011-06-18 17:38:59 -0700 | [diff] [blame] | 222 | |
Che-Liang Chiou | e51bdf2 | 2011-07-26 21:19:24 +0800 | [diff] [blame] | 223 | # Verify the final image. |
| 224 | load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ |
| 225 | "${DEVKEYSDIR}/recovery_key.vbpubk" ${BOOT_FLAG} |
| 226 | |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 227 | # Create a developer image based on the chromium os base image. |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 228 | if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
| 229 | copy_image "$PRISTINE_IMG" "$DEVELOPER_IMG" |
| 230 | install_dev_packages "$DEVELOPER_IMAGE_NAME" |
Bill Richardson | 6ed1358 | 2010-06-16 21:38:15 -0700 | [diff] [blame] | 231 | fi |
| 232 | |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 233 | # Create a test or factory test image if desired |
Hung-Te Lin | f7f8cd8 | 2011-08-31 16:18:15 +0800 | [diff] [blame] | 234 | if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 235 | copy_image "$DEVELOPER_IMG" "$FACTORY_IMG" |
| 236 | mod_image_for_test "${FACTORY_IMG}" |
| 237 | elif [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then |
J. Richard Barnette | a308b39 | 2011-08-29 13:53:34 -0700 | [diff] [blame] | 238 | copy_image "$DEVELOPER_IMG" "$TEST_IMG" |
| 239 | mod_image_for_test "${TEST_IMG}" |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 240 | fi |
| 241 | |
Dmitry Polukhin | 0a649b5 | 2011-02-24 13:02:52 +0300 | [diff] [blame] | 242 | rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}" |
Bill Richardson | 6795622 | 2010-05-28 15:38:56 -0700 | [diff] [blame] | 243 | |
Raja Aluri | aeb1048 | 2010-12-10 13:03:09 -0800 | [diff] [blame] | 244 | # Generating AU generator zip file to run outside chroot |
| 245 | generate_au_zip || echo "Failed generating AU zip file - ignoring Error..." |
David James | 4dd4c54 | 2011-08-10 10:19:47 -0700 | [diff] [blame] | 246 | |
| 247 | # Create a named symlink. |
| 248 | LINK_NAME="${FLAGS_output_root}/${BOARD}/${FLAGS_symlink}" |
| 249 | ln -sfT $(basename ${OUTPUT_DIR}) ${LINK_NAME} |
Olof Johansson | 58f25cc | 2010-08-04 21:18:49 -0700 | [diff] [blame] | 250 | |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 251 | echo "Done. Image created in ${OUTPUT_DIR}" |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 252 | echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" |
J. Richard Barnette | eb5246f | 2011-04-08 10:34:31 -0700 | [diff] [blame] | 253 | if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
Don Garrett | e0020b1 | 2010-06-17 15:55:35 -0700 | [diff] [blame] | 254 | echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
Chris Sosa | 9673f3b | 2010-05-18 13:24:40 -0700 | [diff] [blame] | 255 | fi |
Vince Laviano | 6aebf31 | 2011-06-01 15:27:31 -0700 | [diff] [blame] | 256 | if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 257 | echo "Factory test image created as ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" |
| 258 | elif [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then |
| 259 | echo "Test image created as ${CHROMEOS_TEST_IMAGE_NAME}" |
| 260 | fi |
Nick Sanders | 8ab729a | 2010-06-16 03:15:17 -0700 | [diff] [blame] | 261 | |
Nick Sanders | d250927 | 2010-06-16 03:50:04 -0700 | [diff] [blame] | 262 | print_time_elapsed |
| 263 | |
Hung-Te Lin | 2ffe2be | 2010-10-05 08:15:40 +0800 | [diff] [blame] | 264 | echo "To copy to USB keyfob, do something like:" |
Daniel Erat | dd9818a | 2010-04-26 09:16:44 -0700 | [diff] [blame] | 265 | echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 266 | echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
Olof Johansson | 1f5e84d | 2010-08-24 20:26:49 -0500 | [diff] [blame] | 267 | echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
Bill Richardson | c09b94f | 2010-03-15 11:40:30 -0700 | [diff] [blame] | 268 | echo "from the scripts directory where you entered the chroot." |