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 STATEFUL_LOOP_DEV=$(sudo losetup -f) | 320 if [[ "${ARCH}" = "x86" ]]; then |
| 321 STATEFUL_LOOP_DEV=$(sudo losetup -f) |
321 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then | 322 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then |
322 echo "No free loop device. Free up a loop device or reboot. exiting. " | 323 echo "No free loop device. Free up a loop device or reboot. exiting. " |
323 exit 1 | 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}" |
| 329 sudo umount -d "${STATEFUL_FS_DIR}" |
| 330 STATEFUL_LOOP_DEV= |
324 fi | 331 fi |
325 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" | |
326 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" | |
327 sudo cp "${OUTPUT_DIR}/vmlinuz_hd.vblock" "${STATEFUL_FS_DIR}" | |
328 sudo umount -d "${STATEFUL_FS_DIR}" | |
329 STATEFUL_LOOP_DEV= | |
330 | 332 |
331 # START_KERN_A is set by the first call to install the gpt. | 333 # START_KERN_A is set by the first call to install the gpt. |
332 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" | 334 local koffset="$(partoffset ${OUTPUT_DIR}/${image_name} 2)" |
333 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ | 335 sudo dd if="${OUTPUT_DIR}/vmlinuz.image" of="${OUTPUT_DIR}/${image_name}" \ |
334 conv=notrunc bs=512 seek=${koffset} | 336 conv=notrunc bs=512 seek=${koffset} |
335 | 337 |
336 # Populate the legacy/efi bootloader partition. | 338 # Populate the legacy/efi bootloader partition. |
337 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" | 339 local kernel_part="--kernel_partition='${OUTPUT_DIR}/vmlinuz.image'" |
338 local bootloader_to="${ESP_FS_IMG}" | 340 local bootloader_to="${ESP_FS_IMG}" |
339 local usb_disk="${FLAGS_usb_disk}" | 341 local usb_disk="${FLAGS_usb_disk}" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 695 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
694 fi | 696 fi |
695 | 697 |
696 print_time_elapsed | 698 print_time_elapsed |
697 | 699 |
698 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 700 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
699 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 701 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
700 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 702 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
701 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 703 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
702 echo "from the scripts directory where you entered the chroot." | 704 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |