| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 # ceil(0.1 * rootfs_size) is a good minimum. | 56 # ceil(0.1 * rootfs_size) is a good minimum. |
| 57 DEFINE_integer rootfs_hash_pad 8 \ | 57 DEFINE_integer rootfs_hash_pad 8 \ |
| 58 "MiBs reserved at the end of the rootfs image." | 58 "MiBs reserved at the end of the rootfs image." |
| 59 DEFINE_integer statefulfs_size 1024 \ | 59 DEFINE_integer statefulfs_size 1024 \ |
| 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 DEFINE_string boot_args "noinitrd" \ |
| 67 "Additional boot arguments to pass to the commandline" |
| 66 | 68 |
| 67 DEFINE_string usb_disk /dev/sdb3 \ | 69 DEFINE_string usb_disk /dev/sdb3 \ |
| 68 "Path syslinux should use to do a usb boot. Default: /dev/sdb3" | 70 "Path syslinux should use to do a usb boot. Default: /dev/sdb3" |
| 69 | 71 |
| 70 DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ | 72 DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ |
| 71 "Default all bootloaders to use kernel-based root fs integrity checking." | 73 "Default all bootloaders to use kernel-based root fs integrity checking." |
| 72 DEFINE_integer verity_error_behavior 1 \ | 74 DEFINE_integer verity_error_behavior 1 \ |
| 73 "Kernel verified boot error behavior (0: I/O errors, 1: panic, 2: nothing) \ | 75 "Kernel verified boot error behavior (0: I/O errors, 1: panic, 2: nothing) \ |
| 74 Default: 1" | 76 Default: 1" |
| 75 DEFINE_integer verity_depth 1 \ | 77 DEFINE_integer verity_depth 1 \ |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}" | 341 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}" |
| 340 delete_prompt | 342 delete_prompt |
| 341 } | 343 } |
| 342 | 344 |
| 343 # Takes no arguments and populates the configuration for | 345 # Takes no arguments and populates the configuration for |
| 344 # cros_make_image_bootable. | 346 # cros_make_image_bootable. |
| 345 create_boot_desc() { | 347 create_boot_desc() { |
| 346 cat <<EOF > ${OUTPUT_DIR}/boot.desc | 348 cat <<EOF > ${OUTPUT_DIR}/boot.desc |
| 347 --arch="${ARCH}" | 349 --arch="${ARCH}" |
| 348 --output_dir="${OUTPUT_DIR}" | 350 --output_dir="${OUTPUT_DIR}" |
| 351 --boot_args="${FLAGS_boot_args}" |
| 349 --rootfs_size="${FLAGS_rootfs_size}" | 352 --rootfs_size="${FLAGS_rootfs_size}" |
| 350 --rootfs_hash_pad="${FLAGS_rootfs_hash_pad}" | 353 --rootfs_hash_pad="${FLAGS_rootfs_hash_pad}" |
| 351 --rootfs_hash="${ROOT_FS_HASH}" | 354 --rootfs_hash="${ROOT_FS_HASH}" |
| 352 --rootfs_mountpoint="${ROOT_FS_DIR}" | 355 --rootfs_mountpoint="${ROOT_FS_DIR}" |
| 353 --statefulfs_mountpoint="${STATEFUL_FS_DIR}" | 356 --statefulfs_mountpoint="${STATEFUL_FS_DIR}" |
| 354 --espfs_mountpoint="${ESP_FS_DIR}" | 357 --espfs_mountpoint="${ESP_FS_DIR}" |
| 355 --verity_error_behavior="${FLAGS_verity_error_behavior}" | 358 --verity_error_behavior="${FLAGS_verity_error_behavior}" |
| 356 --verity_depth="${FLAGS_verity_depth}" | 359 --verity_depth="${FLAGS_verity_depth}" |
| 357 --verity_max_ios="${FLAGS_verity_max_ios}" | 360 --verity_max_ios="${FLAGS_verity_max_ios}" |
| 358 --verity_algorithm="${FLAGS_verity_algorithm}" | 361 --verity_algorithm="${FLAGS_verity_algorithm}" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 # on update. | 611 # on update. |
| 609 # (This script does not populate vmlinuz.A and .B needed by syslinux.) | 612 # (This script does not populate vmlinuz.A and .B needed by syslinux.) |
| 610 enable_rootfs_verification= | 613 enable_rootfs_verification= |
| 611 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then | 614 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
| 612 enable_rootfs_verification="--enable_rootfs_verification" | 615 enable_rootfs_verification="--enable_rootfs_verification" |
| 613 fi | 616 fi |
| 614 | 617 |
| 615 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \ | 618 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \ |
| 616 --arch=${ARCH} \ | 619 --arch=${ARCH} \ |
| 617 --to="${ROOT_FS_DIR}"/boot \ | 620 --to="${ROOT_FS_DIR}"/boot \ |
| 621 --boot_args="${FLAGS_boot_args}" \ |
| 618 --install \ | 622 --install \ |
| 619 ${enable_rootfs_verification} | 623 ${enable_rootfs_verification} |
| 620 | 624 |
| 621 # Don't test the factory install shim or the dev install shim | 625 # Don't test the factory install shim or the dev install shim |
| 622 if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ] && | 626 if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ] && |
| 623 [ ${FLAGS_dev_install} -eq ${FLAGS_FALSE} ]; then | 627 [ ${FLAGS_dev_install} -eq ${FLAGS_FALSE} ]; then |
| 624 # Check that the image has been correctly created. | 628 # Check that the image has been correctly created. |
| 625 "${SCRIPTS_DIR}/test_image" \ | 629 "${SCRIPTS_DIR}/test_image" \ |
| 626 --root="${ROOT_FS_DIR}" \ | 630 --root="${ROOT_FS_DIR}" \ |
| 627 --target="${ARCH}" | 631 --target="${ARCH}" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 753 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
| 750 fi | 754 fi |
| 751 | 755 |
| 752 print_time_elapsed | 756 print_time_elapsed |
| 753 | 757 |
| 754 echo "To copy to USB keyfob, do something like:" | 758 echo "To copy to USB keyfob, do something like:" |
| 755 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 759 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 756 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 760 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
| 757 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 761 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
| 758 echo "from the scripts directory where you entered the chroot." | 762 echo "from the scripts directory where you entered the chroot." |
| OLD | NEW |