| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 "Additional command line options to pass to the ARM kernel." | 46 "Additional command line options to pass to the ARM kernel." |
| 47 DEFINE_integer rootfs_partition_size 1024 \ | 47 DEFINE_integer rootfs_partition_size 1024 \ |
| 48 "rootfs parition size in MBs." | 48 "rootfs parition size in MBs." |
| 49 DEFINE_integer rootfs_size 720 \ | 49 DEFINE_integer rootfs_size 720 \ |
| 50 "rootfs filesystem size in MBs." | 50 "rootfs filesystem size in MBs." |
| 51 DEFINE_integer statefulfs_size 1024 \ | 51 DEFINE_integer statefulfs_size 1024 \ |
| 52 "stateful filesystem size in MBs." | 52 "stateful filesystem size in MBs." |
| 53 DEFINE_boolean preserve ${FLAGS_FALSE} \ | 53 DEFINE_boolean preserve ${FLAGS_FALSE} \ |
| 54 "Attempt to preserve the previous build image if one can be found (unstable, \ | 54 "Attempt to preserve the previous build image if one can be found (unstable, \ |
| 55 kernel/firmware not updated)" | 55 kernel/firmware not updated)" |
| 56 DEFINE_boolean fast ${FLAGS_FALSE} \ |
| 57 "Call many emerges in parallel (unstable)" |
| 58 |
| 56 | 59 |
| 57 # Parse command line. | 60 # Parse command line. |
| 58 FLAGS "$@" || exit 1 | 61 FLAGS "$@" || exit 1 |
| 59 eval set -- "${FLAGS_ARGV}" | 62 eval set -- "${FLAGS_ARGV}" |
| 60 | 63 |
| 61 # Only now can we die on error. shflags functions leak non-zero error codes, | 64 # Only now can we die on error. shflags functions leak non-zero error codes, |
| 62 # so will die prematurely if 'set -e' is specified before now. | 65 # so will die prematurely if 'set -e' is specified before now. |
| 63 set -e | 66 set -e |
| 64 | 67 |
| 65 if [ -z "${FLAGS_board}" ] ; then | 68 if [ -z "${FLAGS_board}" ] ; then |
| 66 error "--board is required." | 69 error "--board is required." |
| 67 exit 1 | 70 exit 1 |
| 68 fi | 71 fi |
| 69 | 72 |
| 70 if [ "${FLAGS_rootfs_size}" -gt "${FLAGS_rootfs_partition_size}" ] ; then | 73 if [ "${FLAGS_rootfs_size}" -gt "${FLAGS_rootfs_partition_size}" ] ; then |
| 71 error "rootfs (${FLAGS_rootfs_size} MB) is bigger than partition (${FLAGS_root
fs_partition_size} MB)." | 74 error "rootfs (${FLAGS_rootfs_size} MB) is bigger than partition (${FLAGS_root
fs_partition_size} MB)." |
| 72 exit 1 | 75 exit 1 |
| 73 fi | 76 fi |
| 74 | 77 |
| 75 EMERGE_CMD="emerge" | |
| 76 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" | 78 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" |
| 77 TOP_SCRIPTS_DIR="$(dirname $0)" | 79 if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then |
| 78 if [ -e "${TOP_SCRIPTS_DIR}/.emerge" ]; then | |
| 79 echo "Using alternate emerge" | 80 echo "Using alternate emerge" |
| 80 . "${TOP_SCRIPTS_DIR}/.emerge" | 81 EMERGE_BOARD_CMD="${SCRIPTS_DIR}/parallel_emerge --board=${FLAGS_board}" |
| 81 fi | 82 fi |
| 82 | 83 |
| 83 # Determine build version. | 84 # Determine build version. |
| 84 . "${SCRIPTS_DIR}/chromeos_version.sh" | 85 . "${SCRIPTS_DIR}/chromeos_version.sh" |
| 85 | 86 |
| 86 # Use canonical path since some tools (e.g. mount) do not like symlinks. | 87 # Use canonical path since some tools (e.g. mount) do not like symlinks. |
| 87 # Append build attempt to output directory. | 88 # Append build attempt to output directory. |
| 88 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" | 89 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" |
| 89 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}" | 90 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}" |
| 90 | 91 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 614 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
| 614 fi | 615 fi |
| 615 | 616 |
| 616 print_time_elapsed | 617 print_time_elapsed |
| 617 | 618 |
| 618 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 619 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 619 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 620 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 620 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 621 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
| 621 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 622 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 622 echo "from the scripts directory where you entered the chroot." | 623 echo "from the scripts directory where you entered the chroot." |
| OLD | NEW |