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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 --keep_work \ | 305 --keep_work \ |
306 --rootfs_image=${root_dev} \ | 306 --rootfs_image=${root_dev} \ |
307 --rootfs_hash=${OUTPUT_DIR}/rootfs.hash \ | 307 --rootfs_hash=${OUTPUT_DIR}/rootfs.hash \ |
308 --vboot_hash_alg=${FLAGS_vboot_algorithm} \ | 308 --vboot_hash_alg=${FLAGS_vboot_algorithm} \ |
309 --vboot_tree_depth=${FLAGS_vboot_depth} \ | 309 --vboot_tree_depth=${FLAGS_vboot_depth} \ |
310 --vboot_max_ios=${FLAGS_vboot_max_ios} \ | 310 --vboot_max_ios=${FLAGS_vboot_max_ios} \ |
311 --vboot_error_behavior=${FLAGS_vboot_behavior} \ | 311 --vboot_error_behavior=${FLAGS_vboot_behavior} \ |
312 --root=${cros_root} \ | 312 --root=${cros_root} \ |
313 --keys_dir="${DEVKEYSDIR}" | 313 --keys_dir="${DEVKEYSDIR}" |
314 | 314 |
| 315 # Move the verification block needed for the hard disk install to the |
| 316 # stateful partition. Mount stateful fs, copy file, and umount fs. |
| 317 STATEFUL_LOOP_DEV=$(sudo losetup -f) |
| 318 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then |
| 319 echo "No free loop device. Free up a loop device or reboot. exiting. " |
| 320 exit 1 |
| 321 fi |
| 322 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" |
| 323 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" |
| 324 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" |
| 325 sudo umount -d "${STATEFUL_FS_DIR}" |
| 326 STATEFUL_LOOP_DEV= |
| 327 |
315 # START_KERN_A is set by the first call to install the gpt. | 328 # START_KERN_A is set by the first call to install the gpt. |
316 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" | 329 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" |
317 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ | 330 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ |
318 conv=notrunc bs=512 seek=${koffset} | 331 conv=notrunc bs=512 seek=${koffset} |
319 | 332 |
320 # Populate the legacy/efi bootloader partition. | 333 # Populate the legacy/efi bootloader partition. |
321 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" | 334 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" |
322 local bootloader_to="${ESP_FS_IMG}" | 335 local bootloader_to="${ESP_FS_IMG}" |
323 local usb_disk="${FLAGS_usb_disk}" | 336 local usb_disk="${FLAGS_usb_disk}" |
324 local bootloader_to="$(mount | grep ${ESP_FS_DIR} | cut -f1 -d' ')" | 337 local bootloader_to="$(mount | grep ${ESP_FS_DIR} | cut -f1 -d' ')" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 608 |
596 # make_image_bootable will clobber vmlinuz.image for x86. | 609 # make_image_bootable will clobber vmlinuz.image for x86. |
597 # Until then, just copy the kernel to vmlinuz.image. It is | 610 # Until then, just copy the kernel to vmlinuz.image. It is |
598 # expected in build_gpt.sh and needed by ARM until it supports the | 611 # expected in build_gpt.sh and needed by ARM until it supports the |
599 # full, signed kernel partition format. | 612 # full, signed kernel partition format. |
600 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | 613 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" |
601 | 614 |
602 # Create an empty esp image to be updated in by update_bootloaders.sh. | 615 # Create an empty esp image to be updated in by update_bootloaders.sh. |
603 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" | 616 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" |
604 | 617 |
605 # Move the verification block needed for the hard disk install to the | |
606 # stateful partition. | |
607 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" | |
608 | |
609 cleanup | 618 cleanup |
610 | 619 |
611 trap delete_prompt EXIT | 620 trap delete_prompt EXIT |
612 | 621 |
613 # Create the GPT-formatted image. | 622 # Create the GPT-formatted image. |
614 ${SCRIPTS_DIR}/build_gpt.sh \ | 623 ${SCRIPTS_DIR}/build_gpt.sh \ |
615 --arch=${ARCH} \ | 624 --arch=${ARCH} \ |
616 --board=${FLAGS_board} \ | 625 --board=${FLAGS_board} \ |
617 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ | 626 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ |
618 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ | 627 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 690 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
682 fi | 691 fi |
683 | 692 |
684 print_time_elapsed | 693 print_time_elapsed |
685 | 694 |
686 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 695 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
687 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 696 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
688 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 697 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
689 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 698 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
690 echo "from the scripts directory where you entered the chroot." | 699 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |