| 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 25 matching lines...) Expand all Loading... |
| 36 DEFINE_integer jobs -1 \ | 36 DEFINE_integer jobs -1 \ |
| 37 "How many packages to build in parallel at maximum." | 37 "How many packages to build in parallel at maximum." |
| 38 DEFINE_boolean statefuldev $FLAGS_FALSE \ | 38 DEFINE_boolean statefuldev $FLAGS_FALSE \ |
| 39 "Install development packages on stateful partition rather than the rootfs" | 39 "Install development packages on stateful partition rather than the rootfs" |
| 40 DEFINE_string to "" \ | 40 DEFINE_string to "" \ |
| 41 "The target image file or device" | 41 "The target image file or device" |
| 42 DEFINE_boolean withtest $FLAGS_FALSE \ | 42 DEFINE_boolean withtest $FLAGS_FALSE \ |
| 43 "Include packages required for testing and prepare image for testing" | 43 "Include packages required for testing and prepare image for testing" |
| 44 DEFINE_string factory_server "" \ | 44 DEFINE_string factory_server "" \ |
| 45 "Build a factory install image pointing to given server." | 45 "Build a factory install image pointing to given server." |
| 46 DEFINE_string arm_extra_bootargs "" \ |
| 47 "Additional command line options to pass to the ARM kernel." |
| 46 | 48 |
| 47 # Parse command line. | 49 # Parse command line. |
| 48 FLAGS "$@" || exit 1 | 50 FLAGS "$@" || exit 1 |
| 49 eval set -- "${FLAGS_ARGV}" | 51 eval set -- "${FLAGS_ARGV}" |
| 50 | 52 |
| 51 # Only now can we die on error. shflags functions leak non-zero error codes, | 53 # Only now can we die on error. shflags functions leak non-zero error codes, |
| 52 # so will die prematurely if 'set -e' is specified before now. | 54 # so will die prematurely if 'set -e' is specified before now. |
| 53 set -e | 55 set -e |
| 54 | 56 |
| 55 if [ -z "$FLAGS_board" ] ; then | 57 if [ -z "$FLAGS_board" ] ; then |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 # Clean up symlinks so they work on a running target rooted at "/". | 417 # Clean up symlinks so they work on a running target rooted at "/". |
| 416 # Here development packages are rooted at /usr/local. However, do not | 418 # Here development packages are rooted at /usr/local. However, do not |
| 417 # create /usr/local or /var on host (already exist on target). | 419 # create /usr/local or /var on host (already exist on target). |
| 418 setup_symlinks_on_root "/usr/local" "/var" | 420 setup_symlinks_on_root "/usr/local" "/var" |
| 419 | 421 |
| 420 # Cleanup loop devices. | 422 # Cleanup loop devices. |
| 421 cleanup | 423 cleanup |
| 422 | 424 |
| 423 # Create the GPT-formatted image | 425 # Create the GPT-formatted image |
| 424 ${SCRIPTS_DIR}/build_gpt.sh \ | 426 ${SCRIPTS_DIR}/build_gpt.sh \ |
| 425 --arch=${ARCH} --board=${FLAGS_board} "${OUTPUT_DIR}" "${OUTPUT_IMG}" | 427 --arch=${ARCH} \ |
| 428 --board=${FLAGS_board} \ |
| 429 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ |
| 430 "${OUTPUT_DIR}" \ |
| 431 "${OUTPUT_IMG}" |
| 426 | 432 |
| 427 # Clean up temporary files. | 433 # Clean up temporary files. |
| 428 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ | 434 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ |
| 429 "${ESP_IMG}" | 435 "${ESP_IMG}" |
| 430 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" | 436 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" |
| 431 | 437 |
| 432 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 438 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
| 433 echo "Done. Image created in ${OUTPUT_DIR}" | 439 echo "Done. Image created in ${OUTPUT_DIR}" |
| 434 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 440 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 435 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 441 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 436 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 442 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
| 437 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 443 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 438 echo "from the scripts directory where you entered the chroot." | 444 echo "from the scripts directory where you entered the chroot." |
| 439 | 445 |
| 440 trap - EXIT | 446 trap - EXIT |
| OLD | NEW |