blob: 4db54299f962da7a5aa1ad65441c2d4fbf8905ff [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
16# Script must be run inside the chroot.
17assert_inside_chroot
18
19get_default_board
20
21# Flags.
22DEFINE_string board "$DEFAULT_BOARD" \
23 "The board to build an image for."
24DEFINE_string build_root "/build" \
25 "The root location for board sysroots."
26DEFINE_integer build_attempt 1 \
27 "The build attempt for this image build."
28DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
29 "Directory in which to place image result directories (named by version)"
30DEFINE_boolean replace $FLAGS_FALSE \
31 "Overwrite existing output, if any."
32DEFINE_boolean withdev $FLAGS_TRUE \
33 "Include useful developer friendly utilities in the image."
34DEFINE_boolean installmask $FLAGS_TRUE \
35 "Use INSTALL_MASK to shrink the resulting image."
36DEFINE_integer jobs -1 \
37 "How many packages to build in parallel at maximum."
38DEFINE_boolean statefuldev $FLAGS_FALSE \
Chris Sosa4bffb8b2010-04-07 17:23:54 -070039 "Install development packages on stateful partition rather than the rootfs"
Antoine Laboure9e585f2010-04-01 15:57:57 -070040DEFINE_string to "" \
41 "The target image file or device"
Chris Sosa77a29632010-03-15 14:12:15 -070042DEFINE_boolean withtest $FLAGS_FALSE \
Chris Sosa4bccd3c2010-03-15 13:23:14 -070043 "Include packages required for testing and prepare image for testing"
Andrew de los Reyese7a04ad2010-04-08 15:58:17 -070044DEFINE_string factory_server $FLAGS_FALSE \
45 "Build a factory install image pointing to given server."
Bill Richardsonc09b94f2010-03-15 11:40:30 -070046
47# Parse command line.
48FLAGS "$@" || exit 1
49eval set -- "${FLAGS_ARGV}"
50
51# Only now can we die on error. shflags functions leak non-zero error codes,
52# so will die prematurely if 'set -e' is specified before now.
53set -e
54
55if [ -z "$FLAGS_board" ] ; then
56 error "--board is required."
57 exit 1
58fi
59
Bill Richardsonc09b94f2010-03-15 11:40:30 -070060# Determine build version.
61. "${SCRIPTS_DIR}/chromeos_version.sh"
62
63# Use canonical path since some tools (e.g. mount) do not like symlinks.
64# Append build attempt to output directory.
65IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
66OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
67ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
68ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
Antoine Laboure9e585f2010-04-01 15:57:57 -070069OUTPUT_IMG=${FLAGS_to:-${OUTPUT_DIR}/chromiumos_image.bin}
Bill Richardsonc09b94f2010-03-15 11:40:30 -070070
71BOARD="${FLAGS_board}"
72BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
73
74LOOP_DEV=
Chris Sosa4bffb8b2010-04-07 17:23:54 -070075STATEFUL_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -070076
77# What cross-build are we targeting?
78. "${BOARD_ROOT}/etc/make.conf.board_setup"
79LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"}
80
81# Figure out ARCH from the given toolchain.
82# TODO: Move to common.sh as a function after scripts are switched over.
83TC_ARCH=$(echo "$CHOST" | awk -F'-' '{ print $1 }')
84case "$TC_ARCH" in
85 arm*)
86 ARCH="arm"
87 ;;
88 *86)
89 ARCH="x86"
90 ;;
91 *)
92 error "Unable to determine ARCH from toolchain: $CHOST"
93 exit 1
94esac
95
96# Hack to fix bug where x86_64 CHOST line gets incorrectly added.
97# ToDo(msb): remove this hack.
98PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
99sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
100
101# Handle existing directory.
102if [[ -e "$OUTPUT_DIR" ]]; then
103 if [[ $FLAGS_replace -eq $FLAGS_TRUE ]]; then
104 sudo rm -rf "$OUTPUT_DIR"
105 else
106 echo "Directory $OUTPUT_DIR already exists."
107 echo "Use --build_attempt option to specify an unused attempt."
108 echo "Or use --replace if you want to overwrite this directory."
109 exit 1
110 fi
111fi
112
113# Create the output directory.
114mkdir -p "$OUTPUT_DIR"
115
116cleanup_rootfs_loop() {
117 sudo umount "$LOOP_DEV"
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700118 sleep 1 # in case $LOOP_DEV is in use.
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700119 sudo losetup -d "$LOOP_DEV"
120}
121
122cleanup_stateful_fs_loop() {
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700123 sudo umount "${ROOT_FS_DIR}/usr/local"
124 sudo umount "${ROOT_FS_DIR}/var"
125 sudo umount "${STATEFUL_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700126 sleep 1 # follows from cleanup_root_fs_loop.
127 sudo losetup -d "$STATEFUL_LOOP_DEV"
128}
129
Bill Richardson8b3bd102010-04-06 15:00:10 -0700130cleanup_esp_loop() {
131 sudo umount "$ESP_DIR"
132}
133
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700134cleanup() {
135 # Disable die on error.
136 set +e
137
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700138 if [[ -n "$STATEFUL_LOOP_DEV" ]]; then
139 cleanup_stateful_fs_loop
140 fi
141
142 if [[ -n "$LOOP_DEV" ]]; then
143 cleanup_rootfs_loop
144 fi
145
Bill Richardson8b3bd102010-04-06 15:00:10 -0700146 if [[ -n "$ESP_DIR" ]]; then
147 cleanup_esp_loop
148 fi
149
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700150 # Turn die on error back on.
151 set -e
152}
153
Chris Sosa4bffb8b2010-04-07 17:23:54 -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=
158
159# Sets up symlinks for the stateful partition based on the root specified by
160# ${1} and var directory specified by ${2}.
161setup_symlinks_on_root() {
162 echo "Setting up symlinks on the stateful partition rooted at ${1} with"\
163 "var directory located at ${2}"
164
165 for path in usr local; do
166 if [ -h "${DEV_IMAGE_ROOT}/${path}" ] ; then
167 sudo unlink "${DEV_IMAGE_ROOT}/${path}"
168 elif [ -e "${DEV_IMAGE_ROOT}/${path}" ] ; then
169 echo "*** ERROR: ${DEV_IMAGE_ROOT}/${path} should be a symlink if exists"
170 return 1
171 fi
172 sudo ln -s ${1} "${DEV_IMAGE_ROOT}/${path}"
173 done
174
175 # Setup var. Var is on the stateful partition at /var for both non-developer
176 # builds and developer builds.
177 if [ -h "${DEV_IMAGE_ROOT}/var" ] ; then
178 sudo unlink "${DEV_IMAGE_ROOT}/var"
179 elif [ -e "${DEV_IMAGE_ROOT}/var" ] ; then
180 echo "*** ERROR: ${DEV_IMAGE_ROOT}/var should be a symlink if it exists"
181 return 1
182 fi
183
184 sudo ln -s "${2}" "${DEV_IMAGE_ROOT}/var"
185}
186
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700187trap cleanup EXIT
188
189mkdir -p "$ROOT_FS_DIR"
190
191# Create and format the root file system.
192
193# Check for loop device before creating image.
194LOOP_DEV=$(sudo losetup -f)
195if [ -z "$LOOP_DEV" ] ; then
196 echo "No free loop device. Free up a loop device or reboot. exiting. "
197 exit 1
198fi
199
200# Create root file system disk image to fit on a 1GB memory stick.
201# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
Chris Masone35a83f92010-04-05 16:51:53 -0700202ROOT_SIZE_BYTES=$((1024 * 1024 * 720))
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700203dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
204sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG"
205sudo mkfs.ext3 "$LOOP_DEV"
206
207# Tune and mount rootfs.
208UUID=$(uuidgen)
209DISK_LABEL="C-KEYFOB"
210sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV"
211sudo mount "$LOOP_DEV" "$ROOT_FS_DIR"
212
213# Create stateful partition of the same size as the rootfs.
214STATEFUL_IMG="$OUTPUT_DIR/stateful_partition.image"
215STATEFUL_DIR="$OUTPUT_DIR/stateful_partition"
216STATEFUL_LOOP_DEV=$(sudo losetup -f)
217if [ -z "$STATEFUL_LOOP_DEV" ] ; then
218 echo "No free loop device. Free up a loop device or reboot. exiting. "
219 exit 1
220fi
221dd if=/dev/zero of="$STATEFUL_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
222sudo losetup "$STATEFUL_LOOP_DEV" "$STATEFUL_IMG"
223sudo mkfs.ext3 "$STATEFUL_LOOP_DEV"
224sudo tune2fs -L "C-STATE" -U "$UUID" -c 0 -i 0 \
225 "$STATEFUL_LOOP_DEV"
226
227# Mount the stateful partition.
228mkdir -p "$STATEFUL_DIR"
229sudo mount "$STATEFUL_LOOP_DEV" "$STATEFUL_DIR"
230
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700231# Set dev image root now that we have mounted the stateful partition we created
232DEV_IMAGE_ROOT="$STATEFUL_DIR/dev_image"
233
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700234# Turn root file system into bootable image.
235if [[ "$ARCH" = "x86" ]]; then
236 # Setup extlinux configuration.
237 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev
238 # in the initramfs. When we figure that out, switch to root=UUID=$UUID.
239 sudo mkdir -p "$ROOT_FS_DIR"/boot
240 # TODO(adlr): use initramfs for booting.
241 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf
242DEFAULT chromeos-usb
243PROMPT 0
244TIMEOUT 0
245
246label chromeos-usb
247 menu label chromeos-usb
248 kernel vmlinuz
249 append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1
250
251label chromeos-hd
252 menu label chromeos-hd
253 kernel vmlinuz
254 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro noresume noswap i915.modeset=1 loglevel=1
255EOF
256
257 # Make partition bootable and label it.
258 sudo extlinux -z --install "${ROOT_FS_DIR}/boot"
259fi
260
261# -- Install packages into the root file system --
262
263# We need to install libc manually from the cross toolchain.
264# TODO: Improve this? We only want libc and not the whole toolchain.
265PKGDIR="/var/lib/portage/pkgs/cross/"
266sudo tar jxvpf \
267 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \
268 -C "$ROOT_FS_DIR" --strip-components=3 \
269 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o
270
271# We need to install libstdc++ manually from the cross toolchain.
272# TODO: Figure out a better way of doing this?
273sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
274sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
275
276INSTALL_MASK=""
Chris Sosaaa1a7fd2010-04-02 14:06:29 -0700277if [[ $FLAGS_installmask -eq $FLAGS_FALSE ]] ; then
278 INSTALL_MASK="$DEFAULT_INSTALL_MASK"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700279fi
280
281if [[ $FLAGS_jobs -ne -1 ]]; then
282 EMERGE_JOBS="--jobs=$FLAGS_jobs"
283fi
284
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700285# Prepare stateful partition with some pre-created directories
286sudo mkdir -p "${DEV_IMAGE_ROOT}"
287sudo mkdir -p "${STATEFUL_DIR}/var"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700288
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700289# Create symlinks so that /usr/local/usr based directories are symlinked to
290# /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
291setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700292
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700293# Perform binding rather than symlinking because directories must exist
294# on rootfs so that we can bind at run-time since rootfs is read-only
295echo "Binding directories from stateful partition onto the rootfs"
296sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
297sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
298sudo mkdir -p "${ROOT_FS_DIR}/var"
299sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700300
301# We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
302# runtime packages for chrome os. This builds up a chrome os image from binary
303# packages with runtime dependencies only. We use INSTALL_MASK to trim the
304# image size as much as possible.
305sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
306 --root="$ROOT_FS_DIR" --root-deps=rdeps \
307 --usepkgonly chromeos $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700308
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700309# Determine the root dir for development packages.
310ROOT_DEV_DIR="$ROOT_FS_DIR"
311[ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
312
313# Install development packages.
314if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
315 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
316 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
317 --usepkgonly chromeos-dev $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700318
319 # The ldd tool is a useful shell script but lives in glibc; just copy it.
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700320 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
321fi
322
Andrew de los Reyese7a04ad2010-04-08 15:58:17 -0700323if [ -n "$FLAGS_factory_server" ]; then
324 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
325 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
326 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS
327fi
328
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700329# Install packages required for testing.
330if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then
331 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
332 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
333 --usepkgonly chromeos-test $EMERGE_JOBS
334fi
335
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700336# Perform any customizations on the root file system that are needed.
Andrew de los Reyese7a04ad2010-04-08 15:58:17 -0700337EXTRA_CUSTOMIZE_ROOTFS_FLAGS=""
338if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then
339 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev"
340fi
341if [ -n "$FLAGS_factory_server" ]; then
342# Indentation off b/c of long line
343EXTRA_CUSTOMIZE_ROOTFS_FLAGS="$EXTRA_CUSTOMIZE_ROOTFS_FLAGS"\
344" --factory_server=$FLAGS_factory_server"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700345fi
346
Bill Richardson4364a2e2010-03-30 14:17:34 -0700347# Extract the kernel from the root filesystem for use by the GPT image. Legacy
Bill Richardson8b3bd102010-04-06 15:00:10 -0700348# BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will
349# use the kernel partition.
Bill Richardson6dcea162010-03-31 19:20:24 -0700350sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700351
Bill Richardson8b3bd102010-04-06 15:00:10 -0700352# Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
353# BIOS). We only need this for x86, but it's simpler and safer to keep the disk
354# images the same for both x86 and ARM.
355ESP_IMG=${OUTPUT_DIR}/esp.image
356# NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code
357# it to 16M for now.
358ESP_BLOCKS=16384
359/usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS}
360ESP_DIR=${OUTPUT_DIR}/esp
361mkdir -p ${ESP_DIR}
362sudo mount -o loop ${ESP_IMG} ${ESP_DIR}
363sudo mkdir -p ${ESP_DIR}/efi/boot
364sudo grub-mkimage -p /efi/boot -o ${ESP_DIR}/efi/boot/bootx64.efi \
365 part_gpt fat ext2 normal boot sh chain configfile linux
366sudo cp ${ROOT_FS_DIR}/boot/vmlinuz ${ESP_DIR}/efi/boot/vmlinuz
367cat <<EOF | sudo dd of=${ESP_DIR}/efi/boot/grub.cfg
368set timeout=2
369set default=0
370
371menuentry "32-bit serial" {
372 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 i915.modeset=0 console=ttyS0,115200 acpi=off init=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap loglevel=7
373}
374EOF
375
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700376# Enable dev mode on the target system and re-run ldconfig
377# for rootfs's ld.so.cache
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700378if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700379 # Flag will mount /usr/local on target device
380 sudo mkdir -p "$ROOT_FS_DIR/root"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700381 sudo touch "$ROOT_FS_DIR/root/.dev_mode"
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700382
383 # Re-run ldconfig to fix /etc/ldconfig.so.cache
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700384 sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700385
386 #TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful.
387 sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700388fi
389
Chris Sosa503efe12010-04-08 10:05:46 -0700390"${SCRIPTS_DIR}/customize_rootfs" \
391 --root="$ROOT_FS_DIR" \
392 --target="$ARCH" \
393 --board="$BOARD" \
Andrew de los Reyese7a04ad2010-04-08 15:58:17 -0700394 $EXTRA_CUSTOMIZE_ROOTFS_FLAGS
Chris Sosa503efe12010-04-08 10:05:46 -0700395
396# Check that the image has been correctly created.
397"${SCRIPTS_DIR}/test_image" \
398 --root="$ROOT_FS_DIR" \
399 --target="$ARCH"
400
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700401# Clean up symlinks so they work on a running target rooted at "/".
402# Here development packages are rooted at /usr/local. However, do not
403# create /usr/local or /var on host (already exist on target).
404setup_symlinks_on_root "/usr/local" "/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700405
406# Cleanup loop devices.
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700407cleanup
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700408
Bill Richardson4364a2e2010-03-30 14:17:34 -0700409# Create the GPT-formatted image
410${SCRIPTS_DIR}/build_gpt.sh \
411 --arch=${ARCH} --board=${FLAGS_board} --board_root=${BOARD_ROOT} \
Bill Richardson6dcea162010-03-31 19:20:24 -0700412 "${OUTPUT_DIR}" "${OUTPUT_IMG}"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700413
Bill Richardson6dcea162010-03-31 19:20:24 -0700414# Clean up temporary files.
Bill Richardson8b3bd102010-04-06 15:00:10 -0700415rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
416 "${ESP_IMG}"
417rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700418
419OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
420echo "Done. Image created in ${OUTPUT_DIR}"
421echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
422echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb"
423echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
424echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
425echo "from the scripts directory where you entered the chroot."
426
427trap - EXIT