| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 # TODO(wad) Integrate dmtable extraction into the arm build | 344 # TODO(wad) Integrate dmtable extraction into the arm build |
| 345 # E.g. $(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')" | 345 # E.g. $(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')" |
| 346 local kpart_offset="--kernel_partition_offset=${koffset}" | 346 local kpart_offset="--kernel_partition_offset=${koffset}" |
| 347 local kpart_size="--kernel_partition_sectors=" | 347 local kpart_size="--kernel_partition_sectors=" |
| 348 kpart_size="${kpart_size}$(partsize ${OUTPUT_DIR}/${image_name} 2)" | 348 kpart_size="${kpart_size}$(partsize ${OUTPUT_DIR}/${image_name} 2)" |
| 349 kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}" | 349 kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}" |
| 350 info "Using addition bootloader arguments: ${kernel_part}" | 350 info "Using addition bootloader arguments: ${kernel_part}" |
| 351 bootloader_to="${OUTPUT_DIR}/arm.mbr" | 351 bootloader_to="${OUTPUT_DIR}/arm.mbr" |
| 352 fi | 352 fi |
| 353 | 353 |
| 354 # Temporary hack to fix syslinux building: |
| 355 sudo umount ${ESP_FS_DIR} |
| 356 |
| 354 # Update partition 12 / legacy bootloaders and arm. | 357 # Update partition 12 / legacy bootloaders and arm. |
| 355 ${SCRIPTS_DIR}/update_bootloaders.sh \ | 358 ${SCRIPTS_DIR}/update_bootloaders.sh \ |
| 356 --arch=${ARCH} \ | 359 --arch=${ARCH} \ |
| 357 --to="${bootloader_to}" \ | 360 --to="${bootloader_to}" \ |
| 358 --from="${OUTPUT_DIR}"/boot \ | 361 --from="${OUTPUT_DIR}"/boot \ |
| 359 --vmlinuz="${OUTPUT_DIR}"/boot/vmlinuz \ | 362 --vmlinuz="${OUTPUT_DIR}"/boot/vmlinuz \ |
| 360 --usb_disk="${usb_disk}" \ | 363 --usb_disk="${usb_disk}" \ |
| 361 $kernel_part | 364 $kernel_part |
| 362 | 365 |
| 363 if [[ "${ARCH}" == "arm" ]]; then | 366 if [[ "${ARCH}" == "arm" ]]; then |
| 364 sudo dd bs=1 conv=notrunc if="${bootloader_to}" \ | 367 sudo dd bs=1 conv=notrunc if="${bootloader_to}" \ |
| 365 of="${OUTPUT_DIR}/${image_name}" | 368 of="${OUTPUT_DIR}/${image_name}" |
| 366 sudo rm "${bootloader_to}" | 369 sudo rm "${bootloader_to}" |
| 367 fi | 370 fi |
| 368 | 371 |
| 369 trap - EXIT | 372 trap - EXIT |
| 373 # Temporary hack to fix syslinux building, comment out -e ${ESP_FS_DIR} |
| 374 # ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ |
| 375 # -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" |
| 370 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ | 376 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ |
| 371 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" | 377 -s "${STATEFUL_FS_DIR}" |
| 372 } | 378 } |
| 373 | 379 |
| 374 # Modifies an existing image to add development packages | 380 # Modifies an existing image to add development packages |
| 375 update_dev_packages() { | 381 update_dev_packages() { |
| 376 local image_name=$1 | 382 local image_name=$1 |
| 377 | 383 |
| 378 echo "Adding developer packages to ${image_name}" | 384 echo "Adding developer packages to ${image_name}" |
| 379 | 385 |
| 380 trap "mount_gpt_cleanup" EXIT | 386 trap "mount_gpt_cleanup" EXIT |
| 381 | 387 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 723 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
| 718 fi | 724 fi |
| 719 | 725 |
| 720 print_time_elapsed | 726 print_time_elapsed |
| 721 | 727 |
| 722 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 728 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 723 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 729 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 724 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 730 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
| 725 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" | 731 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 726 echo "from the scripts directory where you entered the chroot." | 732 echo "from the scripts directory where you entered the chroot." |
| OLD | NEW |