| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 "How many packages to build in parallel at maximum." | 42 "How many packages to build in parallel at maximum." |
| 43 DEFINE_boolean statefuldev ${FLAGS_TRUE} \ | 43 DEFINE_boolean statefuldev ${FLAGS_TRUE} \ |
| 44 "Install development packages on stateful partition rather than the rootfs" | 44 "Install development packages on stateful partition rather than the rootfs" |
| 45 DEFINE_string to "" \ | 45 DEFINE_string to "" \ |
| 46 "The target image file or device" | 46 "The target image file or device" |
| 47 DEFINE_boolean factory_install ${FLAGS_FALSE} \ | 47 DEFINE_boolean factory_install ${FLAGS_FALSE} \ |
| 48 "Build a smaller image to overlay the factory install shim on; this argument \ | 48 "Build a smaller image to overlay the factory install shim on; this argument \ |
| 49 is also required in image_to_usb." | 49 is also required in image_to_usb." |
| 50 DEFINE_boolean dev_install ${FLAGS_FALSE} \ | 50 DEFINE_boolean dev_install ${FLAGS_FALSE} \ |
| 51 "Build a smaller image to overlay the dev recovery install shim on" | 51 "Build a smaller image to overlay the dev recovery install shim on" |
| 52 DEFINE_string arm_extra_bootargs "" \ | |
| 53 "Additional command line options to pass to the ARM kernel." | |
| 54 DEFINE_integer rootfs_partition_size 1024 \ | 52 DEFINE_integer rootfs_partition_size 1024 \ |
| 55 "rootfs partition size in MiBs." | 53 "rootfs partition size in MiBs." |
| 56 DEFINE_integer rootfs_size 720 \ | 54 DEFINE_integer rootfs_size 720 \ |
| 57 "rootfs filesystem size in MiBs." | 55 "rootfs filesystem size in MiBs." |
| 58 # ceil(0.1 * rootfs_size) is a good minimum. | 56 # ceil(0.1 * rootfs_size) is a good minimum. |
| 59 DEFINE_integer rootfs_hash_pad 8 \ | 57 DEFINE_integer rootfs_hash_pad 8 \ |
| 60 "MiBs reserved at the end of the rootfs image." | 58 "MiBs reserved at the end of the rootfs image." |
| 61 DEFINE_integer statefulfs_size 1024 \ | 59 DEFINE_integer statefulfs_size 1024 \ |
| 62 "stateful filesystem size in MiBs." | 60 "stateful filesystem size in MiBs." |
| 63 DEFINE_boolean preserve ${FLAGS_FALSE} \ | 61 DEFINE_boolean preserve ${FLAGS_FALSE} \ |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 --rootfs_hash="${ROOT_FS_HASH}" | 351 --rootfs_hash="${ROOT_FS_HASH}" |
| 354 --rootfs_mountpoint="${ROOT_FS_DIR}" | 352 --rootfs_mountpoint="${ROOT_FS_DIR}" |
| 355 --statefulfs_mountpoint="${STATEFUL_FS_DIR}" | 353 --statefulfs_mountpoint="${STATEFUL_FS_DIR}" |
| 356 --espfs_mountpoint="${ESP_FS_DIR}" | 354 --espfs_mountpoint="${ESP_FS_DIR}" |
| 357 --verity_error_behavior="${FLAGS_verity_error_behavior}" | 355 --verity_error_behavior="${FLAGS_verity_error_behavior}" |
| 358 --verity_depth="${FLAGS_verity_depth}" | 356 --verity_depth="${FLAGS_verity_depth}" |
| 359 --verity_max_ios="${FLAGS_verity_max_ios}" | 357 --verity_max_ios="${FLAGS_verity_max_ios}" |
| 360 --verity_algorithm="${FLAGS_verity_algorithm}" | 358 --verity_algorithm="${FLAGS_verity_algorithm}" |
| 361 --keys_dir="${DEVKEYSDIR}" | 359 --keys_dir="${DEVKEYSDIR}" |
| 362 --usb_disk="${FLAGS_usb_disk}" | 360 --usb_disk="${FLAGS_usb_disk}" |
| 363 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" | |
| 364 --nocleanup_dirs | 361 --nocleanup_dirs |
| 365 ${enable_rootfs_verification_flag} | 362 ${enable_rootfs_verification_flag} |
| 366 EOF | 363 EOF |
| 367 } | 364 } |
| 368 | 365 |
| 369 # Modifies an existing image to add development packages | 366 # Modifies an existing image to add development packages |
| 370 update_dev_packages() { | 367 update_dev_packages() { |
| 371 local image_name=$1 | 368 local image_name=$1 |
| 372 | 369 |
| 373 echo "Adding developer packages to ${image_name}" | 370 echo "Adding developer packages to ${image_name}" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 --target="${ARCH}" | 627 --target="${ARCH}" |
| 631 fi | 628 fi |
| 632 | 629 |
| 633 # Clean up symlinks so they work on a running target rooted at "/". | 630 # Clean up symlinks so they work on a running target rooted at "/". |
| 634 # Here development packages are rooted at /usr/local. However, do not | 631 # Here development packages are rooted at /usr/local. However, do not |
| 635 # create /usr/local or /var on host (already exist on target). | 632 # create /usr/local or /var on host (already exist on target). |
| 636 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}" | 633 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}" |
| 637 | 634 |
| 638 # cros_make_image_bootable will clobber vmlinuz.image for x86. | 635 # cros_make_image_bootable will clobber vmlinuz.image for x86. |
| 639 # Until then, just copy the kernel to vmlinuz.image. It is | 636 # Until then, just copy the kernel to vmlinuz.image. It is |
| 640 # expected in build_gpt.sh and needed by ARM until it supports the | 637 # expected in build_gpt.sh. |
| 641 # full, signed kernel partition format. | |
| 642 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | 638 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" |
| 643 | 639 |
| 644 # Create an empty esp image to be updated in by update_bootloaders.sh. | 640 # Create an empty esp image to be updated in by update_bootloaders.sh. |
| 645 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" | 641 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" |
| 646 | 642 |
| 647 cleanup | 643 cleanup |
| 648 | 644 |
| 649 trap delete_prompt EXIT | 645 trap delete_prompt EXIT |
| 650 | 646 |
| 651 # Create the GPT-formatted image. | 647 # Create the GPT-formatted image. |
| 652 ${SCRIPTS_DIR}/build_gpt.sh \ | 648 ${SCRIPTS_DIR}/build_gpt.sh \ |
| 653 --arch=${ARCH} \ | 649 --arch=${ARCH} \ |
| 654 --board=${FLAGS_board} \ | 650 --board=${FLAGS_board} \ |
| 655 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ | |
| 656 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ | 651 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ |
| 657 "${OUTPUT_DIR}" \ | 652 "${OUTPUT_DIR}" \ |
| 658 "${OUTPUT_DIR}/${image_name}" | 653 "${OUTPUT_DIR}/${image_name}" |
| 659 | 654 |
| 660 # Pre-set "sucessful" bit in gpt, so we will never mark-for-death | 655 # Pre-set "sucessful" bit in gpt, so we will never mark-for-death |
| 661 # a partition on an SDCard/USB stick. | 656 # a partition on an SDCard/USB stick. |
| 662 ${GPT} add -i 2 -S 1 "${OUTPUT_DIR}/${image_name}" | 657 ${GPT} add -i 2 -S 1 "${OUTPUT_DIR}/${image_name}" |
| 663 | 658 |
| 664 trap - EXIT | 659 trap - EXIT |
| 665 } | 660 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 749 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
| 755 fi | 750 fi |
| 756 | 751 |
| 757 print_time_elapsed | 752 print_time_elapsed |
| 758 | 753 |
| 759 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 754 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 760 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 755 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 761 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 756 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
| 762 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 757 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
| 763 echo "from the scripts directory where you entered the chroot." | 758 echo "from the scripts directory where you entered the chroot." |
| OLD | NEW |