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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 315 # Move the verification block needed for the hard disk install to the |
316 # stateful partition. Mount stateful fs, copy file, and umount fs. | 316 # stateful partition. Mount stateful fs, copy file, and umount fs. |
317 # In original CL: http://codereview.chromium.org/2868044, this was done in | 317 # In original CL: http://codereview.chromium.org/2868044, this was done in |
318 # create_base_image(). However, it could break the build if it is a clean | 318 # create_base_image(). However, it could break the build if it is a clean |
319 # build because vmlinuz_hd.vblock hasn't been created by build_kernel_image.sh | 319 # build because vmlinuz_hd.vblock hasn't been created by build_kernel_image.sh |
320 if [[ "${ARCH}" = "x86" ]]; then | 320 if [[ "${ARCH}" = "x86" ]]; then |
trchen
2010/07/08 03:36:08
we already called mount_gpt_images.sh on line 288.
| |
321 STATEFUL_LOOP_DEV=$(sudo losetup -f) | |
322 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then | |
323 echo "No free loop device. Free up a loop device or reboot. exiting. " | |
324 exit 1 | |
325 fi | |
326 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" | |
327 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" | |
328 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" | 321 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" |
329 sudo umount -d "${STATEFUL_FS_DIR}" | |
330 STATEFUL_LOOP_DEV= | |
331 fi | 322 fi |
332 | 323 |
333 # START_KERN_A is set by the first call to install the gpt. | 324 # START_KERN_A is set by the first call to install the gpt. |
334 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" | 325 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" |
335 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ | 326 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ |
336 conv=notrunc bs=512 seek=${koffset} | 327 conv=notrunc bs=512 seek=${koffset} |
337 | 328 |
338 # Populate the legacy/efi bootloader partition. | 329 # Populate the legacy/efi bootloader partition. |
339 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" | 330 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" |
340 local bootloader_to="${ESP_FS_IMG}" | 331 local bootloader_to="${ESP_FS_IMG}" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 694 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
704 fi | 695 fi |
705 | 696 |
706 print_time_elapsed | 697 print_time_elapsed |
707 | 698 |
708 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 699 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
709 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 700 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
710 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 701 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
711 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 702 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
712 echo "from the scripts directory where you entered the chroot." | 703 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |