blob: 6dcd9e2c0f60349dfc87a443f40e5d09c870e19c [file] [log] [blame]
Bill Richardsonc09b94f2010-03-15 11:40:30 -07001#!/bin/bash
2
3# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
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
12# Load common constants. This should be the first executable line.
13# The path to common.sh should be relative to your script's location.
14. "$(dirname "$0")/common.sh"
15
Will Drewry4a675e12010-07-03 13:35:02 -050016. "$(dirname "$0")/chromeos-common.sh" # for partoffset
17locate_gpt
18
Bill Richardsonc09b94f2010-03-15 11:40:30 -070019# Script must be run inside the chroot.
Don Garrett640a0582010-05-04 16:54:28 -070020restart_in_chroot_if_needed $*
Bill Richardsonc09b94f2010-03-15 11:40:30 -070021
22get_default_board
23
24# Flags.
Don Garrette0020b12010-06-17 15:55:35 -070025DEFINE_string board "${DEFAULT_BOARD}" \
Bill Richardsonc09b94f2010-03-15 11:40:30 -070026 "The board to build an image for."
27DEFINE_string build_root "/build" \
28 "The root location for board sysroots."
29DEFINE_integer build_attempt 1 \
30 "The build attempt for this image build."
31DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
32 "Directory in which to place image result directories (named by version)"
Don Garrette0020b12010-06-17 15:55:35 -070033DEFINE_boolean replace ${FLAGS_FALSE} \
Bill Richardsonc09b94f2010-03-15 11:40:30 -070034 "Overwrite existing output, if any."
Don Garrette0020b12010-06-17 15:55:35 -070035DEFINE_boolean withdev ${FLAGS_TRUE} \
Bill Richardsonc09b94f2010-03-15 11:40:30 -070036 "Include useful developer friendly utilities in the image."
Don Garrette0020b12010-06-17 15:55:35 -070037DEFINE_boolean installmask ${FLAGS_TRUE} \
Bill Richardsonc09b94f2010-03-15 11:40:30 -070038 "Use INSTALL_MASK to shrink the resulting image."
39DEFINE_integer jobs -1 \
40 "How many packages to build in parallel at maximum."
Don Garrette0020b12010-06-17 15:55:35 -070041DEFINE_boolean statefuldev ${FLAGS_TRUE} \
Chris Sosa4bffb8b2010-04-07 17:23:54 -070042 "Install development packages on stateful partition rather than the rootfs"
Antoine Laboure9e585f2010-04-01 15:57:57 -070043DEFINE_string to "" \
44 "The target image file or device"
Don Garrette0020b12010-06-17 15:55:35 -070045DEFINE_boolean factory_install ${FLAGS_FALSE} \
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +080046 "Build a smaller image to overlay the factory install shim on; this argument \
47is also required in image_to_usb."
robotboyb75eee32010-04-30 09:51:23 -070048DEFINE_string arm_extra_bootargs "" \
49 "Additional command line options to pass to the ARM kernel."
Zelidrag Hornung1d12c1a2010-06-02 10:20:29 -070050DEFINE_integer rootfs_partition_size 1024 \
51 "rootfs parition size in MBs."
52DEFINE_integer rootfs_size 720 \
53 "rootfs filesystem size in MBs."
Eric Li5cf288f2010-06-28 12:46:26 -070054DEFINE_integer statefulfs_size 1024 \
55 "stateful filesystem size in MBs."
David James868d7bb2010-06-24 21:48:14 -070056DEFINE_boolean preserve ${FLAGS_FALSE} \
57 "Attempt to preserve the previous build image if one can be found (unstable, \
58kernel/firmware not updated)"
Nick Sandersf2dee6c2010-07-01 00:21:32 -070059DEFINE_boolean fast ${FLAGS_FALSE} \
60 "Call many emerges in parallel (unstable)"
61
Will Drewry4a675e12010-07-03 13:35:02 -050062DEFINE_string usb_disk /dev/sdb3 \
63 "Path syslinux should use to do a usb boot. Default: /dev/sdb3"
64
65DEFINE_boolean use_vboot ${FLAGS_FALSE} \
66 "Default the bootloaders to booting a verifying kernel. Default: False."
67DEFINE_integer vboot_behavior 2 \
68 "Verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \
69Default: 2"
70DEFINE_integer vboot_depth 1 \
71 "Verified boot hash tree depth. Default: 1"
72DEFINE_integer vboot_max_ios 1024 \
73 "Number of outstanding I/O operations dm-verity caps at. Default: 1024"
74DEFINE_string vboot_algorithm "sha1" \
75 "Cryptographic hash algorithm used for vboot. Default : sha1"
Bill Richardsonc09b94f2010-03-15 11:40:30 -070076
77# Parse command line.
78FLAGS "$@" || exit 1
79eval set -- "${FLAGS_ARGV}"
80
81# Only now can we die on error. shflags functions leak non-zero error codes,
82# so will die prematurely if 'set -e' is specified before now.
83set -e
84
Don Garrette0020b12010-06-17 15:55:35 -070085if [ -z "${FLAGS_board}" ] ; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -070086 error "--board is required."
87 exit 1
88fi
89
Don Garrette0020b12010-06-17 15:55:35 -070090if [ "${FLAGS_rootfs_size}" -gt "${FLAGS_rootfs_partition_size}" ] ; then
Zelidrag Hornung1d12c1a2010-06-02 10:20:29 -070091 error "rootfs (${FLAGS_rootfs_size} MB) is bigger than partition (${FLAGS_rootfs_partition_size} MB)."
92 exit 1
93fi
94
Nick Sanders8ab729a2010-06-16 03:15:17 -070095EMERGE_BOARD_CMD="emerge-${FLAGS_board}"
Nick Sandersf2dee6c2010-07-01 00:21:32 -070096if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
Nick Sanders8ab729a2010-06-16 03:15:17 -070097 echo "Using alternate emerge"
Nick Sandersf2dee6c2010-07-01 00:21:32 -070098 EMERGE_BOARD_CMD="${SCRIPTS_DIR}/parallel_emerge --board=${FLAGS_board}"
Nick Sanders8ab729a2010-06-16 03:15:17 -070099fi
100
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700101# Determine build version.
102. "${SCRIPTS_DIR}/chromeos_version.sh"
103
104# Use canonical path since some tools (e.g. mount) do not like symlinks.
105# Append build attempt to output directory.
106IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
107OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
Don Garrett3f41e152010-06-21 14:54:34 -0700108
109OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700110
111# If we are creating a developer image, also create a pristine image with a
112# different name.
113DEVELOPER_IMAGE_NAME=
114PRISTINE_IMAGE_NAME=chromiumos_image.bin
Don Garrette0020b12010-06-17 15:55:35 -0700115if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then
Chris Sosa9673f3b2010-05-18 13:24:40 -0700116 PRISTINE_IMAGE_NAME=chromiumos_base_image.bin
117 DEVELOPER_IMAGE_NAME=chromiumos_image.bin
118fi
Tan Gaoa40ed442010-06-02 15:45:19 -0700119
David James868d7bb2010-06-24 21:48:14 -0700120PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}"
121DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700122
123BOARD="${FLAGS_board}"
124BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
125
Don Garrett3f41e152010-06-21 14:54:34 -0700126ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
127ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
Will Drewry4a675e12010-07-03 13:35:02 -0500128ROOT_FS_HASH="${OUTPUT_DIR}/rootfs.hash"
Don Garrett3f41e152010-06-21 14:54:34 -0700129
130STATEFUL_FS_IMG="${OUTPUT_DIR}/stateful_partition.image"
131STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition"
132
Denis Romanov11061542010-06-29 04:23:53 +0400133OEM_FS_IMG="${OUTPUT_DIR}/partner_partition.image"
134OEM_FS_DIR="${OUTPUT_DIR}/partner_partition"
135
Don Garrett3f41e152010-06-21 14:54:34 -0700136ESP_FS_IMG=${OUTPUT_DIR}/esp.image
137ESP_FS_DIR=${OUTPUT_DIR}/esp
138
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700139LOOP_DEV=
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700140STATEFUL_LOOP_DEV=
Denis Romanov11061542010-06-29 04:23:53 +0400141OEM_LOOP_DEV=
Bill Richardsona81df762010-04-09 08:12:05 -0700142ESP_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700143
Don Garrett3f41e152010-06-21 14:54:34 -0700144# ${DEV_IMAGE_ROOT} specifies the location of where developer packages will
145# be installed on the stateful dir. On a Chromium OS system, this will
146# translate to /usr/local.
147DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image"
148
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700149# What cross-build are we targeting?
150. "${BOARD_ROOT}/etc/make.conf.board_setup"
151LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"}
152
Don Garrett3f41e152010-06-21 14:54:34 -0700153INSTALL_MASK=""
154if [[ ${FLAGS_installmask} -eq ${FLAGS_TRUE} ]] ; then
155 INSTALL_MASK="${DEFAULT_INSTALL_MASK}"
156fi
157
158# Reduce the size of factory install shim.
159# TODO: Build a separated ebuild for the factory install shim to reduce size.
160if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then
161 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}"
162fi
163
164if [[ ${FLAGS_jobs} -ne -1 ]]; then
165 EMERGE_JOBS="--jobs=${FLAGS_jobs}"
166fi
167
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700168# Figure out ARCH from the given toolchain.
169# TODO: Move to common.sh as a function after scripts are switched over.
Don Garrette0020b12010-06-17 15:55:35 -0700170TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
171case "${TC_ARCH}" in
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700172 arm*)
173 ARCH="arm"
174 ;;
175 *86)
176 ARCH="x86"
177 ;;
178 *)
Don Garrette0020b12010-06-17 15:55:35 -0700179 error "Unable to determine ARCH from toolchain: ${CHOST}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700180 exit 1
181esac
182
183# Hack to fix bug where x86_64 CHOST line gets incorrectly added.
184# ToDo(msb): remove this hack.
185PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
186sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
187
188# Handle existing directory.
Don Garrette0020b12010-06-17 15:55:35 -0700189if [[ -e "${OUTPUT_DIR}" ]]; then
190 if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then
191 sudo rm -rf "${OUTPUT_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700192 else
Don Garrette0020b12010-06-17 15:55:35 -0700193 echo "Directory ${OUTPUT_DIR} already exists."
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700194 echo "Use --build_attempt option to specify an unused attempt."
195 echo "Or use --replace if you want to overwrite this directory."
196 exit 1
197 fi
198fi
199
David James868d7bb2010-06-24 21:48:14 -0700200# Find previous build, if any...
201PREVIOUS_DIR=$($SCRIPTS_DIR/get_latest_image.sh --board="$BOARD")
202
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700203cleanup_rootfs_loop() {
Don Garrette0020b12010-06-17 15:55:35 -0700204 sudo umount -d "${ROOT_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700205}
206
207cleanup_stateful_fs_loop() {
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700208 sudo umount "${ROOT_FS_DIR}/usr/local"
209 sudo umount "${ROOT_FS_DIR}/var"
Don Garrett3f41e152010-06-21 14:54:34 -0700210 sudo umount -d "${STATEFUL_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700211}
212
Denis Romanov11061542010-06-29 04:23:53 +0400213cleanup_oem_fs_loop() {
214 sudo umount -d "${OEM_FS_DIR}"
215}
216
217
Bill Richardson8b3bd102010-04-06 15:00:10 -0700218cleanup_esp_loop() {
Don Garrett3f41e152010-06-21 14:54:34 -0700219 sudo umount -d "${ESP_FS_DIR}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700220}
221
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700222cleanup() {
223 # Disable die on error.
224 set +e
225
Don Garrette0020b12010-06-17 15:55:35 -0700226 if [[ -n "${STATEFUL_LOOP_DEV}" ]]; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700227 cleanup_stateful_fs_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500228 STATEFUL_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700229 fi
230
Denis Romanov11061542010-06-29 04:23:53 +0400231 if [[ -n "${OEM_LOOP_DEV}" ]]; then
232 cleanup_oem_fs_loop
233 fi
234
Don Garrette0020b12010-06-17 15:55:35 -0700235 if [[ -n "${LOOP_DEV}" ]]; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700236 cleanup_rootfs_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500237 LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700238 fi
239
Don Garrette0020b12010-06-17 15:55:35 -0700240 if [[ -n "${ESP_LOOP_DEV}" ]]; then
Bill Richardson8b3bd102010-04-06 15:00:10 -0700241 cleanup_esp_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500242 ESP_LOOP_DEV=
Bill Richardson8b3bd102010-04-06 15:00:10 -0700243 fi
244
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700245 # Turn die on error back on.
246 set -e
247}
248
Chris Sosabde8c1b2010-04-29 14:02:35 -0700249delete_prompt() {
250 echo "An error occurred in your build so your latest output directory" \
251 "is invalid."
252 read -p "Would you like to delete the output directory (y/N)? " SURE
Don Garrette0020b12010-06-17 15:55:35 -0700253 SURE="${SURE:0:1}" # Get just the first character.
Chris Sosabde8c1b2010-04-29 14:02:35 -0700254 if [ "${SURE}" == "y" ] ; then
Don Garrette0020b12010-06-17 15:55:35 -0700255 sudo rm -rf "${OUTPUT_DIR}"
256 echo "Deleted ${OUTPUT_DIR}"
Chris Sosabde8c1b2010-04-29 14:02:35 -0700257 else
Don Garrette0020b12010-06-17 15:55:35 -0700258 echo "Not deleting ${OUTPUT_DIR}. Note dev server updates will not work" \
Chris Sosabde8c1b2010-04-29 14:02:35 -0700259 "until you successfully build another image or delete this directory"
260 fi
261}
262
Chris Sosa9673f3b2010-05-18 13:24:40 -0700263# $1 - Directory where developer rootfs is mounted.
264# $2 - Directory where developer stateful_partition is mounted.
Will Drewry4a675e12010-07-03 13:35:02 -0500265# $3 - Directory where the ESP partition is mounted.
Don Garrett3f41e152010-06-21 14:54:34 -0700266mount_gpt_cleanup() {
Will Drewry4a675e12010-07-03 13:35:02 -0500267 local rootfs="${1-$ROOT_FS_DIR}"
268 local statefs="${2-$STATEFUL_FS_DIR}"
269 local espfs="${3-$ESP_FS_DIR}"
270 "${SCRIPTS_DIR}/mount_gpt_image.sh" \
271 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700272 delete_prompt
273}
274
Will Drewry4a675e12010-07-03 13:35:02 -0500275make_image_bootable() {
276 local image_name="$1"
277 cros_root=/dev/sd%D%P
278 if [[ "${ARCH}" = "arm" ]]; then
279 # TODO(wad) assumed like in build_gpt for now.
280 cros_root=/dev/mmcblk1p3
281 fi
282 if [[ ${FLAGS_use_vboot} -eq ${FLAGS_TRUE} ]]; then
283 cros_root=/dev/dm-0
284 fi
285
286 # TODO(wad) mount the root fs to LOOP_DEV from the image
287 trap "mount_gpt_cleanup" EXIT
288 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
289 --image "${image_name}" -r "${ROOT_FS_DIR}" \
290 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
291
292 sudo mount -o remount,ro "${ROOT_FS_DIR}"
293 root_dev=$(mount | grep -- "${ROOT_FS_DIR}" | cut -f1 -d' ' | tail -1)
294
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800295 DEVKEYSDIR="${SRC_ROOT}/platform/vboot_reference/tests/devkeys"
296
Will Drewry4a675e12010-07-03 13:35:02 -0500297 # Builds the kernel partition image. The temporary files are kept around
298 # so that we can perform a load_kernel_test later on the final image.
299 ${SCRIPTS_DIR}/build_kernel_image.sh \
300 --arch="${ARCH}" \
301 --to="${OUTPUT_DIR}/vmlinuz.image" \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800302 --hd_vblock="${OUTPUT_DIR}/vmlinuz_hd.vblock" \
Will Drewry4a675e12010-07-03 13:35:02 -0500303 --vmlinuz="${OUTPUT_DIR}/boot/vmlinuz" \
304 --working_dir="${OUTPUT_DIR}" \
305 --keep_work \
306 --rootfs_image=${root_dev} \
307 --rootfs_hash=${OUTPUT_DIR}/rootfs.hash \
308 --vboot_hash_alg=${FLAGS_vboot_algorithm} \
309 --vboot_tree_depth=${FLAGS_vboot_depth} \
310 --vboot_max_ios=${FLAGS_vboot_max_ios} \
311 --vboot_error_behavior=${FLAGS_vboot_behavior} \
312 --root=${cros_root} \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800313 --keys_dir="${DEVKEYSDIR}"
Will Drewry4a675e12010-07-03 13:35:02 -0500314
Louis Yung-Chieh Loca1c2b02010-07-05 17:37:05 +0800315 # Move the verification block needed for the hard disk install to the
316 # stateful partition. Mount stateful fs, copy file, and umount fs.
317 # In original CL: http://codereview.chromium.org/2868044, this was done in
318 # create_base_image(). However, it could break the build if it is a clean
319 # build because vmlinuz_hd.vblock hasn't been created by build_kernel_image.sh
320 STATEFUL_LOOP_DEV=$(sudo losetup -f)
321 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then
322 echo "No free loop device. Free up a loop device or reboot. exiting. "
323 exit 1
324 fi
325 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}"
326 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}"
327 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}"
328 sudo umount -d "${STATEFUL_FS_DIR}"
329 STATEFUL_LOOP_DEV=
330
Will Drewry4a675e12010-07-03 13:35:02 -0500331 # START_KERN_A is set by the first call to install the gpt.
332 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)"
333 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \
334 conv=notrunc bs=512 seek=${koffset}
335
336 # Populate the legacy/efi bootloader partition.
337 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'"
338 local bootloader_to="${ESP_FS_IMG}"
339 local usb_disk="${FLAGS_usb_disk}"
340 local bootloader_to="$(mount | grep ${ESP_FS_DIR} | cut -f1 -d' ')"
341 if [[ "${ARCH}" == "arm" ]]; then
342 # TODO(wad) mmcblk1p3 is hardcoded for arm for now!
343 usb_disk="/dev/mmcblk1p3"
Will Drewry82780e52010-07-03 18:27:10 -0700344 kernel_part="--kernel_cmdline=\"${FLAGS_arm_extra_bootargs}\" "
345 # TODO(wad) Integrate dmtable extraction into the arm build
346 # E.g. $(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')"
Will Drewry4a675e12010-07-03 13:35:02 -0500347 local kpart_offset="--kernel_partition_offset=${koffset}"
Will Drewry82780e52010-07-03 18:27:10 -0700348 local kpart_size="--kernel_partition_sectors="
349 kpart_size="${kpart_size}$(partsize ${OUTPUT_DIR}/${image_name} 2)"
Will Drewry4a675e12010-07-03 13:35:02 -0500350 kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
Will Drewry82780e52010-07-03 18:27:10 -0700351 info "Using addition bootloader arguments: ${kernel_part}"
Will Drewry4a675e12010-07-03 13:35:02 -0500352 bootloader_to="${OUTPUT_DIR}/arm.mbr"
353 fi
354
355 # Update partition 12 / legacy bootloaders and arm.
356 ${SCRIPTS_DIR}/update_bootloaders.sh \
357 --arch=${ARCH} \
358 --to="${bootloader_to}" \
359 --from="${OUTPUT_DIR}"/boot \
360 --vmlinuz="${OUTPUT_DIR}"/boot/vmlinuz \
361 --usb_disk="${usb_disk}" \
362 $kernel_part
363
364 if [[ "${ARCH}" == "arm" ]]; then
365 sudo dd bs=1 conv=notrunc if="${bootloader_to}" \
366 of="${OUTPUT_DIR}/${image_name}"
367 sudo rm "${bootloader_to}"
368 fi
369
370 trap - EXIT
371 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \
372 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
373}
374
Don Garrett3f41e152010-06-21 14:54:34 -0700375# Modifies an existing image to add development packages
376update_dev_packages() {
377 local image_name=$1
Chris Sosa9673f3b2010-05-18 13:24:40 -0700378
Don Garrett3f41e152010-06-21 14:54:34 -0700379 echo "Adding developer packages to ${image_name}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700380
Will Drewry4a675e12010-07-03 13:35:02 -0500381 trap "mount_gpt_cleanup" EXIT
Tan Gaoa40ed442010-06-02 15:45:19 -0700382
Don Garrette0020b12010-06-17 15:55:35 -0700383 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
David James868d7bb2010-06-24 21:48:14 -0700384 --image "${image_name}" -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500385 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700386
Don Garrett3f41e152010-06-21 14:54:34 -0700387 # Determine the root dir for developer packages.
388 local root_dev_dir="${ROOT_FS_DIR}"
389 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \
390 root_dev_dir="${ROOT_FS_DIR}/usr/local"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700391
Don Garrett3f41e152010-06-21 14:54:34 -0700392 # Install developer packages described in chromeos-dev.
393 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
394 --root="${root_dev_dir}" --root-deps=rdeps \
David James868d7bb2010-06-24 21:48:14 -0700395 --usepkg -uDNv chromeos-dev ${EMERGE_JOBS}
396
397 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then
398 # Clean out unused packages
399 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
400 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
401 --usepkg --depclean ${EMERGE_JOBS}
402 fi
Chris Sosa9673f3b2010-05-18 13:24:40 -0700403
404 # Re-run ldconfig to fix /etc/ldconfig.so.cache.
Don Garrett3f41e152010-06-21 14:54:34 -0700405 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700406
407 # Mark the image as a developer image (input to chromeos_startup).
Don Garrett3f41e152010-06-21 14:54:34 -0700408 sudo mkdir -p "${ROOT_FS_DIR}/root"
409 sudo touch "${ROOT_FS_DIR}/root/.dev_mode"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700410
Don Garrett3f41e152010-06-21 14:54:34 -0700411 # Additional changes to developer image.
Chris Sosa9673f3b2010-05-18 13:24:40 -0700412
Don Garrett3f41e152010-06-21 14:54:34 -0700413 # The ldd tool is a useful shell script but lives in glibc; just copy it.
414 sudo cp -a "$(which ldd)" "${root_dev_dir}/usr/bin"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700415
Don Garrett3f41e152010-06-21 14:54:34 -0700416 # If vim is installed, then a vi symlink would probably help.
417 if [[ -x "${ROOT_FS_DIR}/usr/local/bin/vim" ]]; then
418 sudo ln -sf vim "${ROOT_FS_DIR}/usr/local/bin/vi"
Girts Folkmanis7a8a8382010-05-18 22:52:25 -0700419 fi
Chris Sosa9673f3b2010-05-18 13:24:40 -0700420
Don Garrett3f41e152010-06-21 14:54:34 -0700421 # Check that the image has been correctly created. Only do it if not
422 # building a factory install image, as the INSTALL_MASK for it will
423 # make test_image fail.
424 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then
425 "${SCRIPTS_DIR}/test_image" \
426 --root="${ROOT_FS_DIR}" \
427 --target="${ARCH}"
428 fi
429 echo "Developer image built and stored at ${image_name}"
430
Chris Sosa9673f3b2010-05-18 13:24:40 -0700431 trap - EXIT
David James868d7bb2010-06-24 21:48:14 -0700432 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500433 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
David James868d7bb2010-06-24 21:48:14 -0700434}
435
436# Update the base package on an existing image.
437update_base_packages() {
438 local image_name=$1
439
440 echo "Updating base packages on ${image_name}"
441
442 # Create stateful partition of the same size as the rootfs.
Will Drewry4a675e12010-07-03 13:35:02 -0500443 trap "mount_gpt_cleanup" EXIT
David James868d7bb2010-06-24 21:48:14 -0700444
445 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
446 --image "${image_name}" -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500447 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
David James868d7bb2010-06-24 21:48:14 -0700448
449 # Emerge updated packages, exactly like when creating base image
450 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
451 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
452 --usepkg -uDNv chromeos ${EMERGE_JOBS}
453
454 # Clean out unused packages
455 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
456 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
457 --usepkg --depclean ${EMERGE_JOBS}
458
459 trap - EXIT
460 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500461 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700462}
463
Don Garrett3f41e152010-06-21 14:54:34 -0700464create_base_image() {
David James868d7bb2010-06-24 21:48:14 -0700465 local image_name=$1
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700466
Don Garrett3f41e152010-06-21 14:54:34 -0700467 trap "cleanup && delete_prompt" EXIT
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700468
David James868d7bb2010-06-24 21:48:14 -0700469 UUID=$(uuidgen)
470
Don Garrett3f41e152010-06-21 14:54:34 -0700471 # Create and format the root file system.
472
473 # Check for loop device before creating image.
474 LOOP_DEV=$(sudo losetup -f)
475 if [ -z "${LOOP_DEV}" ] ; then
476 echo "No free loop device. Free up a loop device or reboot. exiting. "
477 exit 1
478 fi
479
480 # Create root file system disk image to fit on a 1GB memory stick.
481 # 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
482 if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then
483 ROOT_SIZE_BYTES=$((1024 * 1024 * 300))
484 else
485 ROOT_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_rootfs_size}))
486 fi
487
488 dd if=/dev/zero of="${ROOT_FS_IMG}" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
489 sudo losetup "${LOOP_DEV}" "${ROOT_FS_IMG}"
490 sudo mkfs.ext3 "${LOOP_DEV}"
491
492 # Tune and mount rootfs.
Don Garrett3f41e152010-06-21 14:54:34 -0700493 DISK_LABEL="C-KEYFOB"
494 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${LOOP_DEV}"
495 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}"
496
497 # Create stateful partition of the same size as the rootfs.
498 STATEFUL_LOOP_DEV=$(sudo losetup -f)
499 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then
500 echo "No free loop device. Free up a loop device or reboot. exiting. "
501 exit 1
502 fi
Eric Li5cf288f2010-06-28 12:46:26 -0700503 STATEFUL_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_statefulfs_size}))
504 dd if=/dev/zero of="${STATEFUL_FS_IMG}" bs=1 count=1 \
505 seek=$((STATEFUL_SIZE_BYTES - 1))
Denis Romanov11061542010-06-29 04:23:53 +0400506
507 # Tune and mount the stateful partition.
508 UUID=$(uuidgen)
509 DISK_LABEL="C-STATE"
Don Garrett3f41e152010-06-21 14:54:34 -0700510 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}"
511 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}"
Denis Romanov11061542010-06-29 04:23:53 +0400512 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}"
Don Garrett3f41e152010-06-21 14:54:34 -0700513 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}"
514
Denis Romanov11061542010-06-29 04:23:53 +0400515 # Create OEM partner partition.
516 OEM_LOOP_DEV=$(sudo losetup -f)
517 if [ -z "${OEM_LOOP_DEV}" ] ; then
518 echo "No free loop device. Free up a loop device or reboot. exiting. "
519 exit 1
520 fi
521 OEM_SIZE_BYTES=$((1024 * 1024 * 16))
522 dd if=/dev/zero of="${OEM_FS_IMG}" bs=1 count=1 seek=$((OEM_SIZE_BYTES - 1))
523
524 # Tune and mount OEM partner partition.
525 UUID=$(uuidgen)
526 DISK_LABEL="C-OEM"
527 sudo losetup "${OEM_LOOP_DEV}" "${OEM_FS_IMG}"
528 sudo mkfs.ext3 "${OEM_LOOP_DEV}"
529 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${OEM_LOOP_DEV}"
530 sudo mount "${OEM_LOOP_DEV}" "${OEM_FS_DIR}"
531
Don Garrett3f41e152010-06-21 14:54:34 -0700532 # -- Install packages into the root file system --
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700533
Don Garrett3f41e152010-06-21 14:54:34 -0700534 # We need to install libc manually from the cross toolchain.
535 # TODO: Improve this? We only want libc and not the whole toolchain.
536 PKGDIR="/var/lib/portage/pkgs/cross/"
537 sudo tar jxvpf \
538 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \
539 -C "${ROOT_FS_DIR}" --strip-components=3 \
540 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700541
Don Garrett3f41e152010-06-21 14:54:34 -0700542 # We need to install libstdc++ manually from the cross toolchain.
543 # TODO: Figure out a better way of doing this?
544 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
545 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700546
Don Garrett3f41e152010-06-21 14:54:34 -0700547 # Prepare stateful partition with some pre-created directories.
548 sudo mkdir -p "${DEV_IMAGE_ROOT}"
549 sudo mkdir -p "${STATEFUL_FS_DIR}/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700550
Don Garrett3f41e152010-06-21 14:54:34 -0700551 # Create symlinks so that /usr/local/usr based directories are symlinked to
552 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
553 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_FS_DIR}/var" \
554 "${STATEFUL_FS_DIR}"
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800555
Don Garrett3f41e152010-06-21 14:54:34 -0700556 # Perform binding rather than symlinking because directories must exist
557 # on rootfs so that we can bind at run-time since rootfs is read-only.
558 echo "Binding directories from stateful partition onto the rootfs"
559 sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
560 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
561 sudo mkdir -p "${ROOT_FS_DIR}/var"
562 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var"
563 sudo mkdir -p "${ROOT_FS_DIR}/dev"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700564
Mandeep Singh Baines3dfa8522010-06-24 15:00:49 -0700565 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkg" all of the
Don Garrett3f41e152010-06-21 14:54:34 -0700566 # runtime packages for chrome os. This builds up a chrome os image from
567 # binary packages with runtime dependencies only. We use INSTALL_MASK to
568 # trim the image size as much as possible.
569 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
570 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
Mandeep Singh Baines3dfa8522010-06-24 15:00:49 -0700571 --usepkg chromeos ${EMERGE_JOBS}
Bill Richardson8b3bd102010-04-06 15:00:10 -0700572
Will Drewry4a675e12010-07-03 13:35:02 -0500573 # Perform any customizations on the root file system that are needed.
574 "${SCRIPTS_DIR}/customize_rootfs" \
575 --root="${ROOT_FS_DIR}" \
576 --target="${ARCH}" \
577 --board="${BOARD}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700578
Will Drewry1ee156f2010-07-03 13:27:19 -0500579 # Populates the root filesystem with legacy bootloader templates
580 # appropriate for the platform. The autoupdater and installer will
581 # use those templates to update the legacy boot partition (12/ESP)
582 # on update.
583 # (This script does not populate vmlinuz.A and .B needed by syslinux.)
584 use_vboot=
Will Drewry4a675e12010-07-03 13:35:02 -0500585 [[ ${FLAGS_use_vboot} -eq ${FLAGS_TRUE} ]] && use_vboot="--use_vboot"
Will Drewry1ee156f2010-07-03 13:27:19 -0500586 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \
587 --arch=${ARCH} \
588 --to="${ROOT_FS_DIR}"/boot \
589 --install \
590 ${use_vboot}
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700591
Will Drewry1ee156f2010-07-03 13:27:19 -0500592 # Create a working copy so we don't need the rootfs mounted
593 sudo mkdir -p "${OUTPUT_DIR}"/boot
594 # This will include any built files dropped in /boot as well.
595 # Like the current vmlinuz.
596 sudo cp -r "${ROOT_FS_DIR}"/boot/. "${OUTPUT_DIR}"/boot/
Will Drewry25861ee2010-07-04 05:09:41 -0700597 sudo chmod -R a+r "${OUTPUT_DIR}"/boot/
Bill Richardsona81df762010-04-09 08:12:05 -0700598
Don Garrett3f41e152010-06-21 14:54:34 -0700599 # Don't test the factory install shim.
600 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then
601 # Check that the image has been correctly created.
602 "${SCRIPTS_DIR}/test_image" \
603 --root="${ROOT_FS_DIR}" \
604 --target="${ARCH}"
605 fi
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700606
Don Garrett3f41e152010-06-21 14:54:34 -0700607 # Clean up symlinks so they work on a running target rooted at "/".
608 # Here development packages are rooted at /usr/local. However, do not
609 # create /usr/local or /var on host (already exist on target).
610 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700611
Will Drewry4a675e12010-07-03 13:35:02 -0500612 # make_image_bootable will clobber vmlinuz.image for x86.
613 # Until then, just copy the kernel to vmlinuz.image. It is
614 # expected in build_gpt.sh and needed by ARM until it supports the
615 # full, signed kernel partition format.
616 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
617
618 # Create an empty esp image to be updated in by update_bootloaders.sh.
619 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}"
620
Don Garrett3f41e152010-06-21 14:54:34 -0700621 cleanup
Chris Sosabde8c1b2010-04-29 14:02:35 -0700622
Don Garrett3f41e152010-06-21 14:54:34 -0700623 trap delete_prompt EXIT
Tan Gao6df5aee2010-05-19 14:19:55 -0700624
Don Garrett3f41e152010-06-21 14:54:34 -0700625 # Create the GPT-formatted image.
626 ${SCRIPTS_DIR}/build_gpt.sh \
627 --arch=${ARCH} \
628 --board=${FLAGS_board} \
629 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \
630 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \
Don Garrett3f41e152010-06-21 14:54:34 -0700631 "${OUTPUT_DIR}" \
David James868d7bb2010-06-24 21:48:14 -0700632 "${OUTPUT_DIR}/${image_name}"
633
634 trap - EXIT
Don Garrett3f41e152010-06-21 14:54:34 -0700635}
636
637# Create the output directory.
638mkdir -p "${OUTPUT_DIR}"
639mkdir -p "${ROOT_FS_DIR}"
640mkdir -p "${STATEFUL_FS_DIR}"
Denis Romanov11061542010-06-29 04:23:53 +0400641mkdir -p "${OEM_FS_DIR}"
Don Garrett3f41e152010-06-21 14:54:34 -0700642mkdir -p "${ESP_FS_DIR}"
643
David James868d7bb2010-06-24 21:48:14 -0700644# Preserve old images by copying them forward for --preserve.
645if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then
646 if [[ -f ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ]] ; then
647 # Copy forward pristine image, and associated files
648 cp ${PREVIOUS_DIR}/*.sh ${PREVIOUS_DIR}/config.txt ${OUTPUT_DIR}
649 cp ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ${OUTPUT_DIR}
Will Drewry4a675e12010-07-03 13:35:02 -0500650 cp -r ${PREVIOUS_DIR}/boot ${OUTPUT_DIR}/boot
David James868d7bb2010-06-24 21:48:14 -0700651
652 # Copy forward the developer image, if we already copied forward the base.
653 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \
654 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then
655 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR}
656 fi
657 fi
658fi
659
660if [[ -f ${PRISTINE_IMG} ]] ; then
661 update_base_packages ${PRISTINE_IMAGE_NAME}
662else
663 create_base_image ${PRISTINE_IMAGE_NAME}
664fi
Will Drewry4a675e12010-07-03 13:35:02 -0500665make_image_bootable ${PRISTINE_IMAGE_NAME}
666
667# FIXME: only signing things for x86 right now.
668if [[ "${ARCH}" = "x86" ]]; then
669 # Verify the final image.
670 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800671 "${DEVKEYSDIR}/recovery_key.vbpubk"
Will Drewry4a675e12010-07-03 13:35:02 -0500672fi
Bill Richardson4364a2e2010-03-30 14:17:34 -0700673
Don Garrette0020b12010-06-17 15:55:35 -0700674# Create a developer image based on the chromium os base image.
Don Garrett3f41e152010-06-21 14:54:34 -0700675if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then
David James868d7bb2010-06-24 21:48:14 -0700676 if [[ ! -f ${DEVELOPER_IMG} ]] ; then
677 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}"
678 cp ${PRISTINE_IMG} ${DEVELOPER_IMG}
679 fi
Don Garrett3f41e152010-06-21 14:54:34 -0700680
David James868d7bb2010-06-24 21:48:14 -0700681 update_dev_packages ${DEVELOPER_IMAGE_NAME}
Will Drewry4a675e12010-07-03 13:35:02 -0500682 make_image_bootable ${DEVELOPER_IMAGE_NAME}
Bill Richardson6ed13582010-06-16 21:38:15 -0700683fi
684
685# Clean up temporary files.
Don Garrett3f41e152010-06-21 14:54:34 -0700686rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800687 "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock"
Denis Romanov11061542010-06-29 04:23:53 +0400688rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}"
Bill Richardson67956222010-05-28 15:38:56 -0700689
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700690echo "Done. Image created in ${OUTPUT_DIR}"
Don Garrette0020b12010-06-17 15:55:35 -0700691echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}"
Don Garrette0020b12010-06-17 15:55:35 -0700692if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then
693 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700694fi
Nick Sanders8ab729a2010-06-16 03:15:17 -0700695
Nick Sandersd2509272010-06-16 03:50:04 -0700696print_time_elapsed
697
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700698echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
Daniel Eratdd9818a2010-04-26 09:16:44 -0700699echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700700echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
701echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
702echo "from the scripts directory where you entered the chroot."