blob: 272ed424d9e3a336746b727a3363b7ce550676eb [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"
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +080042DEFINE_boolean factory_install $FLAGS_FALSE \
43 "Build a smaller image to overlay the factory install shim on; this argument \
44is also required in image_to_usb."
robotboyb75eee32010-04-30 09:51:23 -070045DEFINE_string arm_extra_bootargs "" \
46 "Additional command line options to pass to the ARM kernel."
Bill Richardsonc09b94f2010-03-15 11:40:30 -070047
48# Parse command line.
49FLAGS "$@" || exit 1
50eval set -- "${FLAGS_ARGV}"
51
52# Only now can we die on error. shflags functions leak non-zero error codes,
53# so will die prematurely if 'set -e' is specified before now.
54set -e
55
56if [ -z "$FLAGS_board" ] ; then
57 error "--board is required."
58 exit 1
59fi
60
Bill Richardsonc09b94f2010-03-15 11:40:30 -070061# Determine build version.
62. "${SCRIPTS_DIR}/chromeos_version.sh"
63
64# Use canonical path since some tools (e.g. mount) do not like symlinks.
65# Append build attempt to output directory.
66IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
67OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
68ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
69ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
Antoine Laboure9e585f2010-04-01 15:57:57 -070070OUTPUT_IMG=${FLAGS_to:-${OUTPUT_DIR}/chromiumos_image.bin}
Bill Richardsonc09b94f2010-03-15 11:40:30 -070071
72BOARD="${FLAGS_board}"
73BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
74
75LOOP_DEV=
Chris Sosa4bffb8b2010-04-07 17:23:54 -070076STATEFUL_LOOP_DEV=
Bill Richardsona81df762010-04-09 08:12:05 -070077ESP_LOOP_DEV=
Bill Richardsonc09b94f2010-03-15 11:40:30 -070078
79# What cross-build are we targeting?
80. "${BOARD_ROOT}/etc/make.conf.board_setup"
81LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"}
82
83# Figure out ARCH from the given toolchain.
84# TODO: Move to common.sh as a function after scripts are switched over.
85TC_ARCH=$(echo "$CHOST" | awk -F'-' '{ print $1 }')
86case "$TC_ARCH" in
87 arm*)
88 ARCH="arm"
89 ;;
90 *86)
91 ARCH="x86"
92 ;;
93 *)
94 error "Unable to determine ARCH from toolchain: $CHOST"
95 exit 1
96esac
97
98# Hack to fix bug where x86_64 CHOST line gets incorrectly added.
99# ToDo(msb): remove this hack.
100PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
101sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
102
103# Handle existing directory.
104if [[ -e "$OUTPUT_DIR" ]]; then
105 if [[ $FLAGS_replace -eq $FLAGS_TRUE ]]; then
106 sudo rm -rf "$OUTPUT_DIR"
107 else
108 echo "Directory $OUTPUT_DIR already exists."
109 echo "Use --build_attempt option to specify an unused attempt."
110 echo "Or use --replace if you want to overwrite this directory."
111 exit 1
112 fi
113fi
114
115# Create the output directory.
116mkdir -p "$OUTPUT_DIR"
117
118cleanup_rootfs_loop() {
Chris Sosabde8c1b2010-04-29 14:02:35 -0700119 sudo umount -d "$ROOT_FS_DIR"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700120}
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"
Chris Sosabde8c1b2010-04-29 14:02:35 -0700125 sudo umount -d "${STATEFUL_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700126}
127
Bill Richardson8b3bd102010-04-06 15:00:10 -0700128cleanup_esp_loop() {
Chris Sosabde8c1b2010-04-29 14:02:35 -0700129 sudo umount -d "$ESP_DIR"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700130}
131
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700132cleanup() {
133 # Disable die on error.
134 set +e
135
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700136 if [[ -n "$STATEFUL_LOOP_DEV" ]]; then
137 cleanup_stateful_fs_loop
138 fi
139
140 if [[ -n "$LOOP_DEV" ]]; then
141 cleanup_rootfs_loop
142 fi
143
Bill Richardsona81df762010-04-09 08:12:05 -0700144 if [[ -n "$ESP_LOOP_DEV" ]]; then
Bill Richardson8b3bd102010-04-06 15:00:10 -0700145 cleanup_esp_loop
146 fi
147
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700148 # Turn die on error back on.
149 set -e
150}
151
Chris Sosabde8c1b2010-04-29 14:02:35 -0700152delete_prompt() {
153 echo "An error occurred in your build so your latest output directory" \
154 "is invalid."
155 read -p "Would you like to delete the output directory (y/N)? " SURE
156 SURE="${SURE:0:1}" # Get just the first character
157 if [ "${SURE}" == "y" ] ; then
158 sudo rm -rf "$OUTPUT_DIR"
159 echo "Deleted $OUTPUT_DIR"
160 else
161 echo "Not deleting $OUTPUT_DIR. Note dev server updates will not work" \
162 "until you successfully build another image or delete this directory"
163 fi
164}
165
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700166# ${DEV_IMAGE_ROOT} specifies the location of where developer packages will
167# be installed on the stateful dir. On a Chromium OS system, this will
168# translate to /usr/local
169DEV_IMAGE_ROOT=
170
Chris Sosabde8c1b2010-04-29 14:02:35 -0700171trap "cleanup && delete_prompt" EXIT
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700172
173mkdir -p "$ROOT_FS_DIR"
174
175# Create and format the root file system.
176
177# Check for loop device before creating image.
178LOOP_DEV=$(sudo losetup -f)
179if [ -z "$LOOP_DEV" ] ; then
180 echo "No free loop device. Free up a loop device or reboot. exiting. "
181 exit 1
182fi
183
184# Create root file system disk image to fit on a 1GB memory stick.
185# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800186if [[ $FLAGS_factory_install -eq ${FLAGS_TRUE} ]] ; then
187 ROOT_SIZE_BYTES=$((1024 * 1024 * 180))
188else
189 ROOT_SIZE_BYTES=$((1024 * 1024 * 720))
190fi
191
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700192dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
193sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG"
194sudo mkfs.ext3 "$LOOP_DEV"
195
196# Tune and mount rootfs.
197UUID=$(uuidgen)
198DISK_LABEL="C-KEYFOB"
199sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV"
200sudo mount "$LOOP_DEV" "$ROOT_FS_DIR"
201
202# Create stateful partition of the same size as the rootfs.
203STATEFUL_IMG="$OUTPUT_DIR/stateful_partition.image"
204STATEFUL_DIR="$OUTPUT_DIR/stateful_partition"
205STATEFUL_LOOP_DEV=$(sudo losetup -f)
206if [ -z "$STATEFUL_LOOP_DEV" ] ; then
207 echo "No free loop device. Free up a loop device or reboot. exiting. "
208 exit 1
209fi
210dd if=/dev/zero of="$STATEFUL_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1))
211sudo losetup "$STATEFUL_LOOP_DEV" "$STATEFUL_IMG"
212sudo mkfs.ext3 "$STATEFUL_LOOP_DEV"
213sudo tune2fs -L "C-STATE" -U "$UUID" -c 0 -i 0 \
214 "$STATEFUL_LOOP_DEV"
215
216# Mount the stateful partition.
217mkdir -p "$STATEFUL_DIR"
218sudo mount "$STATEFUL_LOOP_DEV" "$STATEFUL_DIR"
219
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700220# Set dev image root now that we have mounted the stateful partition we created
221DEV_IMAGE_ROOT="$STATEFUL_DIR/dev_image"
222
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700223# Turn root file system into bootable image.
224if [[ "$ARCH" = "x86" ]]; then
225 # Setup extlinux configuration.
226 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev
227 # in the initramfs. When we figure that out, switch to root=UUID=$UUID.
228 sudo mkdir -p "$ROOT_FS_DIR"/boot
229 # TODO(adlr): use initramfs for booting.
230 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf
231DEFAULT chromeos-usb
232PROMPT 0
233TIMEOUT 0
234
235label chromeos-usb
236 menu label chromeos-usb
237 kernel vmlinuz
238 append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1
239
240label chromeos-hd
241 menu label chromeos-hd
242 kernel vmlinuz
243 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro noresume noswap i915.modeset=1 loglevel=1
244EOF
245
246 # Make partition bootable and label it.
247 sudo extlinux -z --install "${ROOT_FS_DIR}/boot"
248fi
249
250# -- Install packages into the root file system --
251
252# We need to install libc manually from the cross toolchain.
253# TODO: Improve this? We only want libc and not the whole toolchain.
254PKGDIR="/var/lib/portage/pkgs/cross/"
255sudo tar jxvpf \
256 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \
257 -C "$ROOT_FS_DIR" --strip-components=3 \
258 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o
259
260# We need to install libstdc++ manually from the cross toolchain.
261# TODO: Figure out a better way of doing this?
262sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib"
263sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib"
264
265INSTALL_MASK=""
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700266if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]] ; then
Chris Sosaaa1a7fd2010-04-02 14:06:29 -0700267 INSTALL_MASK="$DEFAULT_INSTALL_MASK"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700268fi
269
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800270# Reduce the size of factory install shim.
271# TODO: Build a separated ebuild for the factory install shim to reduce size.
272if [[ $FLAGS_factory_install -eq ${FLAGS_TRUE} ]] ; then
273 INSTALL_MASK="$INSTALL_MASK $FACTORY_INSTALL_MASK"
274fi
275
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700276if [[ $FLAGS_jobs -ne -1 ]]; then
277 EMERGE_JOBS="--jobs=$FLAGS_jobs"
278fi
279
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700280# Prepare stateful partition with some pre-created directories
281sudo mkdir -p "${DEV_IMAGE_ROOT}"
282sudo mkdir -p "${STATEFUL_DIR}/var"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700283
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700284# Create symlinks so that /usr/local/usr based directories are symlinked to
285# /usr/local/ directories e.g. /usr/local/usr/bin -> /usr/local/bin, etc.
Chris Sosa702618f2010-05-14 12:52:32 -0700286setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" \
287 "${STATEFUL_DIR}"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700288
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700289# Perform binding rather than symlinking because directories must exist
290# on rootfs so that we can bind at run-time since rootfs is read-only
291echo "Binding directories from stateful partition onto the rootfs"
292sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
293sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
294sudo mkdir -p "${ROOT_FS_DIR}/var"
295sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700296
297# We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
298# runtime packages for chrome os. This builds up a chrome os image from binary
299# packages with runtime dependencies only. We use INSTALL_MASK to trim the
300# image size as much as possible.
Ken Mixterd5c4b172010-04-16 10:11:02 -0700301sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700302 --root="$ROOT_FS_DIR" --root-deps=rdeps \
303 --usepkgonly chromeos $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700304
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700305# Determine the root dir for development packages.
306ROOT_DEV_DIR="$ROOT_FS_DIR"
307[ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
308
309# Install development packages.
310if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
Ken Mixterd5c4b172010-04-16 10:11:02 -0700311 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
Chris Sosa4bccd3c2010-03-15 13:23:14 -0700312 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
313 --usepkgonly chromeos-dev $EMERGE_JOBS
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700314
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700315 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
316 # Flag will mount /usr/local on target device
317 sudo mkdir -p "$ROOT_FS_DIR/root"
Chris Sosa3d9a10b2010-04-13 15:00:46 -0700318
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700319 # 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
Bill Richardson4364a2e2010-03-30 14:17:34 -0700323# Extract the kernel from the root filesystem for use by the GPT image. Legacy
Bill Richardson8b3bd102010-04-06 15:00:10 -0700324# BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will
325# use the kernel partition.
Bill Richardson6dcea162010-03-31 19:20:24 -0700326sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700327
Bill Richardson8b3bd102010-04-06 15:00:10 -0700328# Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
329# BIOS). We only need this for x86, but it's simpler and safer to keep the disk
330# images the same for both x86 and ARM.
331ESP_IMG=${OUTPUT_DIR}/esp.image
332# NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code
333# it to 16M for now.
334ESP_BLOCKS=16384
335/usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS}
336ESP_DIR=${OUTPUT_DIR}/esp
Bill Richardsona81df762010-04-09 08:12:05 -0700337ESP_LOOP_DEV=$(sudo losetup -f)
338if [ -z "$ESP_LOOP_DEV" ] ; then
339 echo "No free loop device. Free up a loop device or reboot. exiting. "
340 exit 1
341fi
342mkdir -p "${ESP_DIR}"
343sudo losetup "${ESP_LOOP_DEV}" "${ESP_IMG}"
344sudo mount "${ESP_LOOP_DEV}" "${ESP_DIR}"
345sudo mkdir -p "${ESP_DIR}/efi/boot"
346sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \
Bill Richardson8b3bd102010-04-06 15:00:10 -0700347 part_gpt fat ext2 normal boot sh chain configfile linux
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700348cat <<'EOF' | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg"
Bill Richardson8b3bd102010-04-06 15:00:10 -0700349set default=0
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700350set timeout=2
Bill Richardson8b3bd102010-04-06 15:00:10 -0700351
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700352# NOTE: These magic grub variables are a Chrome OS hack. They are not portable.
353
354menuentry "local image A" {
355 linux $grubpartA/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/$linuxpartA ro noresume noswap i915.modeset=1 loglevel=1
Bill Richardsona81df762010-04-09 08:12:05 -0700356}
357
Bill Richardson9c5e5ec2010-05-14 17:00:21 -0700358menuentry "local image B" {
359 linux $grubpartB/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/$linuxpartB ro noresume noswap i915.modeset=1 loglevel=1
Bill Richardson041bd712010-04-27 09:36:14 -0700360}
361
Bill Richardson8b3bd102010-04-06 15:00:10 -0700362EOF
363
Chris Sosa5c37ce22010-05-03 20:18:02 -0700364# By default, dev mode should be activated for either development builds or
365# test builds.
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800366if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
Chris Sosa5c37ce22010-05-03 20:18:02 -0700367 sudo touch "$ROOT_FS_DIR/root/.dev_mode"
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700368
Chris Sosa5c37ce22010-05-03 20:18:02 -0700369 # Re-run ldconfig to fix /etc/ldconfig.so.cache.
370 sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700371fi
372
Chris Sosa3f21b992010-05-10 16:34:47 -0700373# Perform any customizations on the root file system that are needed.
Chris Sosa503efe12010-04-08 10:05:46 -0700374"${SCRIPTS_DIR}/customize_rootfs" \
375 --root="$ROOT_FS_DIR" \
376 --target="$ARCH" \
Chris Sosa3f21b992010-05-10 16:34:47 -0700377 --board="$BOARD"
Chris Sosa503efe12010-04-08 10:05:46 -0700378
Tom Wai-Hong Tamf87a3672010-05-17 16:06:33 +0800379# Don't test the factory install shim.
380if [[ $FLAGS_factory_install -eq ${FLAGS_FALSE} ]] ; then
381 # Check that the image has been correctly created.
382 "${SCRIPTS_DIR}/test_image" \
383 --root="$ROOT_FS_DIR" \
384 --target="$ARCH"
385fi
Chris Sosa503efe12010-04-08 10:05:46 -0700386
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700387# Clean up symlinks so they work on a running target rooted at "/".
388# Here development packages are rooted at /usr/local. However, do not
389# create /usr/local or /var on host (already exist on target).
Chris Sosa702618f2010-05-14 12:52:32 -0700390setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700391
392# Cleanup loop devices.
Chris Sosa4bffb8b2010-04-07 17:23:54 -0700393cleanup
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700394
Chris Sosabde8c1b2010-04-29 14:02:35 -0700395trap delete_prompt EXIT
396
Bill Richardson4364a2e2010-03-30 14:17:34 -0700397# Create the GPT-formatted image
398${SCRIPTS_DIR}/build_gpt.sh \
robotboyb75eee32010-04-30 09:51:23 -0700399 --arch=${ARCH} \
400 --board=${FLAGS_board} \
401 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \
402 "${OUTPUT_DIR}" \
403 "${OUTPUT_IMG}"
Bill Richardson4364a2e2010-03-30 14:17:34 -0700404
Bill Richardson6dcea162010-03-31 19:20:24 -0700405# Clean up temporary files.
Bill Richardson8b3bd102010-04-06 15:00:10 -0700406rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
407 "${ESP_IMG}"
408rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700409
410OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
411echo "Done. Image created in ${OUTPUT_DIR}"
412echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
Daniel Eratdd9818a2010-04-26 09:16:44 -0700413echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
Bill Richardsonc09b94f2010-03-15 11:40:30 -0700414echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
415echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
416echo "from the scripts directory where you entered the chroot."
417
418trap - EXIT