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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 check_blacklist | 139 check_blacklist |
140 | 140 |
141 # TODO(petkov): Remove along with the --move_to_etc flag support once the | 141 # TODO(petkov): Remove along with the --move_to_etc flag support once the |
142 # transition dust settles. | 142 # transition dust settles. |
143 "${SCRIPTS_DIR}"/set_shared_user_password.sh --move_to_etc | 143 "${SCRIPTS_DIR}"/set_shared_user_password.sh --move_to_etc |
144 | 144 |
145 # TODO(vlaviano): Validate command line flags. Check for conflicting flags and | 145 # TODO(vlaviano): Validate command line flags. Check for conflicting flags and |
146 # reconcile them if possible. Exit with an error message otherwise. | 146 # reconcile them if possible. Exit with an error message otherwise. |
147 | 147 |
148 INSTALL_MASK="" | 148 export INSTALL_MASK="" |
149 if [ "${FLAGS_installmask}" -eq "${FLAGS_TRUE}" ] ; then | 149 if [ ${FLAGS_installmask} -eq ${FLAGS_TRUE} ] ; then |
150 INSTALL_MASK="${DEFAULT_INSTALL_MASK}" | 150 INSTALL_MASK="${DEFAULT_INSTALL_MASK}" |
151 fi | 151 fi |
152 | 152 |
153 # Reduce the size of factory install shim. | 153 # Reduce the size of factory install shim. |
154 if [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ]; then | 154 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
155 # Disable --withdev flag when --factory_install is set to True. Otherwise, the | 155 # Disable --withdev flag when --factory_install is set to True. Otherwise, the |
156 # dev image produced will be based on install shim, rather than a pristine | 156 # dev image produced will be based on install shim, rather than a pristine |
157 # image | 157 # image |
158 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then | 158 if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
159 info "Incompatible flags: --withdev and --factory_install cannot both be \ | 159 info "Incompatible flags: --withdev and --factory_install cannot both be \ |
160 set to True. Resetting --withdev to False." | 160 set to True. Resetting --withdev to False." |
161 FLAGS_withdev=${FLAGS_FALSE} | 161 FLAGS_withdev=${FLAGS_FALSE} |
162 fi | 162 fi |
163 | 163 |
164 # TODO: Build a separated ebuild for the install shim to reduce size. | 164 # TODO: Build a separated ebuild for the install shim to reduce size. |
165 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" | 165 INSTALL_MASK="${INSTALL_MASK} ${FACTORY_INSTALL_MASK}" |
166 | 166 |
167 info "Fixing the rootfs size at 300 MiB for install shim" | 167 info "Fixing the rootfs size at 300 MiB for install shim" |
168 FLAGS_rootfs_size=280 | 168 FLAGS_rootfs_size=280 |
169 FLAGS_rootfs_partition_size=300 | 169 FLAGS_rootfs_partition_size=300 |
170 info "Fixing the statefulfs size at 140 MiB for install shim" | 170 info "Fixing the statefulfs size at 140 MiB for install shim" |
171 FLAGS_statefulfs_size=140 | 171 FLAGS_statefulfs_size=140 |
172 fi | 172 fi |
173 | 173 |
174 if [ "$((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad))" -gt \ | 174 if [ $((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) -gt \ |
175 "${FLAGS_rootfs_partition_size}" ] ; then | 175 ${FLAGS_rootfs_partition_size} ] ; then |
176 die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \ | 176 die "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \ |
177 bigger than partition (${FLAGS_rootfs_partition_size} MiB)." | 177 bigger than partition (${FLAGS_rootfs_partition_size} MiB)." |
178 fi | 178 fi |
179 | 179 |
180 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" | 180 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" |
181 if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then | 181 if [ ${FLAGS_fast} -eq ${FLAGS_TRUE} ]; then |
182 echo "Using alternate emerge" | 182 echo "Using alternate emerge" |
183 EMERGE_CMD="${GCLIENT_ROOT}/chromite/bin/parallel_emerge" | 183 EMERGE_CMD="${GCLIENT_ROOT}/chromite/bin/parallel_emerge" |
184 EMERGE_BOARD_CMD="${EMERGE_CMD} --board=${FLAGS_board}" | 184 EMERGE_BOARD_CMD="${EMERGE_CMD} --board=${FLAGS_board}" |
185 fi | 185 fi |
186 | 186 |
187 OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos/" | 187 OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos/" |
188 | 188 |
189 # Determine build version. | 189 # Determine build version. |
190 . "${OVERLAY_CHROMEOS_DIR}/config/chromeos_version.sh" | 190 . "${OVERLAY_CHROMEOS_DIR}/config/chromeos_version.sh" |
191 | 191 |
192 # Configure extra USE or packages for this type of build. | 192 # Configure extra USE or packages for this type of build. |
193 EXTRA_PACKAGES="" | 193 EXTRA_PACKAGES="" |
194 EXTRA_USE="" | 194 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then |
195 if [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ] ; then | |
196 # Factory install needs to have the kernel initrmafs enabled, | 195 # Factory install needs to have the kernel initrmafs enabled, |
197 # and the factory installer added. | 196 # and the factory installer added. |
198 EXTRA_PACKAGES="${EXTRA_PACKAGES} chromeos-base/chromeos-factoryinstall" | 197 EXTRA_PACKAGES="${EXTRA_PACKAGES} chromeos-base/chromeos-factoryinstall" |
199 EXTRA_USE="${EXTRA_USE} initramfs" | 198 export USE="${USE} initramfs" |
200 fi | 199 fi |
201 | 200 |
| 201 emerge_to_image() { |
| 202 sudo -E ${EMERGE_BOARD_CMD} --root-deps=rdeps --usepkgonly \ |
| 203 "$@" ${EMERGE_JOBS} |
| 204 } |
| 205 |
202 # Freshen kernel with correct USE flags. This is a noop if we have | 206 # Freshen kernel with correct USE flags. This is a noop if we have |
203 # the right kernel prebuilt. Factory install uses USE="initramfs". | 207 # the right kernel prebuilt. Factory install uses USE="initramfs". |
204 # We don't allow building from source with the image as a target, | 208 # We don't allow building from source with the image as a target, |
205 # and it's not possible to store prebuilts for the same package | 209 # and it's not possible to store prebuilts for the same package |
206 # with different use flags. | 210 # with different use flags. |
207 USE="${EXTRA_USE} ${USE}" emerge-${FLAGS_board} \ | 211 sudo -E ${EMERGE_BOARD_CMD} -uDNv -g virtual/kernel |
208 -uNDvg --binpkg-respect-use=y virtual/kernel | |
209 | 212 |
210 # Use canonical path since some tools (e.g. mount) do not like symlinks. | 213 # Use canonical path since some tools (e.g. mount) do not like symlinks. |
211 # Append build attempt to output directory. | 214 # Append build attempt to output directory. |
212 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" | 215 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" |
213 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}" | 216 OUTPUT_DIR="${FLAGS_output_root}/${FLAGS_board}/${IMAGE_SUBDIR}" |
214 | 217 |
215 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 218 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
216 | 219 |
217 # If we are creating a developer image, also create a pristine image with a | 220 # If we are creating a developer image, also create a pristine image with a |
218 # different name. | 221 # different name. |
219 DEVELOPER_IMAGE_NAME= | 222 DEVELOPER_IMAGE_NAME= |
220 PRISTINE_IMAGE_NAME=chromiumos_image.bin | 223 PRISTINE_IMAGE_NAME=chromiumos_image.bin |
221 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then | 224 if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
222 PRISTINE_IMAGE_NAME=chromiumos_base_image.bin | 225 PRISTINE_IMAGE_NAME=chromiumos_base_image.bin |
223 DEVELOPER_IMAGE_NAME=chromiumos_image.bin | 226 DEVELOPER_IMAGE_NAME=chromiumos_image.bin |
224 # Rename pristine image for factory install shim | 227 # Rename pristine image for factory install shim |
225 elif [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ]; then | 228 elif [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
226 PRISTINE_IMAGE_NAME=factory_install_shim.bin | 229 PRISTINE_IMAGE_NAME=factory_install_shim.bin |
227 fi | 230 fi |
228 | 231 |
229 PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" | 232 PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" |
230 DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}" | 233 DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}" |
231 | 234 |
232 BOARD="${FLAGS_board}" | 235 BOARD="${FLAGS_board}" |
233 BOARD_ROOT="${FLAGS_build_root}/${BOARD}" | 236 BOARD_ROOT="${FLAGS_build_root}/${BOARD}" |
234 | 237 |
235 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" | 238 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ | 414 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ |
412 --image "${image_name}" -r "${ROOT_FS_DIR}" \ | 415 --image "${image_name}" -r "${ROOT_FS_DIR}" \ |
413 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" | 416 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" |
414 | 417 |
415 # Determine the root dir for developer packages. | 418 # Determine the root dir for developer packages. |
416 local root_dev_dir="${ROOT_FS_DIR}" | 419 local root_dev_dir="${ROOT_FS_DIR}" |
417 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \ | 420 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \ |
418 root_dev_dir="${ROOT_FS_DIR}/usr/local" | 421 root_dev_dir="${ROOT_FS_DIR}/usr/local" |
419 | 422 |
420 # Install developer packages described in chromeos-dev. | 423 # Install developer packages described in chromeos-dev. |
421 sudo -E USE="${USE} ${EXTRA_USE}" INSTALL_MASK="${INSTALL_MASK}" \ | 424 emerge_to_image --root="${root_dev_dir}" -uDNv chromeos-dev |
422 ${EMERGE_BOARD_CMD} --root="${root_dev_dir}" --root-deps=rdeps \ | |
423 --usepkgonly -uDNv chromeos-dev ${EMERGE_JOBS} | |
424 | 425 |
425 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then | 426 if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then |
426 # Clean out unused packages | 427 # Clean out unused packages |
427 sudo -E USE="${USE} ${EXTRA_USE}" INSTALL_MASK="${INSTALL_MASK}" \ | 428 emerge_to_image --root="${ROOT_FS_DIR}" --depclean |
428 ${EMERGE_BOARD_CMD} --root="${ROOT_FS_DIR}" --root-deps=rdeps \ | |
429 --usepkgonly --depclean ${EMERGE_JOBS} | |
430 fi | 429 fi |
431 | 430 |
432 # Install the bare necessary files so that the "emerge" command works | 431 # Install the bare necessary files so that the "emerge" command works |
433 if [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ]; then | 432 if [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ]; then |
434 sudo cp -a ${root_dev_dir}/share/portage ${ROOT_FS_DIR}/usr/share | 433 sudo cp -a ${root_dev_dir}/share/portage ${ROOT_FS_DIR}/usr/share |
435 sudo sed -i s,/usr/bin/wget,wget, \ | 434 sudo sed -i s,/usr/bin/wget,wget, \ |
436 ${ROOT_FS_DIR}/usr/share/portage/config/make.globals | 435 ${ROOT_FS_DIR}/usr/share/portage/config/make.globals |
437 fi | 436 fi |
438 sudo mkdir -p ${ROOT_FS_DIR}/etc/make.profile | 437 sudo mkdir -p ${ROOT_FS_DIR}/etc/make.profile |
439 | 438 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 echo "Updating base packages on ${image_name}" | 498 echo "Updating base packages on ${image_name}" |
500 | 499 |
501 # Create stateful partition of the same size as the rootfs. | 500 # Create stateful partition of the same size as the rootfs. |
502 trap "mount_gpt_cleanup" EXIT | 501 trap "mount_gpt_cleanup" EXIT |
503 | 502 |
504 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ | 503 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ |
505 --image "${image_name}" -r "${ROOT_FS_DIR}" \ | 504 --image "${image_name}" -r "${ROOT_FS_DIR}" \ |
506 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" | 505 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" |
507 | 506 |
508 # Emerge updated packages, exactly like when creating base image | 507 # Emerge updated packages, exactly like when creating base image |
509 sudo USE="${EXTRA_USE}" INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ | 508 emerge_to_image --root="${ROOT_FS_DIR}" -uDNv chromeos ${EXTRA_PACKAGES} |
510 --root="${ROOT_FS_DIR}" --root-deps=rdeps \ | |
511 --usepkgonly -uDNv chromeos ${EXTRA_PACKAGES} ${EMERGE_JOBS} | |
512 | 509 |
513 # Clean out unused packages | 510 # Clean out unused packages |
514 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ | 511 emerge_to_image --root="${ROOT_FS_DIR}" --depclean |
515 --root="${ROOT_FS_DIR}" --root-deps=rdeps \ | |
516 --usepkgonly --depclean ${EMERGE_JOBS} | |
517 | 512 |
518 trap - EXIT | 513 trap - EXIT |
519 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ | 514 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${ROOT_FS_DIR}" \ |
520 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" | 515 -s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}" |
521 } | 516 } |
522 | 517 |
523 zero_free_space() { | 518 zero_free_space() { |
524 local fs_mount_point=$1 | 519 local fs_mount_point=$1 |
525 info "Zeroing freespace in ${fs_mount_point}" | 520 info "Zeroing freespace in ${fs_mount_point}" |
526 # dd is a silly thing and will produce a "No space left on device" message | 521 # dd is a silly thing and will produce a "No space left on device" message |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" | 626 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" |
632 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" | 627 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" |
633 sudo mkdir -p "${ROOT_FS_DIR}/var" | 628 sudo mkdir -p "${ROOT_FS_DIR}/var" |
634 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var" | 629 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var" |
635 sudo mkdir -p "${ROOT_FS_DIR}/dev" | 630 sudo mkdir -p "${ROOT_FS_DIR}/dev" |
636 | 631 |
637 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkgonly" all of the | 632 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkgonly" all of the |
638 # runtime packages for chrome os. This builds up a chrome os image from | 633 # runtime packages for chrome os. This builds up a chrome os image from |
639 # binary packages with runtime dependencies only. We use INSTALL_MASK to | 634 # binary packages with runtime dependencies only. We use INSTALL_MASK to |
640 # trim the image size as much as possible. | 635 # trim the image size as much as possible. |
641 sudo USE="${EXTRA_USE}" INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ | 636 emerge_to_image --root="${ROOT_FS_DIR}" chromeos ${EXTRA_PACKAGES} |
642 --root="${ROOT_FS_DIR}" --root-deps=rdeps \ | |
643 --usepkgonly chromeos ${EXTRA_PACKAGES} ${EMERGE_JOBS} | |
644 | 637 |
645 # Set /etc/lsb-release on the image. | 638 # Set /etc/lsb-release on the image. |
646 "${OVERLAY_CHROMEOS_DIR}/scripts/cros_set_lsb_release" \ | 639 "${OVERLAY_CHROMEOS_DIR}/scripts/cros_set_lsb_release" \ |
647 --root="${ROOT_FS_DIR}" \ | 640 --root="${ROOT_FS_DIR}" \ |
648 --board="${BOARD}" | 641 --board="${BOARD}" |
649 | 642 |
650 # Populates the root filesystem with legacy bootloader templates | 643 # Populates the root filesystem with legacy bootloader templates |
651 # appropriate for the platform. The autoupdater and installer will | 644 # appropriate for the platform. The autoupdater and installer will |
652 # use those templates to update the legacy boot partition (12/ESP) | 645 # use those templates to update the legacy boot partition (12/ESP) |
653 # on update. | 646 # on update. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 724 |
732 # Copy forward the developer image, if we already copied forward the base. | 725 # Copy forward the developer image, if we already copied forward the base. |
733 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \ | 726 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]] && \ |
734 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then | 727 [[ -f ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ]] ; then |
735 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR} | 728 cp ${PREVIOUS_DIR}/${DEVELOPER_IMAGE_NAME} ${OUTPUT_DIR} |
736 fi | 729 fi |
737 fi | 730 fi |
738 fi | 731 fi |
739 | 732 |
740 # Perform an eclean to remove packages which are not installed | 733 # Perform an eclean to remove packages which are not installed |
741 if [[ "${FLAGS_eclean}" -eq "${FLAGS_TRUE}" ]]; then | 734 if [[ ${FLAGS_eclean} -eq ${FLAGS_TRUE} ]]; then |
742 eclean-${FLAGS_board} -d packages | 735 eclean-${FLAGS_board} -d packages |
743 fi | 736 fi |
744 | 737 |
745 # Create the boot.desc file which stores the build-time configuration | 738 # Create the boot.desc file which stores the build-time configuration |
746 # information needed for making the image bootable after creation with | 739 # information needed for making the image bootable after creation with |
747 # cros_make_image_bootable. | 740 # cros_make_image_bootable. |
748 create_boot_desc | 741 create_boot_desc |
749 | 742 |
750 if [[ -f ${PRISTINE_IMG} ]] ; then | 743 if [[ -f ${PRISTINE_IMG} ]] ; then |
751 update_base_packages ${PRISTINE_IMAGE_NAME} | 744 update_base_packages ${PRISTINE_IMAGE_NAME} |
752 else | 745 else |
753 create_base_image ${PRISTINE_IMAGE_NAME} | 746 create_base_image ${PRISTINE_IMAGE_NAME} |
754 fi | 747 fi |
755 | 748 |
756 USE_DEV_KEYS= | 749 USE_DEV_KEYS= |
757 if [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ]; then | 750 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
758 USE_DEV_KEYS="--use_dev_keys" | 751 USE_DEV_KEYS="--use_dev_keys" |
759 fi | 752 fi |
760 | 753 |
761 # Place flags before positional args | 754 # Place flags before positional args |
762 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ | 755 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ |
763 "${PRISTINE_IMAGE_NAME}" \ | 756 "${PRISTINE_IMAGE_NAME}" \ |
764 ${USE_DEV_KEYS} \ | 757 ${USE_DEV_KEYS} \ |
765 ${crosbug12352_flag} | 758 ${crosbug12352_flag} |
766 | 759 |
767 # FIXME Test x86 image, and test arm image if enabled; | 760 # FIXME Test x86 image, and test arm image if enabled; |
768 # should unconditionally test an image after crosbug12352 is fixed | 761 # should unconditionally test an image after crosbug12352 is fixed |
769 if [[ "${ARCH}" = "x86" ]] || | 762 if [[ "${ARCH}" = "x86" ]] || |
770 [[ "${ARCH}" = "arm" && | 763 [[ "${ARCH}" = "arm" && |
771 "${FLAGS_crosbug12352_arm_kernel_signing}" -eq "${FLAGS_TRUE}" ]]; then | 764 ${FLAGS_crosbug12352_arm_kernel_signing} -eq ${FLAGS_TRUE} ]]; then |
772 BOOT_FLAG= | 765 BOOT_FLAG= |
773 if [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ]; then | 766 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then |
774 BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h | 767 BOOT_FLAG="-b 1" # BOOT_FLAG_DEVELOPER value defined in load_kernel_fw.h |
775 info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to \ | 768 info "--factory_install set, pass BOOT_FLAG_DEVELOPER flag to \ |
776 load_kernel_test" | 769 load_kernel_test" |
777 fi | 770 fi |
778 | 771 |
779 # Verify the final image. | 772 # Verify the final image. |
780 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ | 773 load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \ |
781 "${DEVKEYSDIR}/recovery_key.vbpubk" ${BOOT_FLAG} | 774 "${DEVKEYSDIR}/recovery_key.vbpubk" ${BOOT_FLAG} |
782 fi | 775 fi |
783 | 776 |
784 # Create a developer image based on the chromium os base image. | 777 # Create a developer image based on the chromium os base image. |
785 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ] ; then | 778 if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ] ; then |
786 if [[ ! -f ${DEVELOPER_IMG} ]] ; then | 779 if [[ ! -f ${DEVELOPER_IMG} ]] ; then |
787 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}" | 780 echo "Creating developer image from base image ${PRISTINE_IMAGE_NAME}" |
788 cp ${PRISTINE_IMG} ${DEVELOPER_IMG} | 781 cp ${PRISTINE_IMG} ${DEVELOPER_IMG} |
789 fi | 782 fi |
790 | 783 |
791 update_dev_packages ${DEVELOPER_IMAGE_NAME} | 784 update_dev_packages ${DEVELOPER_IMAGE_NAME} |
792 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ | 785 ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ |
793 "${DEVELOPER_IMAGE_NAME}" \ | 786 "${DEVELOPER_IMAGE_NAME}" \ |
794 ${crosbug12352_flag} | 787 ${crosbug12352_flag} |
795 fi | 788 fi |
796 | 789 |
797 # Clean up temporary files. | 790 # Clean up temporary files. |
798 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ | 791 rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ |
799 "${ESP_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" | 792 "${ESP_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" |
800 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}" | 793 rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}" |
801 | 794 |
802 # Generating AU generator zip file to run outside chroot | 795 # Generating AU generator zip file to run outside chroot |
803 generate_au_zip || echo "Failed generating AU zip file - ignoring Error..." | 796 generate_au_zip || echo "Failed generating AU zip file - ignoring Error..." |
804 # Create a 'latest' link | 797 # Create a 'latest' link |
805 rm -f ${FLAGS_output_root}/${FLAGS_board}/latest | 798 rm -f ${FLAGS_output_root}/${FLAGS_board}/latest |
806 ln -s $(basename ${OUTPUT_DIR}) ${FLAGS_output_root}/${FLAGS_board}/latest | 799 ln -s $(basename ${OUTPUT_DIR}) ${FLAGS_output_root}/${FLAGS_board}/latest |
807 | 800 |
808 echo "Done. Image created in ${OUTPUT_DIR}" | 801 echo "Done. Image created in ${OUTPUT_DIR}" |
809 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" | 802 echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" |
810 if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then | 803 if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then |
811 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 804 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
812 fi | 805 fi |
813 | 806 |
814 print_time_elapsed | 807 print_time_elapsed |
815 | 808 |
816 echo "To copy to USB keyfob, do something like:" | 809 echo "To copy to USB keyfob, do something like:" |
817 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 810 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
818 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 811 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
819 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 812 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
820 echo "from the scripts directory where you entered the chroot." | 813 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |