blob: 3a7c3f1644540dd150c335286a23df39e405b8a3 [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."
Will Drewry78992a32010-07-21 14:02:20 -050054# ceil(0.1 * rootfs_size) is a good minimum.
55DEFINE_integer rootfs_hash_pad 8 \
56 "MBs reserved at the end of the rootfs image."
Eric Li5cf288f2010-06-28 12:46:26 -070057DEFINE_integer statefulfs_size 1024 \
58 "stateful filesystem size in MBs."
David James868d7bb2010-06-24 21:48:14 -070059DEFINE_boolean preserve ${FLAGS_FALSE} \
60 "Attempt to preserve the previous build image if one can be found (unstable, \
61kernel/firmware not updated)"
David James03668642010-07-28 17:08:29 -070062DEFINE_boolean fast ${DEFAULT_FAST} \
63 "Call many emerges in parallel"
Nick Sandersf2dee6c2010-07-01 00:21:32 -070064
Will Drewry4a675e12010-07-03 13:35:02 -050065DEFINE_string usb_disk /dev/sdb3 \
66 "Path syslinux should use to do a usb boot. Default: /dev/sdb3"
67
Will Drewry1670d482010-07-09 13:08:38 -070068DEFINE_boolean enable_rootfs_verification ${FLAGS_FALSE} \
69 "Default all bootloaders to use kernel-based root fs integrity checking."
70DEFINE_integer verity_error_behavior 2 \
71 "Kernel verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \
Will Drewry4a675e12010-07-03 13:35:02 -050072Default: 2"
Will Drewry1670d482010-07-09 13:08:38 -070073DEFINE_integer verity_depth 1 \
74 "Kernel verified boot hash tree depth. Default: 1"
75DEFINE_integer verity_max_ios 1024 \
Will Drewry4a675e12010-07-03 13:35:02 -050076 "Number of outstanding I/O operations dm-verity caps at. Default: 1024"
Will Drewry1670d482010-07-09 13:08:38 -070077DEFINE_string verity_algorithm "sha1" \
78 "Cryptographic hash algorithm used for kernel vboot. Default : sha1"
Bill Richardsonc09b94f2010-03-15 11:40:30 -070079
Nikita Kostylevc8bba902010-07-28 17:05:26 +040080DEFINE_string oem_customization "" \
Denis Romanov95bdf472010-07-12 22:44:42 +040081 "Path to directory containing OEM partner partition contents"
82
Bill Richardsonc09b94f2010-03-15 11:40:30 -070083# Parse command line.
84FLAGS "$@" || exit 1
85eval set -- "${FLAGS_ARGV}"
86
87# Only now can we die on error. shflags functions leak non-zero error codes,
88# so will die prematurely if 'set -e' is specified before now.
89set -e
90
Don Garrette0020b12010-06-17 15:55:35 -070091if [ -z "${FLAGS_board}" ] ; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -070092 error "--board is required."
93 exit 1
94fi
95
Will Drewry78992a32010-07-21 14:02:20 -050096if [ "$((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad))" -gt \
97 "${FLAGS_rootfs_partition_size}" ] ; then
98 error "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MB) is \
99bigger than partition (${FLAGS_rootfs_partition_size} MB)."
Zelidrag Hornung1d12c1a2010-06-02 10:20:29 -0700100 exit 1
101fi
102
Nick Sanders8ab729a2010-06-16 03:15:17 -0700103EMERGE_BOARD_CMD="emerge-${FLAGS_board}"
Nick Sandersf2dee6c2010-07-01 00:21:32 -0700104if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
Nick Sanders8ab729a2010-06-16 03:15:17 -0700105 echo "Using alternate emerge"
Nick Sandersf2dee6c2010-07-01 00:21:32 -0700106 EMERGE_BOARD_CMD="${SCRIPTS_DIR}/parallel_emerge --board=${FLAGS_board}"
Nick Sanders8ab729a2010-06-16 03:15:17 -0700107fi
108
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700109# Determine build version.
110. "${SCRIPTS_DIR}/chromeos_version.sh"
111
112# Use canonical path since some tools (e.g. mount) do not like symlinks.
113# Append build attempt to output directory.
114IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
115OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
Don Garrett3f41e152010-06-21 14:54:34 -0700116
117OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700118
119# If we are creating a developer image, also create a pristine image with a
120# different name.
121DEVELOPER_IMAGE_NAME=
122PRISTINE_IMAGE_NAME=chromiumos_image.bin
Don Garrette0020b12010-06-17 15:55:35 -0700123if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then
Chris Sosa9673f3b2010-05-18 13:24:40 -0700124 PRISTINE_IMAGE_NAME=chromiumos_base_image.bin
125 DEVELOPER_IMAGE_NAME=chromiumos_image.bin
126fi
Tan Gaoa40ed442010-06-02 15:45:19 -0700127
David James868d7bb2010-06-24 21:48:14 -0700128PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}"
129DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700130
131BOARD="${FLAGS_board}"
132BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
133
Don Garrett3f41e152010-06-21 14:54:34 -0700134ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
135ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
Will Drewry4a675e12010-07-03 13:35:02 -0500136ROOT_FS_HASH="${OUTPUT_DIR}/rootfs.hash"
Don Garrett3f41e152010-06-21 14:54:34 -0700137
138STATEFUL_FS_IMG="${OUTPUT_DIR}/stateful_partition.image"
139STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition"
140
Denis Romanov11061542010-06-29 04:23:53 +0400141OEM_FS_IMG="${OUTPUT_DIR}/partner_partition.image"
142OEM_FS_DIR="${OUTPUT_DIR}/partner_partition"
143
Don Garrett3f41e152010-06-21 14:54:34 -0700144ESP_FS_IMG=${OUTPUT_DIR}/esp.image
145ESP_FS_DIR=${OUTPUT_DIR}/esp
146
Will Drewry7ab698d2010-08-05 13:57:52 -0500147DEVKEYSDIR="/usr/share/vboot/devkeys"
148
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700149LOOP_DEV=
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700150STATEFUL_LOOP_DEV=
Denis Romanov11061542010-06-29 04:23:53 +0400151OEM_LOOP_DEV=
Bill Richardsona81df762010-04-09 08:12:05 -0700152ESP_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700153
Don Garrett3f41e152010-06-21 14:54:34 -0700154# ${DEV_IMAGE_ROOT} specifies the location of where developer packages will
155# be installed on the stateful dir. On a Chromium OS system, this will
156# translate to /usr/local.
157DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image"
158
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700159# What cross-build are we targeting?
160. "${BOARD_ROOT}/etc/make.conf.board_setup"
161LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"}
162
Don Garrett3f41e152010-06-21 14:54:34 -0700163INSTALL_MASK=""
164if [[ ${FLAGS_installmask} -eq ${FLAGS_TRUE} ]] ; then
165 INSTALL_MASK="${DEFAULT_INSTALL_MASK}"
166fi
167
168# Reduce the size of factory install shim.
169# TODO: Build a separated ebuild for the factory install shim to reduce size.
170if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then
171 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}"
172fi
173
David Jamesfd7403a2010-07-09 12:00:17 -0700174if [[ ${FLAGS_jobs} -ne -1 ]]; then
175 EMERGE_JOBS="--jobs=${FLAGS_jobs}"
176fi
177
Will Drewry7ab698d2010-08-05 13:57:52 -0500178if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then
179 enable_rootfs_verification_flag="--enable_rootfs_verification"
180fi
181
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700182# Figure out ARCH from the given toolchain.
183# TODO: Move to common.sh as a function after scripts are switched over.
Don Garrette0020b12010-06-17 15:55:35 -0700184TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
185case "${TC_ARCH}" in
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700186 arm*)
187 ARCH="arm"
188 ;;
189 *86)
190 ARCH="x86"
191 ;;
192 *)
Don Garrette0020b12010-06-17 15:55:35 -0700193 error "Unable to determine ARCH from toolchain: ${CHOST}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700194 exit 1
195esac
196
197# Hack to fix bug where x86_64 CHOST line gets incorrectly added.
198# ToDo(msb): remove this hack.
199PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
200sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
201
202# Handle existing directory.
Don Garrette0020b12010-06-17 15:55:35 -0700203if [[ -e "${OUTPUT_DIR}" ]]; then
204 if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then
205 sudo rm -rf "${OUTPUT_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700206 else
Don Garrette0020b12010-06-17 15:55:35 -0700207 echo "Directory ${OUTPUT_DIR} already exists."
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700208 echo "Use --build_attempt option to specify an unused attempt."
209 echo "Or use --replace if you want to overwrite this directory."
210 exit 1
211 fi
212fi
213
David James868d7bb2010-06-24 21:48:14 -0700214# Find previous build, if any...
215PREVIOUS_DIR=$($SCRIPTS_DIR/get_latest_image.sh --board="$BOARD")
216
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700217cleanup_rootfs_loop() {
Don Garrette0020b12010-06-17 15:55:35 -0700218 sudo umount -d "${ROOT_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700219}
220
221cleanup_stateful_fs_loop() {
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700222 sudo umount "${ROOT_FS_DIR}/usr/local"
223 sudo umount "${ROOT_FS_DIR}/var"
Don Garrett3f41e152010-06-21 14:54:34 -0700224 sudo umount -d "${STATEFUL_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700225}
226
Denis Romanov11061542010-06-29 04:23:53 +0400227cleanup_oem_fs_loop() {
228 sudo umount -d "${OEM_FS_DIR}"
229}
230
231
Bill Richardson8b3bd102010-04-06 15:00:10 -0700232cleanup_esp_loop() {
Don Garrett3f41e152010-06-21 14:54:34 -0700233 sudo umount -d "${ESP_FS_DIR}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700234}
235
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700236cleanup() {
237 # Disable die on error.
238 set +e
239
Don Garrette0020b12010-06-17 15:55:35 -0700240 if [[ -n "${STATEFUL_LOOP_DEV}" ]]; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700241 cleanup_stateful_fs_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500242 STATEFUL_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700243 fi
244
Denis Romanov11061542010-06-29 04:23:53 +0400245 if [[ -n "${OEM_LOOP_DEV}" ]]; then
246 cleanup_oem_fs_loop
247 fi
248
Don Garrette0020b12010-06-17 15:55:35 -0700249 if [[ -n "${LOOP_DEV}" ]]; then
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700250 cleanup_rootfs_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500251 LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700252 fi
253
Don Garrette0020b12010-06-17 15:55:35 -0700254 if [[ -n "${ESP_LOOP_DEV}" ]]; then
Bill Richardson8b3bd102010-04-06 15:00:10 -0700255 cleanup_esp_loop
Will Drewry4a675e12010-07-03 13:35:02 -0500256 ESP_LOOP_DEV=
Bill Richardson8b3bd102010-04-06 15:00:10 -0700257 fi
258
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700259 # Turn die on error back on.
260 set -e
261}
262
Chris Sosabde8c1b2010-04-29 14:02:35 -0700263delete_prompt() {
264 echo "An error occurred in your build so your latest output directory" \
265 "is invalid."
266 read -p "Would you like to delete the output directory (y/N)? " SURE
Don Garrette0020b12010-06-17 15:55:35 -0700267 SURE="${SURE:0:1}" # Get just the first character.
Chris Sosabde8c1b2010-04-29 14:02:35 -0700268 if [ "${SURE}" == "y" ] ; then
Don Garrette0020b12010-06-17 15:55:35 -0700269 sudo rm -rf "${OUTPUT_DIR}"
270 echo "Deleted ${OUTPUT_DIR}"
Chris Sosabde8c1b2010-04-29 14:02:35 -0700271 else
Don Garrette0020b12010-06-17 15:55:35 -0700272 echo "Not deleting ${OUTPUT_DIR}. Note dev server updates will not work" \
Chris Sosabde8c1b2010-04-29 14:02:35 -0700273 "until you successfully build another image or delete this directory"
274 fi
275}
276
Chris Sosa9673f3b2010-05-18 13:24:40 -0700277# $1 - Directory where developer rootfs is mounted.
278# $2 - Directory where developer stateful_partition is mounted.
Will Drewry4a675e12010-07-03 13:35:02 -0500279# $3 - Directory where the ESP partition is mounted.
Don Garrett3f41e152010-06-21 14:54:34 -0700280mount_gpt_cleanup() {
Will Drewry4a675e12010-07-03 13:35:02 -0500281 local rootfs="${1-$ROOT_FS_DIR}"
282 local statefs="${2-$STATEFUL_FS_DIR}"
283 local espfs="${3-$ESP_FS_DIR}"
284 "${SCRIPTS_DIR}/mount_gpt_image.sh" \
285 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700286 delete_prompt
287}
288
Will Drewry7ab698d2010-08-05 13:57:52 -0500289# Takes no arguments and populates the configuration for
290# cros_make_image_bootable.
291create_boot_desc() {
292 cat <<EOF > ${OUTPUT_DIR}/boot.desc
293 --arch="${ARCH}"
294 --output_dir="${OUTPUT_DIR}"
295 --rootfs_size="${FLAGS_rootfs_size}"
296 --rootfs_hash_pad="${FLAGS_rootfs_hash_pad}"
297 --rootfs_hash="${ROOT_FS_HASH}"
298 --rootfs_mountpoint="${ROOT_FS_DIR}"
299 --statefulfs_mountpoint="${STATEFUL_FS_DIR}"
300 --espfs_mountpoint="${ESP_FS_DIR}"
301 --verity_error_behavior="${FLAGS_verity_error_behavior}"
302 --verity_depth="${FLAGS_verity_depth}"
303 --verity_max_ios="${FLAGS_verity_max_ios}"
304 --verity_algorithm="${FLAGS_verity_algorithm}"
305 --keys_dir="${DEVKEYSDIR}"
306 --usb_disk="${FLAGS_usb_disk}"
Will Drewry6793ba72010-08-05 16:17:46 -0500307 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}"
Will Drewry7ab698d2010-08-05 13:57:52 -0500308 --nocleanup_dirs
309 ${enable_rootfs_verification_flag}
310EOF
Will Drewry4a675e12010-07-03 13:35:02 -0500311}
312
Don Garrett3f41e152010-06-21 14:54:34 -0700313# Modifies an existing image to add development packages
314update_dev_packages() {
315 local image_name=$1
Chris Sosa9673f3b2010-05-18 13:24:40 -0700316
Don Garrett3f41e152010-06-21 14:54:34 -0700317 echo "Adding developer packages to ${image_name}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700318
Will Drewry4a675e12010-07-03 13:35:02 -0500319 trap "mount_gpt_cleanup" EXIT
Tan Gaoa40ed442010-06-02 15:45:19 -0700320
Don Garrette0020b12010-06-17 15:55:35 -0700321 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
David James868d7bb2010-06-24 21:48:14 -0700322 --image "${image_name}" -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500323 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700324
Don Garrett3f41e152010-06-21 14:54:34 -0700325 # Determine the root dir for developer packages.
326 local root_dev_dir="${ROOT_FS_DIR}"
327 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \
328 root_dev_dir="${ROOT_FS_DIR}/usr/local"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700329
Don Garrett3f41e152010-06-21 14:54:34 -0700330 # Install developer packages described in chromeos-dev.
331 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
332 --root="${root_dev_dir}" --root-deps=rdeps \
David James868d7bb2010-06-24 21:48:14 -0700333 --usepkg -uDNv chromeos-dev ${EMERGE_JOBS}
334
335 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then
336 # Clean out unused packages
337 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
338 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
339 --usepkg --depclean ${EMERGE_JOBS}
340 fi
Chris Sosa9673f3b2010-05-18 13:24:40 -0700341
342 # Re-run ldconfig to fix /etc/ldconfig.so.cache.
Don Garrett3f41e152010-06-21 14:54:34 -0700343 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700344
345 # Mark the image as a developer image (input to chromeos_startup).
Don Garrett3f41e152010-06-21 14:54:34 -0700346 sudo mkdir -p "${ROOT_FS_DIR}/root"
347 sudo touch "${ROOT_FS_DIR}/root/.dev_mode"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700348
Don Garrett3f41e152010-06-21 14:54:34 -0700349 # Additional changes to developer image.
Chris Sosa9673f3b2010-05-18 13:24:40 -0700350
Ken Mixter13347882010-08-12 16:51:52 -0700351 # Leave core files for developers to inspect.
352 sudo touch "${ROOT_FS_DIR}/etc/leave_core"
353
Don Garrett3f41e152010-06-21 14:54:34 -0700354 # The ldd tool is a useful shell script but lives in glibc; just copy it.
355 sudo cp -a "$(which ldd)" "${root_dev_dir}/usr/bin"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700356
Don Garrett3f41e152010-06-21 14:54:34 -0700357 # If vim is installed, then a vi symlink would probably help.
358 if [[ -x "${ROOT_FS_DIR}/usr/local/bin/vim" ]]; then
359 sudo ln -sf vim "${ROOT_FS_DIR}/usr/local/bin/vi"
Girts Folkmanis7a8a8382010-05-18 22:52:25 -0700360 fi
Chris Sosa9673f3b2010-05-18 13:24:40 -0700361
Tammo Spalinkcfc0c642010-07-07 10:51:21 +0800362 # If pygtk is installed in stateful-dev, then install a path.
363 if [[ -d \
364 "${ROOT_FS_DIR}/usr/local/lib/python2.6/site-packages/gtk-2.0" ]]; then
365 sudo bash -c "\
366 echo gtk-2.0 > \
367 ${ROOT_FS_DIR}/usr/local/lib/python2.6/site-packages/pygtk.pth"
368 fi
369
Don Garrett3f41e152010-06-21 14:54:34 -0700370 # Check that the image has been correctly created. Only do it if not
371 # building a factory install image, as the INSTALL_MASK for it will
372 # make test_image fail.
373 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then
374 "${SCRIPTS_DIR}/test_image" \
375 --root="${ROOT_FS_DIR}" \
376 --target="${ARCH}"
377 fi
378 echo "Developer image built and stored at ${image_name}"
379
Chris Sosa9673f3b2010-05-18 13:24:40 -0700380 trap - EXIT
David James868d7bb2010-06-24 21:48:14 -0700381 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500382 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
David James868d7bb2010-06-24 21:48:14 -0700383}
384
385# Update the base package on an existing image.
386update_base_packages() {
387 local image_name=$1
388
389 echo "Updating base packages on ${image_name}"
390
391 # Create stateful partition of the same size as the rootfs.
Will Drewry4a675e12010-07-03 13:35:02 -0500392 trap "mount_gpt_cleanup" EXIT
David James868d7bb2010-06-24 21:48:14 -0700393
394 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
395 --image "${image_name}" -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500396 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
David James868d7bb2010-06-24 21:48:14 -0700397
398 # Emerge updated packages, exactly like when creating base image
399 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
400 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
401 --usepkg -uDNv chromeos ${EMERGE_JOBS}
402
403 # Clean out unused packages
404 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
405 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
406 --usepkg --depclean ${EMERGE_JOBS}
407
408 trap - EXIT
409 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \
Will Drewry4a675e12010-07-03 13:35:02 -0500410 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700411}
412
Don Garrett3f41e152010-06-21 14:54:34 -0700413create_base_image() {
David James868d7bb2010-06-24 21:48:14 -0700414 local image_name=$1
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700415
Don Garrett3f41e152010-06-21 14:54:34 -0700416 trap "cleanup && delete_prompt" EXIT
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700417
David James868d7bb2010-06-24 21:48:14 -0700418 UUID=$(uuidgen)
419
Don Garrett3f41e152010-06-21 14:54:34 -0700420 # Create and format the root file system.
421
422 # Check for loop device before creating image.
423 LOOP_DEV=$(sudo losetup -f)
424 if [ -z "${LOOP_DEV}" ] ; then
425 echo "No free loop device. Free up a loop device or reboot. exiting. "
426 exit 1
427 fi
428
429 # Create root file system disk image to fit on a 1GB memory stick.
430 # 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
431 if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then
432 ROOT_SIZE_BYTES=$((1024 * 1024 * 300))
433 else
434 ROOT_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_rootfs_size}))
435 fi
436
Will Drewry9926ee22010-07-21 15:11:10 -0500437 # Pad out for the hash tree.
Will Drewry78992a32010-07-21 14:02:20 -0500438 ROOT_HASH_PAD=$((FLAGS_rootfs_hash_pad * 1024 * 1024))
439 info "Padding the rootfs image by ${ROOT_HASH_PAD} bytes for hash data"
Will Drewry9926ee22010-07-21 15:11:10 -0500440
Will Drewry78992a32010-07-21 14:02:20 -0500441 dd if=/dev/zero of="${ROOT_FS_IMG}" bs=1 count=1 \
442 seek=$((ROOT_SIZE_BYTES + ROOT_HASH_PAD - 1))
Will Drewry9926ee22010-07-21 15:11:10 -0500443 sudo losetup "${LOOP_DEV}" "${ROOT_FS_IMG}"
444 # Specify a block size and block count to avoid using the hash pad.
445 sudo mkfs.ext3 -b 4096 "${LOOP_DEV}" "$((ROOT_SIZE_BYTES / 4096))"
Will Drewry78992a32010-07-21 14:02:20 -0500446
Don Garrett3f41e152010-06-21 14:54:34 -0700447 # Tune and mount rootfs.
Will Drewry78992a32010-07-21 14:02:20 -0500448 # TODO(wad) rename the disk label to match the GPT since we
449 # can't change it later.
Don Garrett3f41e152010-06-21 14:54:34 -0700450 DISK_LABEL="C-KEYFOB"
451 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${LOOP_DEV}"
452 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}"
453
454 # Create stateful partition of the same size as the rootfs.
455 STATEFUL_LOOP_DEV=$(sudo losetup -f)
456 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then
457 echo "No free loop device. Free up a loop device or reboot. exiting. "
458 exit 1
459 fi
Eric Li5cf288f2010-06-28 12:46:26 -0700460 STATEFUL_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_statefulfs_size}))
461 dd if=/dev/zero of="${STATEFUL_FS_IMG}" bs=1 count=1 \
462 seek=$((STATEFUL_SIZE_BYTES - 1))
Denis Romanov11061542010-06-29 04:23:53 +0400463
464 # Tune and mount the stateful partition.
465 UUID=$(uuidgen)
466 DISK_LABEL="C-STATE"
Don Garrett3f41e152010-06-21 14:54:34 -0700467 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}"
468 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}"
Denis Romanov11061542010-06-29 04:23:53 +0400469 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}"
Don Garrett3f41e152010-06-21 14:54:34 -0700470 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}"
471
Denis Romanov11061542010-06-29 04:23:53 +0400472 # Create OEM partner partition.
473 OEM_LOOP_DEV=$(sudo losetup -f)
474 if [ -z "${OEM_LOOP_DEV}" ] ; then
475 echo "No free loop device. Free up a loop device or reboot. exiting. "
476 exit 1
477 fi
478 OEM_SIZE_BYTES=$((1024 * 1024 * 16))
479 dd if=/dev/zero of="${OEM_FS_IMG}" bs=1 count=1 seek=$((OEM_SIZE_BYTES - 1))
480
481 # Tune and mount OEM partner partition.
482 UUID=$(uuidgen)
483 DISK_LABEL="C-OEM"
484 sudo losetup "${OEM_LOOP_DEV}" "${OEM_FS_IMG}"
485 sudo mkfs.ext3 "${OEM_LOOP_DEV}"
486 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${OEM_LOOP_DEV}"
487 sudo mount "${OEM_LOOP_DEV}" "${OEM_FS_DIR}"
488
Denis Romanov95bdf472010-07-12 22:44:42 +0400489 # Populate OEM partner partition.
Nikita Kostylevc8bba902010-07-28 17:05:26 +0400490 if [ ! -z "${FLAGS_oem_customization}" ]; then
Denis Romanov95bdf472010-07-12 22:44:42 +0400491 if [ ! -d ${FLAGS_oem_customization} ]; then
492 echo "Specified OEM content directory does not exist. exiting."
493 exit 1
494 fi
495 for ITEM in `ls -A ${FLAGS_oem_customization}`
496 do sudo cp -a "${FLAGS_oem_customization}/$ITEM" "${OEM_FS_DIR}"
497 done
498 sudo find "${OEM_FS_DIR}" -type d -exec chmod 755 "{}" \;
499 sudo find "${OEM_FS_DIR}" -type f -exec chmod 644 "{}" \;
500 sudo chown -R root:root "${OEM_FS_DIR}"
Nikita Kostylevc8bba902010-07-28 17:05:26 +0400501 else
502 echo "Empty OEM partition: OEM customizations will not be applied."
Denis Romanov95bdf472010-07-12 22:44:42 +0400503 fi
504
Don Garrett3f41e152010-06-21 14:54:34 -0700505 # -- Install packages into the root file system --
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700506
Don Garrett3f41e152010-06-21 14:54:34 -0700507 # We need to install libc manually from the cross toolchain.
508 # TODO: Improve this? We only want libc and not the whole toolchain.
509 PKGDIR="/var/lib/portage/pkgs/cross/"
510 sudo tar jxvpf \
511 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \
512 -C "${ROOT_FS_DIR}" --strip-components=3 \
513 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700514
Don Garrett3f41e152010-06-21 14:54:34 -0700515 # We need to install libstdc++ manually from the cross toolchain.
516 # TODO: Figure out a better way of doing this?
517 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
518 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700519
Don Garrett3f41e152010-06-21 14:54:34 -0700520 # Prepare stateful partition with some pre-created directories.
521 sudo mkdir -p "${DEV_IMAGE_ROOT}"
522 sudo mkdir -p "${STATEFUL_FS_DIR}/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700523
Don Garrett3f41e152010-06-21 14:54:34 -0700524 # Create symlinks so that /usr/local/usr based directories are symlinked to
525 # /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
526 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_FS_DIR}/var" \
527 "${STATEFUL_FS_DIR}"
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800528
Don Garrett3f41e152010-06-21 14:54:34 -0700529 # Perform binding rather than symlinking because directories must exist
530 # on rootfs so that we can bind at run-time since rootfs is read-only.
531 echo "Binding directories from stateful partition onto the rootfs"
532 sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
533 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
534 sudo mkdir -p "${ROOT_FS_DIR}/var"
535 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var"
536 sudo mkdir -p "${ROOT_FS_DIR}/dev"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700537
Mandeep Singh Baines3dfa8522010-06-24 15:00:49 -0700538 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkg" all of the
Don Garrett3f41e152010-06-21 14:54:34 -0700539 # runtime packages for chrome os. This builds up a chrome os image from
540 # binary packages with runtime dependencies only. We use INSTALL_MASK to
541 # trim the image size as much as possible.
542 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
543 --root="${ROOT_FS_DIR}" --root-deps=rdeps \
Mandeep Singh Baines3dfa8522010-06-24 15:00:49 -0700544 --usepkg chromeos ${EMERGE_JOBS}
Bill Richardson8b3bd102010-04-06 15:00:10 -0700545
Will Drewry4a675e12010-07-03 13:35:02 -0500546 # Perform any customizations on the root file system that are needed.
547 "${SCRIPTS_DIR}/customize_rootfs" \
548 --root="${ROOT_FS_DIR}" \
549 --target="${ARCH}" \
550 --board="${BOARD}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700551
Will Drewry1ee156f2010-07-03 13:27:19 -0500552 # Populates the root filesystem with legacy bootloader templates
553 # appropriate for the platform. The autoupdater and installer will
554 # use those templates to update the legacy boot partition (12/ESP)
555 # on update.
556 # (This script does not populate vmlinuz.A and .B needed by syslinux.)
Will Drewry1670d482010-07-09 13:08:38 -0700557 enable_rootfs_verification=
558 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then
559 enable_rootfs_verification="--enable_rootfs_verification"
560 fi
561
Will Drewry1ee156f2010-07-03 13:27:19 -0500562 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \
563 --arch=${ARCH} \
564 --to="${ROOT_FS_DIR}"/boot \
565 --install \
Will Drewry1670d482010-07-09 13:08:38 -0700566 ${enable_rootfs_verification}
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700567
Don Garrett3f41e152010-06-21 14:54:34 -0700568 # Don't test the factory install shim.
569 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then
570 # Check that the image has been correctly created.
571 "${SCRIPTS_DIR}/test_image" \
572 --root="${ROOT_FS_DIR}" \
573 --target="${ARCH}"
574 fi
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700575
Don Garrett3f41e152010-06-21 14:54:34 -0700576 # Clean up symlinks so they work on a running target rooted at "/".
577 # Here development packages are rooted at /usr/local. However, do not
578 # create /usr/local or /var on host (already exist on target).
579 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700580
Will Drewry7ab698d2010-08-05 13:57:52 -0500581 # cros_make_image_bootable will clobber vmlinuz.image for x86.
Will Drewry4a675e12010-07-03 13:35:02 -0500582 # Until then, just copy the kernel to vmlinuz.image. It is
583 # expected in build_gpt.sh and needed by ARM until it supports the
584 # full, signed kernel partition format.
585 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
586
587 # Create an empty esp image to be updated in by update_bootloaders.sh.
588 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}"
589
Don Garrett3f41e152010-06-21 14:54:34 -0700590 cleanup
Chris Sosabde8c1b2010-04-29 14:02:35 -0700591
Don Garrett3f41e152010-06-21 14:54:34 -0700592 trap delete_prompt EXIT
Tan Gao6df5aee2010-05-19 14:19:55 -0700593
Don Garrett3f41e152010-06-21 14:54:34 -0700594 # Create the GPT-formatted image.
595 ${SCRIPTS_DIR}/build_gpt.sh \
596 --arch=${ARCH} \
597 --board=${FLAGS_board} \
598 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \
599 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \
Don Garrett3f41e152010-06-21 14:54:34 -0700600 "${OUTPUT_DIR}" \
David James868d7bb2010-06-24 21:48:14 -0700601 "${OUTPUT_DIR}/${image_name}"
602
603 trap - EXIT
Don Garrett3f41e152010-06-21 14:54:34 -0700604}
605
606# Create the output directory.
607mkdir -p "${OUTPUT_DIR}"
608mkdir -p "${ROOT_FS_DIR}"
609mkdir -p "${STATEFUL_FS_DIR}"
Denis Romanov11061542010-06-29 04:23:53 +0400610mkdir -p "${OEM_FS_DIR}"
Don Garrett3f41e152010-06-21 14:54:34 -0700611mkdir -p "${ESP_FS_DIR}"
612
David James868d7bb2010-06-24 21:48:14 -0700613# Preserve old images by copying them forward for --preserve.
614if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then
615 if [[ -f ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ]] ; then
616 # Copy forward pristine image, and associated files
617 cp ${PREVIOUS_DIR}/*.sh ${PREVIOUS_DIR}/config.txt ${OUTPUT_DIR}
618 cp ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ${OUTPUT_DIR}
619
620 # Copy forward the developer image, if we already copied forward the base.
621 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \
622 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then
623 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR}
624 fi
625 fi
626fi
627
Will Drewry7ab698d2010-08-05 13:57:52 -0500628# Create the boot.desc file which stores the build-time configuration
629# information needed for making the image bootable after creation with
630# cros_make_image_bootable.
631create_boot_desc
632
David James868d7bb2010-06-24 21:48:14 -0700633if [[ -f ${PRISTINE_IMG} ]] ; then
634 update_base_packages ${PRISTINE_IMAGE_NAME}
635else
636 create_base_image ${PRISTINE_IMAGE_NAME}
637fi
Will Drewry7ab698d2010-08-05 13:57:52 -0500638${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \
639 "${PRISTINE_IMAGE_NAME}"
Will Drewry4a675e12010-07-03 13:35:02 -0500640
641# FIXME: only signing things for x86 right now.
642if [[ "${ARCH}" = "x86" ]]; then
643 # Verify the final image.
644 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800645 "${DEVKEYSDIR}/recovery_key.vbpubk"
Will Drewry4a675e12010-07-03 13:35:02 -0500646fi
Bill Richardson4364a2e2010-03-30 14:17:34 -0700647
Don Garrette0020b12010-06-17 15:55:35 -0700648# Create a developer image based on the chromium os base image.
Don Garrett3f41e152010-06-21 14:54:34 -0700649if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then
David James868d7bb2010-06-24 21:48:14 -0700650 if [[ ! -f ${DEVELOPER_IMG} ]] ; then
651 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}"
652 cp ${PRISTINE_IMG} ${DEVELOPER_IMG}
653 fi
Don Garrett3f41e152010-06-21 14:54:34 -0700654
David James868d7bb2010-06-24 21:48:14 -0700655 update_dev_packages ${DEVELOPER_IMAGE_NAME}
Will Drewry7ab698d2010-08-05 13:57:52 -0500656 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \
657 "${DEVELOPER_IMAGE_NAME}"
Bill Richardson6ed13582010-06-16 21:38:15 -0700658fi
659
660# Clean up temporary files.
Don Garrett3f41e152010-06-21 14:54:34 -0700661rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
Louis Yung-Chieh Lo36020402010-07-05 13:23:34 +0800662 "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock"
Denis Romanov11061542010-06-29 04:23:53 +0400663rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}"
Bill Richardson67956222010-05-28 15:38:56 -0700664
Olof Johansson58f25cc2010-08-04 21:18:49 -0700665# Create a 'latest' link
666rm -f ${FLAGS_output_root}/${FLAGS_board}/latest
667ln -s $(basename ${OUTPUT_DIR}) ${FLAGS_output_root}/${FLAGS_board}/latest
668
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700669echo "Done. Image created in ${OUTPUT_DIR}"
Don Garrette0020b12010-06-17 15:55:35 -0700670echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}"
Don Garrette0020b12010-06-17 15:55:35 -0700671if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then
672 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}"
Chris Sosa9673f3b2010-05-18 13:24:40 -0700673fi
Nick Sanders8ab729a2010-06-16 03:15:17 -0700674
Nick Sandersd2509272010-06-16 03:50:04 -0700675print_time_elapsed
676
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700677echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
Daniel Eratdd9818a2010-04-26 09:16:44 -0700678echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
Will Drewryefce6682010-07-23 19:43:27 -0500679echo "To convert to VMWare image, INSIDE the chroot, do something like:"
Zelidrag Hornung478a0d42010-07-14 11:47:39 -0700680echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700681echo "from the scripts directory where you entered the chroot."