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 26 matching lines...) Expand all Loading... |
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_TRUE \ | 38 DEFINE_boolean statefuldev $FLAGS_TRUE \ |
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 factory_install $FLAGS_FALSE \ | 42 DEFINE_boolean factory_install $FLAGS_FALSE \ |
43 "Build a smaller image to overlay the factory install shim on; this argument \ | 43 "Build a smaller image to overlay the factory install shim on; this argument \ |
44 is also required in image_to_usb." | 44 is also required in image_to_usb." |
45 DEFINE_string arm_extra_bootargs "" \ | 45 DEFINE_string arm_extra_bootargs "" \ |
46 "Additional command line options to pass to the ARM kernel." | 46 "Additional command line options to pass to the ARM kernel." |
| 47 DEFINE_boolean recovery $FLAGS_FALSE \ |
| 48 "Build a recovery image. Default: False." |
47 | 49 |
48 # Parse command line. | 50 # Parse command line. |
49 FLAGS "$@" || exit 1 | 51 FLAGS "$@" || exit 1 |
50 eval set -- "${FLAGS_ARGV}" | 52 eval set -- "${FLAGS_ARGV}" |
51 | 53 |
52 # Only now can we die on error. shflags functions leak non-zero error codes, | 54 # Only now can we die on error. shflags functions leak non-zero error codes, |
53 # so will die prematurely if 'set -e' is specified before now. | 55 # so will die prematurely if 'set -e' is specified before now. |
54 set -e | 56 set -e |
55 | 57 |
56 if [ -z "$FLAGS_board" ] ; then | 58 if [ -z "$FLAGS_board" ] ; then |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 # Clean up symlinks so they work on a running target rooted at "/". | 437 # Clean up symlinks so they work on a running target rooted at "/". |
436 # Here development packages are rooted at /usr/local. However, do not | 438 # Here development packages are rooted at /usr/local. However, do not |
437 # create /usr/local or /var on host (already exist on target). | 439 # create /usr/local or /var on host (already exist on target). |
438 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_DIR}" | 440 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_DIR}" |
439 | 441 |
440 # Cleanup loop devices. | 442 # Cleanup loop devices. |
441 cleanup | 443 cleanup |
442 | 444 |
443 trap delete_prompt EXIT | 445 trap delete_prompt EXIT |
444 | 446 |
| 447 RECOVERY="--norecovery" |
| 448 if [[ ${FLAGS_recovery} -eq $FLAGS_TRUE ]]; then |
| 449 RECOVERY="--recovery" |
| 450 fi |
| 451 |
445 # Create the GPT-formatted image | 452 # Create the GPT-formatted image |
446 ${SCRIPTS_DIR}/build_gpt.sh \ | 453 ${SCRIPTS_DIR}/build_gpt.sh \ |
447 --arch=${ARCH} \ | 454 --arch=${ARCH} \ |
448 --board=${FLAGS_board} \ | 455 --board=${FLAGS_board} \ |
449 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ | 456 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ |
| 457 ${RECOVERY} \ |
450 "${OUTPUT_DIR}" \ | 458 "${OUTPUT_DIR}" \ |
451 "${OUTPUT_IMG}" | 459 "${OUTPUT_IMG}" |
452 | 460 |
453 # Clean up temporary files. | 461 # Clean up temporary files. |
454 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ | 462 rm -f "${ROOT_FS_IMG}" "${STATEFUL_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ |
455 "${ESP_IMG}" | 463 "${ESP_IMG}" |
456 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" | 464 rmdir "${ROOT_FS_DIR}" "${STATEFUL_DIR}" "${ESP_DIR}" |
457 | 465 |
458 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 466 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
459 | 467 |
460 # Create a developer image based on the chromium os base image | 468 # Create a developer image based on the chromium os base image |
461 [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ] && create_developer_image | 469 [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ] && create_developer_image |
462 trap - EXIT | 470 trap - EXIT |
463 | 471 |
464 echo "Done. Image created in ${OUTPUT_DIR}" | 472 echo "Done. Image created in ${OUTPUT_DIR}" |
465 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME" | 473 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME" |
466 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then | 474 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then |
467 echo "Developer image created as $DEVELOPER_IMAGE_NAME" | 475 echo "Developer image created as $DEVELOPER_IMAGE_NAME" |
468 fi | 476 fi |
469 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 477 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
470 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 478 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
471 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 479 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
472 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 480 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
473 echo "from the scripts directory where you entered the chroot." | 481 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |