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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 "stateful filesystem size in MiBs." | 60 "stateful filesystem size in MiBs." |
61 DEFINE_boolean preserve ${FLAGS_FALSE} \ | 61 DEFINE_boolean preserve ${FLAGS_FALSE} \ |
62 "Attempt to preserve the previous build image if one can be found (unstable, \ | 62 "Attempt to preserve the previous build image if one can be found (unstable, \ |
63 kernel/firmware not updated)" | 63 kernel/firmware not updated)" |
64 DEFINE_boolean fast ${DEFAULT_FAST} \ | 64 DEFINE_boolean fast ${DEFAULT_FAST} \ |
65 "Call many emerges in parallel" | 65 "Call many emerges in parallel" |
66 | 66 |
67 DEFINE_string usb_disk /dev/sdb3 \ | 67 DEFINE_string usb_disk /dev/sdb3 \ |
68 "Path syslinux should use to do a usb boot. Default: /dev/sdb3" | 68 "Path syslinux should use to do a usb boot. Default: /dev/sdb3" |
69 | 69 |
70 DEFINE_boolean enable_rootfs_verification ${FLAGS_FALSE} \ | 70 DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ |
71 "Default all bootloaders to use kernel-based root fs integrity checking." | 71 "Default all bootloaders to use kernel-based root fs integrity checking." |
72 DEFINE_integer verity_error_behavior 2 \ | 72 DEFINE_integer verity_error_behavior 2 \ |
73 "Kernel verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \ | 73 "Kernel verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \ |
74 Default: 2" | 74 Default: 2" |
75 DEFINE_integer verity_depth 1 \ | 75 DEFINE_integer verity_depth 1 \ |
76 "Kernel verified boot hash tree depth. Default: 1" | 76 "Kernel verified boot hash tree depth. Default: 1" |
77 DEFINE_integer verity_max_ios 1024 \ | 77 DEFINE_integer verity_max_ios 1024 \ |
78 "Number of outstanding I/O operations dm-verity caps at. Default: 1024" | 78 "Number of outstanding I/O operations dm-verity caps at. Default: 1024" |
79 DEFINE_string verity_algorithm "sha1" \ | 79 DEFINE_string verity_algorithm "sha1" \ |
80 "Cryptographic hash algorithm used for kernel vboot. Default : sha1" | 80 "Cryptographic hash algorithm used for kernel vboot. Default : sha1" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 # TODO: Build a separated ebuild for the factory install shim to reduce size. | 194 # TODO: Build a separated ebuild for the factory install shim to reduce size. |
195 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] || | 195 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] || |
196 [ ${FLAGS_dev_install} -eq ${FLAGS_TRUE} ] ; then | 196 [ ${FLAGS_dev_install} -eq ${FLAGS_TRUE} ] ; then |
197 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" | 197 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" |
198 fi | 198 fi |
199 | 199 |
200 if [[ ${FLAGS_jobs} -ne -1 ]]; then | 200 if [[ ${FLAGS_jobs} -ne -1 ]]; then |
201 EMERGE_JOBS="--jobs=${FLAGS_jobs}" | 201 EMERGE_JOBS="--jobs=${FLAGS_jobs}" |
202 fi | 202 fi |
203 | 203 |
204 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then | |
205 enable_rootfs_verification_flag="--enable_rootfs_verification" | |
206 fi | |
207 | |
208 # Figure out ARCH from the given toolchain. | 204 # Figure out ARCH from the given toolchain. |
209 # TODO: Move to common.sh as a function after scripts are switched over. | 205 # TODO: Move to common.sh as a function after scripts are switched over. |
210 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') | 206 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') |
211 case "${TC_ARCH}" in | 207 case "${TC_ARCH}" in |
212 arm*) | 208 arm*) |
213 ARCH="arm" | 209 ARCH="arm" |
214 ;; | 210 ;; |
215 *86) | 211 *86) |
216 ARCH="x86" | 212 ARCH="x86" |
217 ;; | 213 ;; |
218 *) | 214 *) |
219 error "Unable to determine ARCH from toolchain: ${CHOST}" | 215 error "Unable to determine ARCH from toolchain: ${CHOST}" |
220 exit 1 | 216 exit 1 |
221 esac | 217 esac |
222 | 218 |
| 219 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
| 220 enable_rootfs_verification_flag="--enable_rootfs_verification" |
| 221 # Comment out this section if you need to start testing vboot on arm. |
| 222 if [[ "${ARCH}" = "arm" ]]; then |
| 223 warn "ARM does not yet support --enable_rootfs_verification" |
| 224 warn "Root filesystem verification has been disabled." |
| 225 enable_rootfs_verification_flag= |
| 226 FLAGS_enable_rootfs_verification_flag=${FLAGS_FALSE} |
| 227 fi |
| 228 fi |
| 229 |
223 # Hack to fix bug where x86_64 CHOST line gets incorrectly added. | 230 # Hack to fix bug where x86_64 CHOST line gets incorrectly added. |
224 # ToDo(msb): remove this hack. | 231 # ToDo(msb): remove this hack. |
225 PACKAGES_FILE="${BOARD_ROOT}/packages/Packages" | 232 PACKAGES_FILE="${BOARD_ROOT}/packages/Packages" |
226 sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}" | 233 sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}" |
227 | 234 |
228 # Handle existing directory. | 235 # Handle existing directory. |
229 if [[ -e "${OUTPUT_DIR}" ]]; then | 236 if [[ -e "${OUTPUT_DIR}" ]]; then |
230 if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then | 237 if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then |
231 sudo rm -rf "${OUTPUT_DIR}" | 238 sudo rm -rf "${OUTPUT_DIR}" |
232 else | 239 else |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 723 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
717 fi | 724 fi |
718 | 725 |
719 print_time_elapsed | 726 print_time_elapsed |
720 | 727 |
721 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 728 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
722 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 729 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
723 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 730 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
724 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" | 731 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" |
725 echo "from the scripts directory where you entered the chroot." | 732 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |