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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 STATEFUL_FS_IMG="${OUTPUT_DIR}/stateful_partition.image" | 138 STATEFUL_FS_IMG="${OUTPUT_DIR}/stateful_partition.image" |
139 STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition" | 139 STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition" |
140 | 140 |
141 OEM_FS_IMG="${OUTPUT_DIR}/partner_partition.image" | 141 OEM_FS_IMG="${OUTPUT_DIR}/partner_partition.image" |
142 OEM_FS_DIR="${OUTPUT_DIR}/partner_partition" | 142 OEM_FS_DIR="${OUTPUT_DIR}/partner_partition" |
143 | 143 |
144 ESP_FS_IMG=${OUTPUT_DIR}/esp.image | 144 ESP_FS_IMG=${OUTPUT_DIR}/esp.image |
145 ESP_FS_DIR=${OUTPUT_DIR}/esp | 145 ESP_FS_DIR=${OUTPUT_DIR}/esp |
146 | 146 |
| 147 DEVKEYSDIR="/usr/share/vboot/devkeys" |
| 148 |
147 LOOP_DEV= | 149 LOOP_DEV= |
148 STATEFUL_LOOP_DEV= | 150 STATEFUL_LOOP_DEV= |
149 OEM_LOOP_DEV= | 151 OEM_LOOP_DEV= |
150 ESP_LOOP_DEV= | 152 ESP_LOOP_DEV= |
151 | 153 |
152 # ${DEV_IMAGE_ROOT} specifies the location of where developer packages will | 154 # ${DEV_IMAGE_ROOT} specifies the location of where developer packages will |
153 # be installed on the stateful dir. On a Chromium OS system, this will | 155 # be installed on the stateful dir. On a Chromium OS system, this will |
154 # translate to /usr/local. | 156 # translate to /usr/local. |
155 DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image" | 157 DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image" |
156 | 158 |
157 # What cross-build are we targeting? | 159 # What cross-build are we targeting? |
158 . "${BOARD_ROOT}/etc/make.conf.board_setup" | 160 . "${BOARD_ROOT}/etc/make.conf.board_setup" |
159 LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"} | 161 LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"} |
160 | 162 |
161 INSTALL_MASK="" | 163 INSTALL_MASK="" |
162 if [[ ${FLAGS_installmask} -eq ${FLAGS_TRUE} ]] ; then | 164 if [[ ${FLAGS_installmask} -eq ${FLAGS_TRUE} ]] ; then |
163 INSTALL_MASK="${DEFAULT_INSTALL_MASK}" | 165 INSTALL_MASK="${DEFAULT_INSTALL_MASK}" |
164 fi | 166 fi |
165 | 167 |
166 # Reduce the size of factory install shim. | 168 # Reduce the size of factory install shim. |
167 # TODO: Build a separated ebuild for the factory install shim to reduce size. | 169 # TODO: Build a separated ebuild for the factory install shim to reduce size. |
168 if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then | 170 if [[ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]] ; then |
169 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" | 171 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" |
170 fi | 172 fi |
171 | 173 |
172 if [[ ${FLAGS_jobs} -ne -1 ]]; then | 174 if [[ ${FLAGS_jobs} -ne -1 ]]; then |
173 EMERGE_JOBS="--jobs=${FLAGS_jobs}" | 175 EMERGE_JOBS="--jobs=${FLAGS_jobs}" |
174 fi | 176 fi |
175 | 177 |
| 178 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
| 179 enable_rootfs_verification_flag="--enable_rootfs_verification" |
| 180 fi |
| 181 |
176 # Figure out ARCH from the given toolchain. | 182 # Figure out ARCH from the given toolchain. |
177 # TODO: Move to common.sh as a function after scripts are switched over. | 183 # TODO: Move to common.sh as a function after scripts are switched over. |
178 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') | 184 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') |
179 case "${TC_ARCH}" in | 185 case "${TC_ARCH}" in |
180 arm*) | 186 arm*) |
181 ARCH="arm" | 187 ARCH="arm" |
182 ;; | 188 ;; |
183 *86) | 189 *86) |
184 ARCH="x86" | 190 ARCH="x86" |
185 ;; | 191 ;; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 # $3 - Directory where the ESP partition is mounted. | 279 # $3 - Directory where the ESP partition is mounted. |
274 mount_gpt_cleanup() { | 280 mount_gpt_cleanup() { |
275 local rootfs="${1-$ROOT_FS_DIR}" | 281 local rootfs="${1-$ROOT_FS_DIR}" |
276 local statefs="${2-$STATEFUL_FS_DIR}" | 282 local statefs="${2-$STATEFUL_FS_DIR}" |
277 local espfs="${3-$ESP_FS_DIR}" | 283 local espfs="${3-$ESP_FS_DIR}" |
278 "${SCRIPTS_DIR}/mount_gpt_image.sh" \ | 284 "${SCRIPTS_DIR}/mount_gpt_image.sh" \ |
279 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}" | 285 -u -r "${rootfs}" -s "${statefs}" -e "${espfs}" |
280 delete_prompt | 286 delete_prompt |
281 } | 287 } |
282 | 288 |
283 make_image_bootable() { | 289 # Takes no arguments and populates the configuration for |
284 local image_name="$1" | 290 # cros_make_image_bootable. |
285 cros_root=/dev/sd%D%P | 291 create_boot_desc() { |
286 if [[ "${ARCH}" = "arm" ]]; then | 292 cat <<EOF > ${OUTPUT_DIR}/boot.desc |
287 # TODO(wad) assumed like in build_gpt for now. | 293 --arch="${ARCH}" |
288 cros_root=/dev/mmcblk1p3 | 294 --output_dir="${OUTPUT_DIR}" |
289 fi | 295 --rootfs_size="${FLAGS_rootfs_size}" |
290 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then | 296 --rootfs_hash_pad="${FLAGS_rootfs_hash_pad}" |
291 cros_root=/dev/dm-0 | 297 --rootfs_hash="${ROOT_FS_HASH}" |
292 fi | 298 --rootfs_mountpoint="${ROOT_FS_DIR}" |
293 | 299 --statefulfs_mountpoint="${STATEFUL_FS_DIR}" |
294 # TODO(wad) mount the root fs to LOOP_DEV from the image | 300 --espfs_mountpoint="${ESP_FS_DIR}" |
295 trap "mount_gpt_cleanup" EXIT | 301 --verity_error_behavior="${FLAGS_verity_error_behavior}" |
296 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ | 302 --verity_depth="${FLAGS_verity_depth}" |
297 --image "${image_name}" -r "${ROOT_FS_DIR}" \ | 303 --verity_max_ios="${FLAGS_verity_max_ios}" |
298 -s "${STATEFUL_FS_DIR}" | 304 --verity_algorithm="${FLAGS_verity_algorithm}" |
299 | 305 --keys_dir="${DEVKEYSDIR}" |
300 # The rootfs should never be mounted rw again after this point without | 306 --usb_disk="${FLAGS_usb_disk}" |
301 # re-calling make_image_bootable. | 307 --nocleanup_dirs |
302 sudo mount -o remount,ro "${ROOT_FS_DIR}" | 308 ${enable_rootfs_verification_flag} |
303 root_dev=$(mount | grep -- "on ${ROOT_FS_DIR} type" | cut -f1 -d' ' | tail -1) | 309 EOF |
304 | |
305 DEVKEYSDIR="/usr/share/vboot/devkeys" | |
306 | |
307 # Builds the kernel partition image. The temporary files are kept around | |
308 # so that we can perform a load_kernel_test later on the final image. | |
309 ${SCRIPTS_DIR}/build_kernel_image.sh \ | |
310 --arch="${ARCH}" \ | |
311 --to="${OUTPUT_DIR}/vmlinuz.image" \ | |
312 --hd_vblock="${OUTPUT_DIR}/vmlinuz_hd.vblock" \ | |
313 --vmlinuz="${OUTPUT_DIR}/boot/vmlinuz" \ | |
314 --working_dir="${OUTPUT_DIR}" \ | |
315 --keep_work \ | |
316 --rootfs_image=${root_dev} \ | |
317 --rootfs_hash=${ROOT_FS_HASH} \ | |
318 --verity_hash_alg=${FLAGS_verity_algorithm} \ | |
319 --verity_tree_depth=${FLAGS_verity_depth} \ | |
320 --verity_max_ios=${FLAGS_verity_max_ios} \ | |
321 --verity_error_behavior=${FLAGS_verity_error_behavior} \ | |
322 --root=${cros_root} \ | |
323 --keys_dir="${DEVKEYSDIR}" | |
324 | |
325 local rootfs_hash_size=$(stat -c '%s' ${ROOT_FS_HASH}) | |
326 info "Appending rootfs.hash (${rootfs_hash_size} bytes) to the root fs" | |
327 if [[ ${rootfs_hash_size} -gt $((FLAGS_rootfs_hash_pad * 1024 * 1024)) ]] | |
328 then | |
329 die "--rootfs_hash_pad reserves less than the needed ${rootfs_hash_size}" | |
330 fi | |
331 # Unfortunately, mount_gpt_image uses mount and not losetup to create the | |
332 # loop devices. This means that they are not the correct size. We have to | |
333 # write directly to the image to append the hash tree data. | |
334 local hash_offset="$(partoffset ${OUTPUT_DIR}/${image_name} 3)" | |
335 hash_offset=$((hash_offset + ((1024 * 1024 * ${FLAGS_rootfs_size}) / 512))) | |
336 sudo dd bs=512 \ | |
337 seek=${hash_offset} \ | |
338 if="${ROOT_FS_HASH}" \ | |
339 of="${OUTPUT_DIR}/${image_name}" \ | |
340 conv=notrunc | |
341 # We don't need to keep the file around anymore. | |
342 sudo rm "${ROOT_FS_HASH}" | |
343 | |
344 # Move the verification block needed for the hard disk install to the | |
345 # stateful partition. Mount stateful fs, copy file, and umount fs. | |
346 # In original CL: http://codereview.chromium.org/2868044, this was done in | |
347 # create_base_image(). However, it could break the build if it is a clean | |
348 # build because vmlinuz_hd.vblock hasn't been created by build_kernel_image.sh | |
349 if [[ "${ARCH}" = "x86" ]]; then | |
350 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" | |
351 fi | |
352 | |
353 # START_KERN_A is set by the first call to install the gpt. | |
354 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" | |
355 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ | |
356 conv=notrunc bs=512 seek=${koffset} | |
357 | |
358 # Update the bootloaders. For legacy/efi x86, the EFI system partition | |
359 # will be updated and for arm, the mbr will be updated (for u-boot). | |
360 local kernel_part= | |
361 local bootloader_to= | |
362 local bootloader_to_flags= | |
363 local usb_disk="${FLAGS_usb_disk}" | |
364 | |
365 if [[ "${ARCH}" = "x86" ]]; then | |
366 # x86 should update the esp in place in the image. | |
367 bootloader_to="${OUTPUT_DIR}/${image_name}" | |
368 local esp_offset="$(partoffset ${OUTPUT_DIR}/${image_name} 12)" | |
369 esp_offset=$((esp_offset * 512)) # sectors to bytes | |
370 local esp_size="$(partsize ${OUTPUT_DIR}/${image_name} 12)" | |
371 esp_size=$((esp_size * 512)) # sectors to bytes | |
372 bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}" | |
373 # Use the kernel partition to acquire configuration flags. | |
374 kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" | |
375 # Install syslinux on the EFI System Partition. | |
376 kernel_part="${kernel_part} --install_syslinux" | |
377 elif [[ "${ARCH}" = "arm" ]]; then | |
378 # TODO(wad) mmcblk1p3 is hardcoded for arm for now! | |
379 usb_disk="/dev/mmcblk1p3" | |
380 # ARM doesn't support using the kernel image for kernel cmdline flags yet. | |
381 kernel_part="--kernel_cmdline=\"${FLAGS_arm_extra_bootargs}\" " | |
382 # TODO(wad) Integrate dmtable extraction into the arm build | |
383 # E.g. $(cat ${OUTPUT_DIR}/boot.config | tr -s '\n' ' ')" | |
384 local kpart_offset="--kernel_partition_offset=${koffset}" | |
385 local kpart_size="--kernel_partition_sectors=" | |
386 kpart_size="${kpart_size}$(partsize ${OUTPUT_DIR}/${image_name} 2)" | |
387 kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}" | |
388 info "Using addition bootloader arguments: ${kernel_part}" | |
389 bootloader_to="${OUTPUT_DIR}/arm.mbr" | |
390 fi | |
391 | |
392 # Update partition 12 / legacy bootloaders and arm. | |
393 ${SCRIPTS_DIR}/update_bootloaders.sh \ | |
394 --arch=${ARCH} \ | |
395 --to="${bootloader_to}" \ | |
396 --from="${OUTPUT_DIR}"/boot \ | |
397 --vmlinuz="${OUTPUT_DIR}"/boot/vmlinuz \ | |
398 --usb_disk="${usb_disk}" \ | |
399 ${bootloader_to_flags} \ | |
400 $kernel_part | |
401 | |
402 if [[ "${ARCH}" == "arm" ]]; then | |
403 sudo dd bs=1 conv=notrunc if="${bootloader_to}" \ | |
404 of="${OUTPUT_DIR}/${image_name}" | |
405 sudo rm "${bootloader_to}" | |
406 fi | |
407 | |
408 trap - EXIT | |
409 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ | |
410 -s "${STATEFUL_FS_DIR}" | |
411 } | 310 } |
412 | 311 |
413 # Modifies an existing image to add development packages | 312 # Modifies an existing image to add development packages |
414 update_dev_packages() { | 313 update_dev_packages() { |
415 local image_name=$1 | 314 local image_name=$1 |
416 | 315 |
417 echo "Adding developer packages to ${image_name}" | 316 echo "Adding developer packages to ${image_name}" |
418 | 317 |
419 trap "mount_gpt_cleanup" EXIT | 318 trap "mount_gpt_cleanup" EXIT |
420 | 319 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then | 554 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
656 enable_rootfs_verification="--enable_rootfs_verification" | 555 enable_rootfs_verification="--enable_rootfs_verification" |
657 fi | 556 fi |
658 | 557 |
659 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \ | 558 ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \ |
660 --arch=${ARCH} \ | 559 --arch=${ARCH} \ |
661 --to="${ROOT_FS_DIR}"/boot \ | 560 --to="${ROOT_FS_DIR}"/boot \ |
662 --install \ | 561 --install \ |
663 ${enable_rootfs_verification} | 562 ${enable_rootfs_verification} |
664 | 563 |
665 # Create a working copy so we don't need the rootfs mounted | |
666 sudo mkdir -p "${OUTPUT_DIR}"/boot | |
667 # This will include any built files dropped in /boot as well. | |
668 # Like the current vmlinuz. | |
669 sudo cp -r "${ROOT_FS_DIR}"/boot/. "${OUTPUT_DIR}"/boot/ | |
670 sudo chmod -R a+r "${OUTPUT_DIR}"/boot/ | |
671 | |
672 # Don't test the factory install shim. | 564 # Don't test the factory install shim. |
673 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then | 565 if [[ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]] ; then |
674 # Check that the image has been correctly created. | 566 # Check that the image has been correctly created. |
675 "${SCRIPTS_DIR}/test_image" \ | 567 "${SCRIPTS_DIR}/test_image" \ |
676 --root="${ROOT_FS_DIR}" \ | 568 --root="${ROOT_FS_DIR}" \ |
677 --target="${ARCH}" | 569 --target="${ARCH}" |
678 fi | 570 fi |
679 | 571 |
680 # Clean up symlinks so they work on a running target rooted at "/". | 572 # Clean up symlinks so they work on a running target rooted at "/". |
681 # Here development packages are rooted at /usr/local. However, do not | 573 # Here development packages are rooted at /usr/local. However, do not |
682 # create /usr/local or /var on host (already exist on target). | 574 # create /usr/local or /var on host (already exist on target). |
683 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}" | 575 setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}" |
684 | 576 |
685 # make_image_bootable will clobber vmlinuz.image for x86. | 577 # cros_make_image_bootable will clobber vmlinuz.image for x86. |
686 # Until then, just copy the kernel to vmlinuz.image. It is | 578 # Until then, just copy the kernel to vmlinuz.image. It is |
687 # expected in build_gpt.sh and needed by ARM until it supports the | 579 # expected in build_gpt.sh and needed by ARM until it supports the |
688 # full, signed kernel partition format. | 580 # full, signed kernel partition format. |
689 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | 581 cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" |
690 | 582 |
691 # Create an empty esp image to be updated in by update_bootloaders.sh. | 583 # Create an empty esp image to be updated in by update_bootloaders.sh. |
692 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" | 584 ${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}" |
693 | 585 |
694 cleanup | 586 cleanup |
695 | 587 |
(...skipping 17 matching lines...) Expand all Loading... |
713 mkdir -p "${STATEFUL_FS_DIR}" | 605 mkdir -p "${STATEFUL_FS_DIR}" |
714 mkdir -p "${OEM_FS_DIR}" | 606 mkdir -p "${OEM_FS_DIR}" |
715 mkdir -p "${ESP_FS_DIR}" | 607 mkdir -p "${ESP_FS_DIR}" |
716 | 608 |
717 # Preserve old images by copying them forward for --preserve. | 609 # Preserve old images by copying them forward for --preserve. |
718 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then | 610 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then |
719 if [[ -f ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ]] ; then | 611 if [[ -f ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ]] ; then |
720 # Copy forward pristine image, and associated files | 612 # Copy forward pristine image, and associated files |
721 cp ${PREVIOUS_DIR}/*.sh ${PREVIOUS_DIR}/config.txt ${OUTPUT_DIR} | 613 cp ${PREVIOUS_DIR}/*.sh ${PREVIOUS_DIR}/config.txt ${OUTPUT_DIR} |
722 cp ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ${OUTPUT_DIR} | 614 cp ${PREVIOUS_DIR}/${PRISTINE_IMAGE_NAME} ${OUTPUT_DIR} |
723 cp -r ${PREVIOUS_DIR}/boot ${OUTPUT_DIR}/boot | |
724 | 615 |
725 # Copy forward the developer image, if we already copied forward the base. | 616 # Copy forward the developer image, if we already copied forward the base. |
726 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \ | 617 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \ |
727 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then | 618 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then |
728 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR} | 619 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR} |
729 fi | 620 fi |
730 fi | 621 fi |
731 fi | 622 fi |
732 | 623 |
| 624 # Create the boot.desc file which stores the build-time configuration |
| 625 # information needed for making the image bootable after creation with |
| 626 # cros_make_image_bootable. |
| 627 create_boot_desc |
| 628 |
733 if [[ -f ${PRISTINE_IMG} ]] ; then | 629 if [[ -f ${PRISTINE_IMG} ]] ; then |
734 update_base_packages ${PRISTINE_IMAGE_NAME} | 630 update_base_packages ${PRISTINE_IMAGE_NAME} |
735 else | 631 else |
736 create_base_image ${PRISTINE_IMAGE_NAME} | 632 create_base_image ${PRISTINE_IMAGE_NAME} |
737 fi | 633 fi |
738 make_image_bootable ${PRISTINE_IMAGE_NAME} | 634 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ |
| 635 "${PRISTINE_IMAGE_NAME}" |
739 | 636 |
740 # FIXME: only signing things for x86 right now. | 637 # FIXME: only signing things for x86 right now. |
741 if [[ "${ARCH}" = "x86" ]]; then | 638 if [[ "${ARCH}" = "x86" ]]; then |
742 # Verify the final image. | 639 # Verify the final image. |
743 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ | 640 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ |
744 "${DEVKEYSDIR}/recovery_key.vbpubk" | 641 "${DEVKEYSDIR}/recovery_key.vbpubk" |
745 fi | 642 fi |
746 | 643 |
747 # Create a developer image based on the chromium os base image. | 644 # Create a developer image based on the chromium os base image. |
748 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then | 645 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then |
749 if [[ ! -f ${DEVELOPER_IMG} ]] ; then | 646 if [[ ! -f ${DEVELOPER_IMG} ]] ; then |
750 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}" | 647 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}" |
751 cp ${PRISTINE_IMG} ${DEVELOPER_IMG} | 648 cp ${PRISTINE_IMG} ${DEVELOPER_IMG} |
752 fi | 649 fi |
753 | 650 |
754 update_dev_packages ${DEVELOPER_IMAGE_NAME} | 651 update_dev_packages ${DEVELOPER_IMAGE_NAME} |
755 make_image_bootable ${DEVELOPER_IMAGE_NAME} | 652 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ |
| 653 "${DEVELOPER_IMAGE_NAME}" |
756 fi | 654 fi |
757 | 655 |
758 # Clean up temporary files. | 656 # Clean up temporary files. |
759 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ | 657 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ |
760 "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" | 658 "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" |
761 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}" | 659 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}" |
762 | 660 |
763 echo "Done. Image created in ${OUTPUT_DIR}" | 661 echo "Done. Image created in ${OUTPUT_DIR}" |
764 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" | 662 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" |
765 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then | 663 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then |
766 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 664 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
767 fi | 665 fi |
768 | 666 |
769 print_time_elapsed | 667 print_time_elapsed |
770 | 668 |
771 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 669 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
772 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 670 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
773 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 671 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
774 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" | 672 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR}" |
775 echo "from the scripts directory where you entered the chroot." | 673 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |