Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: build_image

Issue 2724014: Prototype faster build (kind of ugly) (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: remove timer Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mod_image_for_test.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to build a bootable keyfob-based chromeos system image from within 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 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 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. 10 # build the Chrome OS image using only pre-built binary packages.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if [ -z "$FLAGS_board" ] ; then 62 if [ -z "$FLAGS_board" ] ; then
63 error "--board is required." 63 error "--board is required."
64 exit 1 64 exit 1
65 fi 65 fi
66 66
67 if [ "$FLAGS_rootfs_size" -gt "$FLAGS_rootfs_partition_size" ] ; then 67 if [ "$FLAGS_rootfs_size" -gt "$FLAGS_rootfs_partition_size" ] ; then
68 error "rootfs (${FLAGS_rootfs_size} MB) is bigger than partition (${FLAGS_root fs_partition_size} MB)." 68 error "rootfs (${FLAGS_rootfs_size} MB) is bigger than partition (${FLAGS_root fs_partition_size} MB)."
69 exit 1 69 exit 1
70 fi 70 fi
71 71
72 EMERGE_CMD="emerge"
73 EMERGE_BOARD_CMD="emerge-${FLAGS_board}"
74 TOP_SCRIPTS_DIR="$(dirname $0)"
75 if [ -e "${TOP_SCRIPTS_DIR}/.emerge" ]; then
76 echo "Using alternate emerge"
77 . "${TOP_SCRIPTS_DIR}/.emerge"
78 fi
79
72 # Determine build version. 80 # Determine build version.
73 . "${SCRIPTS_DIR}/chromeos_version.sh" 81 . "${SCRIPTS_DIR}/chromeos_version.sh"
74 82
75 # Use canonical path since some tools (e.g. mount) do not like symlinks. 83 # Use canonical path since some tools (e.g. mount) do not like symlinks.
76 # Append build attempt to output directory. 84 # Append build attempt to output directory.
77 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" 85 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
78 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}" 86 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}"
79 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs" 87 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
80 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" 88 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
81 89
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 $SCRIPTS_DIR/mount_gpt_image.sh --from "$OUTPUT_DIR" \ 234 $SCRIPTS_DIR/mount_gpt_image.sh --from "$OUTPUT_DIR" \
227 --image "$image_to_mount" -r "$root_fs_dir" -s "$stateful_dir" 235 --image "$image_to_mount" -r "$root_fs_dir" -s "$stateful_dir"
228 236
229 if [ "$image_type" == "dev" ]; then 237 if [ "$image_type" == "dev" ]; then
230 # Determine the root dir for developer packages. 238 # Determine the root dir for developer packages.
231 local root_dev_dir="$root_fs_dir" 239 local root_dev_dir="$root_fs_dir"
232 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && \ 240 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && \
233 root_dev_dir="$root_fs_dir/usr/local" 241 root_dev_dir="$root_fs_dir/usr/local"
234 242
235 # Install developer packages described in chromeos-dev. 243 # Install developer packages described in chromeos-dev.
236 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 244 sudo INSTALL_MASK="$INSTALL_MASK" ${EMERGE_BOARD_CMD} \
237 --root="$root_dev_dir" --root-deps=rdeps \ 245 --root="$root_dev_dir" --root-deps=rdeps \
238 --usepkgonly chromeos-dev $EMERGE_JOBS 246 --usepkgonly chromeos-dev $EMERGE_JOBS
239 elif [ "$image_type" == "recovery" ]; then 247 elif [ "$image_type" == "recovery" ]; then
240 # Install recovery installer 248 # Install recovery installer
241 sudo emerge-${BOARD} --root=$root_fs_dir --usepkgonly \ 249 sudo ${EMERGE_BOARD_CMD} --root=$root_fs_dir --usepkgonly \
242 --root-deps=rdeps --nodeps chromeos-recovery 250 --root-deps=rdeps --nodeps chromeos-recovery
243 fi 251 fi
244 252
245 # Re-run ldconfig to fix /etc/ldconfig.so.cache. 253 # Re-run ldconfig to fix /etc/ldconfig.so.cache.
246 sudo /sbin/ldconfig -r "$root_fs_dir" 254 sudo /sbin/ldconfig -r "$root_fs_dir"
247 255
248 # Mark the image as a developer image (input to chromeos_startup). 256 # Mark the image as a developer image (input to chromeos_startup).
249 sudo mkdir -p "$root_fs_dir/root" 257 sudo mkdir -p "$root_fs_dir/root"
250 sudo touch "$root_fs_dir/root/$file_to_touch" 258 sudo touch "$root_fs_dir/root/$file_to_touch"
251 259
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" \ 407 setup_symlinks_on_root "${DEV_IMAGE_ROOT}" "${STATEFUL_DIR}/var" \
400 "${STATEFUL_DIR}" 408 "${STATEFUL_DIR}"
401 409
402 # Perform binding rather than symlinking because directories must exist 410 # Perform binding rather than symlinking because directories must exist
403 # on rootfs so that we can bind at run-time since rootfs is read-only 411 # on rootfs so that we can bind at run-time since rootfs is read-only
404 echo "Binding directories from stateful partition onto the rootfs" 412 echo "Binding directories from stateful partition onto the rootfs"
405 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" 413 sudo mkdir -p "${ROOT_FS_DIR}/usr/local"
406 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" 414 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local"
407 sudo mkdir -p "${ROOT_FS_DIR}/var" 415 sudo mkdir -p "${ROOT_FS_DIR}/var"
408 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var" 416 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var"
417 sudo mkdir -p "${ROOT_FS_DIR}/dev"
409 418
410 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the 419 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
411 # runtime packages for chrome os. This builds up a chrome os image from binary 420 # runtime packages for chrome os. This builds up a chrome os image from binary
412 # packages with runtime dependencies only. We use INSTALL_MASK to trim the 421 # packages with runtime dependencies only. We use INSTALL_MASK to trim the
413 # image size as much as possible. 422 # image size as much as possible.
414 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 423 sudo INSTALL_MASK="$INSTALL_MASK" ${EMERGE_BOARD_CMD} \
415 --root="$ROOT_FS_DIR" --root-deps=rdeps \ 424 --root="$ROOT_FS_DIR" --root-deps=rdeps \
416 --usepkgonly chromeos $EMERGE_JOBS 425 --usepkgonly chromeos $EMERGE_JOBS
417 426
418 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI 427 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
419 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk 428 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk
420 # images the same for both x86 and ARM. 429 # images the same for both x86 and ARM.
421 ESP_IMG=${OUTPUT_DIR}/esp.image 430 ESP_IMG=${OUTPUT_DIR}/esp.image
422 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code 431 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code
423 # it to 16M for now. 432 # it to 16M for now.
424 ESP_BLOCKS=16384 433 ESP_BLOCKS=16384
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 set +x 569 set +x
561 570
562 echo "Done. Image created in ${OUTPUT_DIR}" 571 echo "Done. Image created in ${OUTPUT_DIR}"
563 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME" 572 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME"
564 if [ "$FLAGS_recovery" -eq "$FLAGS_TRUE" ]; then 573 if [ "$FLAGS_recovery" -eq "$FLAGS_TRUE" ]; then
565 echo "Recovery image created as $PRISTINE_IMAGE_NAME" 574 echo "Recovery image created as $PRISTINE_IMAGE_NAME"
566 fi 575 fi
567 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then 576 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then
568 echo "Developer image created as $DEVELOPER_IMAGE_NAME" 577 echo "Developer image created as $DEVELOPER_IMAGE_NAME"
569 fi 578 fi
579
570 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" 580 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
571 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" 581 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
572 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" 582 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
573 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 583 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
574 echo "from the scripts directory where you entered the chroot." 584 echo "from the scripts directory where you entered the chroot."
OLDNEW
« no previous file with comments | « no previous file | mod_image_for_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698