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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 --usepkgonly --depclean ${EMERGE_JOBS} | 516 --usepkgonly --depclean ${EMERGE_JOBS} |
517 | 517 |
518 trap - EXIT | 518 trap - EXIT |
519 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ | 519 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ |
520 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" | 520 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" |
521 } | 521 } |
522 | 522 |
523 zero_free_space() { | 523 zero_free_space() { |
524 local fs_mount_point=$1 | 524 local fs_mount_point=$1 |
525 info "Zeroing freespace in ${fs_mount_point}" | 525 info "Zeroing freespace in ${fs_mount_point}" |
526 sudo dd if=/dev/zero of="${fs_mount_point}/filler" oflag=sync bs=4096 || true | 526 # dd is a silly thing and will produce a "No space left on device" message |
| 527 # that cannot be turned off and is confusing to unsuspecting victims. |
| 528 ( sudo dd if=/dev/zero of="${fs_mount_point}/filler" oflag=sync bs=4096 \ |
| 529 || true ) 2>&1 |grep -v "No space left on device" |
527 sudo rm -f "${fs_mount_point}/filler" | 530 sudo rm -f "${fs_mount_point}/filler" |
528 sudo sync | 531 sudo sync |
529 } | 532 } |
530 | 533 |
531 create_base_image() { | 534 create_base_image() { |
532 local image_name=$1 | 535 local image_name=$1 |
533 | 536 |
534 trap "cleanup && delete_prompt" EXIT | 537 trap "cleanup && delete_prompt" EXIT |
535 | 538 |
536 # Create and format the root file system. | 539 # Create and format the root file system. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 811 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
809 fi | 812 fi |
810 | 813 |
811 print_time_elapsed | 814 print_time_elapsed |
812 | 815 |
813 echo "To copy to USB keyfob, do something like:" | 816 echo "To copy to USB keyfob, do something like:" |
814 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 817 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
815 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 818 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
816 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 819 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
817 echo "from the scripts directory where you entered the chroot." | 820 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |