Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: build_image

Issue 2818045: Use the new developer keys to sign things. (submit for Bill) (Closed) Base URL: ssh://gitrw.chromium.org/crosutils.git
Patch Set: fixed indet and column 80 Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build_kernel_image.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 # TODO(wad) mount the root fs to LOOP_DEV from the image 286 # TODO(wad) mount the root fs to LOOP_DEV from the image
287 trap "mount_gpt_cleanup" EXIT 287 trap "mount_gpt_cleanup" EXIT
288 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ 288 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \
289 --image "${image_name}" -r "${ROOT_FS_DIR}" \ 289 --image "${image_name}" -r "${ROOT_FS_DIR}" \
290 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" 290 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
291 291
292 sudo mount -o remount,ro "${ROOT_FS_DIR}" 292 sudo mount -o remount,ro "${ROOT_FS_DIR}"
293 root_dev=$(mount | grep -- "${ROOT_FS_DIR}" | cut -f1 -d' ' | tail -1) 293 root_dev=$(mount | grep -- "${ROOT_FS_DIR}" | cut -f1 -d' ' | tail -1)
294 294
295 DEVKEYSDIR="${SRC_ROOT}/platform/vboot_reference/tests/devkeys"
296
295 # Builds the kernel partition image. The temporary files are kept around 297 # Builds the kernel partition image. The temporary files are kept around
296 # so that we can perform a load_kernel_test later on the final image. 298 # so that we can perform a load_kernel_test later on the final image.
297 ${SCRIPTS_DIR}/build_kernel_image.sh \ 299 ${SCRIPTS_DIR}/build_kernel_image.sh \
298 --arch="${ARCH}" \ 300 --arch="${ARCH}" \
299 --to="${OUTPUT_DIR}/vmlinuz.image" \ 301 --to="${OUTPUT_DIR}/vmlinuz.image" \
302 --hd_vblock="${OUTPUT_DIR}/vmlinuz_hd.vblock" \
300 --vmlinuz="${OUTPUT_DIR}/boot/vmlinuz" \ 303 --vmlinuz="${OUTPUT_DIR}/boot/vmlinuz" \
301 --working_dir="${OUTPUT_DIR}" \ 304 --working_dir="${OUTPUT_DIR}" \
302 --keep_work \ 305 --keep_work \
303 --rootfs_image=${root_dev} \ 306 --rootfs_image=${root_dev} \
304 --rootfs_hash=${OUTPUT_DIR}/rootfs.hash \ 307 --rootfs_hash=${OUTPUT_DIR}/rootfs.hash \
305 --vboot_hash_alg=${FLAGS_vboot_algorithm} \ 308 --vboot_hash_alg=${FLAGS_vboot_algorithm} \
306 --vboot_tree_depth=${FLAGS_vboot_depth} \ 309 --vboot_tree_depth=${FLAGS_vboot_depth} \
307 --vboot_max_ios=${FLAGS_vboot_max_ios} \ 310 --vboot_max_ios=${FLAGS_vboot_max_ios} \
308 --vboot_error_behavior=${FLAGS_vboot_behavior} \ 311 --vboot_error_behavior=${FLAGS_vboot_behavior} \
309 --root=${cros_root} \ 312 --root=${cros_root} \
310 --keys_dir="${SRC_ROOT}/platform/vboot_reference/tests/testkeys" 313 --keys_dir="${DEVKEYSDIR}"
311 314
312 # START_KERN_A is set by the first call to install the gpt. 315 # START_KERN_A is set by the first call to install the gpt.
313 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" 316 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)"
314 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ 317 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \
315 conv=notrunc bs=512 seek=${koffset} 318 conv=notrunc bs=512 seek=${koffset}
316 319
317 # Populate the legacy/efi bootloader partition. 320 # Populate the legacy/efi bootloader partition.
318 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" 321 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'"
319 local bootloader_to="${ESP_FS_IMG}" 322 local bootloader_to="${ESP_FS_IMG}"
320 local usb_disk="${FLAGS_usb_disk}" 323 local usb_disk="${FLAGS_usb_disk}"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 595
593 # make_image_bootable will clobber vmlinuz.image for x86. 596 # make_image_bootable will clobber vmlinuz.image for x86.
594 # Until then, just copy the kernel to vmlinuz.image. It is 597 # Until then, just copy the kernel to vmlinuz.image. It is
595 # expected in build_gpt.sh and needed by ARM until it supports the 598 # expected in build_gpt.sh and needed by ARM until it supports the
596 # full, signed kernel partition format. 599 # full, signed kernel partition format.
597 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" 600 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image"
598 601
599 # Create an empty esp image to be updated in by update_bootloaders.sh. 602 # Create an empty esp image to be updated in by update_bootloaders.sh.
600 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" 603 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}"
601 604
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
602 cleanup 609 cleanup
603 610
604 trap delete_prompt EXIT 611 trap delete_prompt EXIT
605 612
606 # Create the GPT-formatted image. 613 # Create the GPT-formatted image.
607 ${SCRIPTS_DIR}/build_gpt.sh \ 614 ${SCRIPTS_DIR}/build_gpt.sh \
608 --arch=${ARCH} \ 615 --arch=${ARCH} \
609 --board=${FLAGS_board} \ 616 --board=${FLAGS_board} \
610 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ 617 --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \
611 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ 618 --rootfs_partition_size=${FLAGS_rootfs_partition_size} \
(...skipping 30 matching lines...) Expand all
642 update_base_packages ${PRISTINE_IMAGE_NAME} 649 update_base_packages ${PRISTINE_IMAGE_NAME}
643 else 650 else
644 create_base_image ${PRISTINE_IMAGE_NAME} 651 create_base_image ${PRISTINE_IMAGE_NAME}
645 fi 652 fi
646 make_image_bootable ${PRISTINE_IMAGE_NAME} 653 make_image_bootable ${PRISTINE_IMAGE_NAME}
647 654
648 # FIXME: only signing things for x86 right now. 655 # FIXME: only signing things for x86 right now.
649 if [[ "${ARCH}" = "x86" ]]; then 656 if [[ "${ARCH}" = "x86" ]]; then
650 # Verify the final image. 657 # Verify the final image.
651 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ 658 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \
652 "${OUTPUT_DIR}/kernel_subkey.vbpubk" 659 "${DEVKEYSDIR}/recovery_key.vbpubk"
653 fi 660 fi
654 661
655 # Create a developer image based on the chromium os base image. 662 # Create a developer image based on the chromium os base image.
656 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then 663 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then
657 if [[ ! -f ${DEVELOPER_IMG} ]] ; then 664 if [[ ! -f ${DEVELOPER_IMG} ]] ; then
658 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}" 665 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}"
659 cp ${PRISTINE_IMG} ${DEVELOPER_IMG} 666 cp ${PRISTINE_IMG} ${DEVELOPER_IMG}
660 fi 667 fi
661 668
662 update_dev_packages ${DEVELOPER_IMAGE_NAME} 669 update_dev_packages ${DEVELOPER_IMAGE_NAME}
663 make_image_bootable ${DEVELOPER_IMAGE_NAME} 670 make_image_bootable ${DEVELOPER_IMAGE_NAME}
664 fi 671 fi
665 672
666 # Clean up temporary files. 673 # Clean up temporary files.
667 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ 674 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \
668 "${ESP_FS_IMG}" "${OUTPUT_DIR}/kernel.keyblock" \ 675 "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock"
669 "${OUTPUT_DIR}/kernel_subkey.vbpubk" \
670 "${OUTPUT_DIR}/kernel_subkey.vbprivk" \
671 "${OUTPUT_DIR}/kernel_data_key.vbpubk" \
672 "${OUTPUT_DIR}/kernel_data_key.vbprivk" \
673 "${OEM_FS_IMG}"
674 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}" 676 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}"
675 677
676 echo "Done. Image created in ${OUTPUT_DIR}" 678 echo "Done. Image created in ${OUTPUT_DIR}"
677 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" 679 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}"
678 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then 680 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then
679 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" 681 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}"
680 fi 682 fi
681 683
682 print_time_elapsed 684 print_time_elapsed
683 685
684 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" 686 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
685 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" 687 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX"
686 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" 688 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
687 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 689 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
688 echo "from the scripts directory where you entered the chroot." 690 echo "from the scripts directory where you entered the chroot."
OLDNEW
« no previous file with comments | « no previous file | build_kernel_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698