blob: 2f418bf865a810e7ee6ae8184c99e381a9e04282 [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.
Don Garrett640a0582010-05-04 16:54:28 -070017restart_in_chroot_if_needed $*
Bill Richardsonc09b94f2010-03-15 11:40:30 -070018
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."
Chris Sosab9f2d2e2010-05-05 16:42:44 -070038DEFINE_boolean statefuldev $FLAGS_TRUE \
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"
robotboyb75eee32010-04-30 09:51:23 -070042DEFINE_string arm_extra_bootargs "" \
43 "Additional command line options to pass to the ARM kernel."
Bill Richardsonc09b94f2010-03-15 11:40:30 -070044
45# Parse command line.
46FLAGS "$@" || exit 1
47eval set -- "${FLAGS_ARGV}"
48
49# Only now can we die on error. shflags functions leak non-zero error codes,
50# so will die prematurely if 'set -e' is specified before now.
51set -e
52
53if [ -z "$FLAGS_board" ] ; then
54 error "--board is required."
55 exit 1
56fi
57
Bill Richardsonc09b94f2010-03-15 11:40:30 -070058# Determine build version.
59. "${SCRIPTS_DIR}/chromeos_version.sh"
60
61# Use canonical path since some tools (e.g. mount) do not like symlinks.
62# Append build attempt to output directory.
63IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
64OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
65ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
66ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
Antoine Laboure9e585f2010-04-01 15:57:57 -070067OUTPUT_IMG=${FLAGS_to:-${OUTPUT_DIR}/chromiumos_image.bin}
Bill Richardsonc09b94f2010-03-15 11:40:30 -070068
69BOARD="${FLAGS_board}"
70BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
71
72LOOP_DEV=
Chris Sosa4bffb8b2010-04-07 17:23:54 -070073STATEFUL_LOOP_DEV=
Bill Richardsona81df762010-04-09 08:12:05 -070074ESP_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -070075
76# What cross-build are we targeting?
77. "${BOARD_ROOT}/etc/make.conf.board_setup"
78LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"}
79
80# Figure out ARCH from the given toolchain.
81# TODO: Move to common.sh as a function after scripts are switched over.
82TC_ARCH=$(echo "$CHOST" | awk -F'-' '{ print $1 }')
83case "$TC_ARCH" in
84 arm*)
85 ARCH="arm"
86 ;;
87 *86)
88 ARCH="x86"
89 ;;
90 *)
91 error "Unable to determine ARCH from toolchain: $CHOST"
92 exit 1
93esac
94
95# Hack to fix bug where x86_64 CHOST line gets incorrectly added.
96# ToDo(msb): remove this hack.
97PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
98sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
99
100# Handle existing directory.
101if [[ -e "$OUTPUT_DIR" ]]; then
102 if [[ $FLAGS_replace -eq $FLAGS_TRUE ]]; then
103 sudo rm -rf "$OUTPUT_DIR"
104 else
105 echo "Directory $OUTPUT_DIR already exists."
106 echo "Use --build_attempt option to specify an unused attempt."
107 echo "Or use --replace if you want to overwrite this directory."
108 exit 1
109 fi
110fi
111
112# Create the output directory.
113mkdir -p "$OUTPUT_DIR"
114
115cleanup_rootfs_loop() {
Chris Sosabde8c1b2010-04-29 14:02:35 -0700116 sudo umount -d "$ROOT_FS_DIR"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700117}
118
119cleanup_stateful_fs_loop() {
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700120 sudo umount "${ROOT_FS_DIR}/usr/local"
121 sudo umount "${ROOT_FS_DIR}/var"
Chris Sosabde8c1b2010-04-29 14:02:35 -0700122 sudo umount -d "${STATEFUL_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700123}
124
Bill Richardson8b3bd102010-04-06 15:00:10 -0700125cleanup_esp_loop() {
Chris Sosabde8c1b2010-04-29 14:02:35 -0700126 sudo umount -d "$ESP_DIR"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700127}
128
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700129cleanup() {
130 # Disable die on error.
131 set +e
132
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700133 if [[ -n "$STATEFUL_LOOP_DEV" ]]; then
134 cleanup_stateful_fs_loop
135 fi
136
137 if [[ -n "$LOOP_DEV" ]]; then
138 cleanup_rootfs_loop
139 fi
140
Bill Richardsona81df762010-04-09 08:12:05 -0700141 if [[ -n "$ESP_LOOP_DEV" ]]; then
Bill Richardson8b3bd102010-04-06 15:00:10 -0700142 cleanup_esp_loop
143 fi
144
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700145 # Turn die on error back on.
146 set -e
147}
148
Chris Sosabde8c1b2010-04-29 14:02:35 -0700149delete_prompt() {
150 echo "An error occurred in your build so your latest output directory" \
151 "is invalid."
152 read -p "Would you like to delete the output directory (y/N)? " SURE
153 SURE="${SURE:0:1}" # Get just the first character
154 if [ "${SURE}" == "y" ] ; then
155 sudo rm -rf "$OUTPUT_DIR"
156 echo "Deleted $OUTPUT_DIR"
157 else
158 echo "Not deleting $OUTPUT_DIR. Note dev server updates will not work" \
159 "until you successfully build another image or delete this directory"
160 fi
161}
162
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700163# ${DEV_IMAGE_ROOT} specifies the location of where developer packages will
164# be installed on the stateful dir. On a Chromium OS system, this will
165# translate to /usr/local
166DEV_IMAGE_ROOT=
167
Chris Sosabde8c1b2010-04-29 14:02:35 -0700168trap "cleanup && delete_prompt" EXIT
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700169
170mkdir -p "$ROOT_FS_DIR"
171
172# Create and format the root file system.
173
174# Check for loop device before creating image.
175LOOP_DEV=$(sudo losetup -f)
176if [ -z "$LOOP_DEV" ] ; then
177 echo "No free loop device. Free up a loop device or reboot. exiting. "
178 exit 1
179fi
180
181# Create root file system disk image to fit on a 1GB memory stick.
182# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
Chris Masone35a83f92010-04-05 16:51:53 -0700183ROOT_SIZE_BYTES=$((1024 * 1024 * 720))
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700184dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
185sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG"
186sudo mkfs.ext3 "$LOOP_DEV"
187
188# Tune and mount rootfs.
189UUID=$(uuidgen)
190DISK_LABEL="C-KEYFOB"
191sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV"
192sudo mount "$LOOP_DEV" "$ROOT_FS_DIR"
193
194# Create stateful partition of the same size as the rootfs.
195STATEFUL_IMG="$OUTPUT_DIR/stateful_partition.image"
196STATEFUL_DIR="$OUTPUT_DIR/stateful_partition"
197STATEFUL_LOOP_DEV=$(sudo losetup -f)
198if [ -z "$STATEFUL_LOOP_DEV" ] ; then
199 echo "No free loop device. Free up a loop device or reboot. exiting. "
200 exit 1
201fi
202dd if=/dev/zero of="$STATEFUL_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
203sudo losetup "$STATEFUL_LOOP_DEV" "$STATEFUL_IMG"
204sudo mkfs.ext3 "$STATEFUL_LOOP_DEV"
205sudo tune2fs -L "C-STATE" -U "$UUID" -c 0 -i 0 \
206 "$STATEFUL_LOOP_DEV"
207
208# Mount the stateful partition.
209mkdir -p "$STATEFUL_DIR"
210sudo mount "$STATEFUL_LOOP_DEV" "$STATEFUL_DIR"
211
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700212# Set dev image root now that we have mounted the stateful partition we created
213DEV_IMAGE_ROOT="$STATEFUL_DIR/dev_image"
214
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700215# Turn root file system into bootable image.
216if [[ "$ARCH" = "x86" ]]; then
217 # Setup extlinux configuration.
218 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev
219 # in the initramfs. When we figure that out, switch to root=UUID=$UUID.
220 sudo mkdir -p "$ROOT_FS_DIR"/boot
221 # TODO(adlr): use initramfs for booting.
222 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf
223DEFAULT chromeos-usb
224PROMPT 0
225TIMEOUT 0
226
227label chromeos-usb
228 menu label chromeos-usb
229 kernel vmlinuz
230 append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1
231
232label chromeos-hd
233 menu label chromeos-hd
234 kernel vmlinuz
235 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro noresume noswap i915.modeset=1 loglevel=1
236EOF
237
238 # Make partition bootable and label it.
239 sudo extlinux -z --install "${ROOT_FS_DIR}/boot"
240fi
241
242# -- Install packages into the root file system --
243
244# We need to install libc manually from the cross toolchain.
245# TODO: Improve this? We only want libc and not the whole toolchain.
246PKGDIR="/var/lib/portage/pkgs/cross/"
247sudo tar jxvpf \
248 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \
249 -C "$ROOT_FS_DIR" --strip-components=3 \
250 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o
251
252# We need to install libstdc++ manually from the cross toolchain.
253# TODO: Figure out a better way of doing this?
254sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
255sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
256
257INSTALL_MASK=""
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700258if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then
Chris Sosaaa1a7fd2010-04-02 14:06:29 -0700259 INSTALL_MASK="$DEFAULT_INSTALL_MASK"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700260fi
261
262if [[ $FLAGS_jobs -ne -1 ]]; then
263 EMERGE_JOBS="--jobs=$FLAGS_jobs"
264fi
265
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700266# Prepare stateful partition with some pre-created directories
267sudo mkdir -p "${DEV_IMAGE_ROOT}"
268sudo mkdir -p "${STATEFUL_DIR}/var"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700269
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700270# Create symlinks so that /usr/local/usr based directories are symlinked to
271# /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
Chris Sosa702618f2010-05-14 12:52:32 -0700272setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" \
273 "${STATEFUL_DIR}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700274
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700275# Perform binding rather than symlinking because directories must exist
276# on rootfs so that we can bind at run-time since rootfs is read-only
277echo "Binding directories from stateful partition onto the rootfs"
278sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
279sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
280sudo mkdir -p "${ROOT_FS_DIR}/var"
281sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700282
283# We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
284# runtime packages for chrome os. This builds up a chrome os image from binary
285# packages with runtime dependencies only. We use INSTALL_MASK to trim the
286# image size as much as possible.
Ken Mixterd5c4b172010-04-16 10:11:02 -0700287sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700288 --root="$ROOT_FS_DIR" --root-deps=rdeps \
289 --usepkgonly chromeos $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700290
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700291# Determine the root dir for development packages.
292ROOT_DEV_DIR="$ROOT_FS_DIR"
293[ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
294
295# Install development packages.
296if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
Ken Mixterd5c4b172010-04-16 10:11:02 -0700297 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700298 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
299 --usepkgonly chromeos-dev $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700300
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700301 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
302 # Flag will mount /usr/local on target device
303 sudo mkdir -p "$ROOT_FS_DIR/root"
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700304
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700305 # The ldd tool is a useful shell script but lives in glibc; just copy it.
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700306 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
307fi
308
Bill Richardson4364a2e2010-03-30 14:17:34 -0700309# Extract the kernel from the root filesystem for use by the GPT image. Legacy
Bill Richardson8b3bd102010-04-06 15:00:10 -0700310# BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will
311# use the kernel partition.
Bill Richardson6dcea162010-03-31 19:20:24 -0700312sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700313
Bill Richardson8b3bd102010-04-06 15:00:10 -0700314# Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
315# BIOS). We only need this for x86, but it's simpler and safer to keep the disk
316# images the same for both x86 and ARM.
317ESP_IMG=${OUTPUT_DIR}/esp.image
318# NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code
319# it to 16M for now.
320ESP_BLOCKS=16384
321/usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS}
322ESP_DIR=${OUTPUT_DIR}/esp
Bill Richardsona81df762010-04-09 08:12:05 -0700323ESP_LOOP_DEV=$(sudo losetup -f)
324if [ -z "$ESP_LOOP_DEV" ] ; then
325 echo "No free loop device. Free up a loop device or reboot. exiting. "
326 exit 1
327fi
328mkdir -p "${ESP_DIR}"
329sudo losetup "${ESP_LOOP_DEV}" "${ESP_IMG}"
330sudo mount "${ESP_LOOP_DEV}" "${ESP_DIR}"
331sudo mkdir -p "${ESP_DIR}/efi/boot"
332sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \
Bill Richardson8b3bd102010-04-06 15:00:10 -0700333 part_gpt fat ext2 normal boot sh chain configfile linux
Bill Richardsona81df762010-04-09 08:12:05 -0700334sudo cp "${ROOT_FS_DIR}/boot/vmlinuz" "${ESP_DIR}/efi/boot/vmlinuz"
335cat <<EOF | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700336set timeout=2
337set default=0
338
Bill Richardson041bd712010-04-27 09:36:14 -0700339menuentry "boot from disk" {
Bill Richardsona81df762010-04-09 08:12:05 -0700340 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=1
341}
342
Bill Richardson041bd712010-04-27 09:36:14 -0700343menuentry "boot from disk with serial debug" {
Bill Richardsonba9682a2010-04-13 13:02:32 -0700344 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 init=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=7
345}
346
Bill Richardson041bd712010-04-27 09:36:14 -0700347menuentry "boot from usb" {
348 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1
349}
350
351menuentry "boot from usb with serial debug" {
352 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=7
353}
354
Bill Richardson8b3bd102010-04-06 15:00:10 -0700355EOF
356
Chris Sosa5c37ce22010-05-03 20:18:02 -0700357# By default, dev mode should be activated for either development builds or
358# test builds.
359if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\
360 [[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then
361 sudo touch "$ROOT_FS_DIR/root/.dev_mode"
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700362
Chris Sosa5c37ce22010-05-03 20:18:02 -0700363 # Re-run ldconfig to fix /etc/ldconfig.so.cache.
364 sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700365fi
366
Chris Sosa3f21b992010-05-10 16:34:47 -0700367# Perform any customizations on the root file system that are needed.
Chris Sosa503efe12010-04-08 10:05:46 -0700368"${SCRIPTS_DIR}/customize_rootfs" \
369 --root="$ROOT_FS_DIR" \
370 --target="$ARCH" \
Chris Sosa3f21b992010-05-10 16:34:47 -0700371 --board="$BOARD"
Chris Sosa503efe12010-04-08 10:05:46 -0700372
373# Check that the image has been correctly created.
374"${SCRIPTS_DIR}/test_image" \
375 --root="$ROOT_FS_DIR" \
376 --target="$ARCH"
377
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700378# Clean up symlinks so they work on a running target rooted at "/".
379# Here development packages are rooted at /usr/local. However, do not
380# create /usr/local or /var on host (already exist on target).
Chris Sosa702618f2010-05-14 12:52:32 -0700381setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700382
383# Cleanup loop devices.
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700384cleanup
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700385
Chris Sosabde8c1b2010-04-29 14:02:35 -0700386trap delete_prompt EXIT
387
Bill Richardson4364a2e2010-03-30 14:17:34 -0700388# Create the GPT-formatted image
389${SCRIPTS_DIR}/build_gpt.sh \
robotboyb75eee32010-04-30 09:51:23 -0700390 --arch=${ARCH} \
391 --board=${FLAGS_board} \
392 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \
393 "${OUTPUT_DIR}" \
394 "${OUTPUT_IMG}"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700395
Bill Richardson6dcea162010-03-31 19:20:24 -0700396# Clean up temporary files.
Bill Richardson8b3bd102010-04-06 15:00:10 -0700397rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
398 "${ESP_IMG}"
399rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700400
401OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
402echo "Done. Image created in ${OUTPUT_DIR}"
403echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
Daniel Eratdd9818a2010-04-26 09:16:44 -0700404echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700405echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
406echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
407echo "from the scripts directory where you entered the chroot."
408
409trap - EXIT