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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 DEFINE_integer vboot_behavior 2 \ | 67 DEFINE_integer vboot_behavior 2 \ |
68 "Verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \ | 68 "Verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) \ |
69 Default: 2" | 69 Default: 2" |
70 DEFINE_integer vboot_depth 1 \ | 70 DEFINE_integer vboot_depth 1 \ |
71 "Verified boot hash tree depth. Default: 1" | 71 "Verified boot hash tree depth. Default: 1" |
72 DEFINE_integer vboot_max_ios 1024 \ | 72 DEFINE_integer vboot_max_ios 1024 \ |
73 "Number of outstanding I/O operations dm-verity caps at. Default: 1024" | 73 "Number of outstanding I/O operations dm-verity caps at. Default: 1024" |
74 DEFINE_string vboot_algorithm "sha1" \ | 74 DEFINE_string vboot_algorithm "sha1" \ |
75 "Cryptographic hash algorithm used for vboot. Default : sha1" | 75 "Cryptographic hash algorithm used for vboot. Default : sha1" |
76 | 76 |
| 77 DEFINE_string oem_customization \ |
| 78 "$GCLIENT_ROOT/src/platform/assets/oem_customization" \ |
| 79 "Path to directory containing OEM partner partition contents" |
| 80 |
77 # Parse command line. | 81 # Parse command line. |
78 FLAGS "$@" || exit 1 | 82 FLAGS "$@" || exit 1 |
79 eval set -- "${FLAGS_ARGV}" | 83 eval set -- "${FLAGS_ARGV}" |
80 | 84 |
81 # Only now can we die on error. shflags functions leak non-zero error codes, | 85 # Only now can we die on error. shflags functions leak non-zero error codes, |
82 # so will die prematurely if 'set -e' is specified before now. | 86 # so will die prematurely if 'set -e' is specified before now. |
83 set -e | 87 set -e |
84 | 88 |
85 if [ -z "${FLAGS_board}" ] ; then | 89 if [ -z "${FLAGS_board}" ] ; then |
86 error "--board is required." | 90 error "--board is required." |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 dd if=/dev/zero of="${OEM_FS_IMG}" bs=1 count=1 seek=$((OEM_SIZE_BYTES - 1)) | 527 dd if=/dev/zero of="${OEM_FS_IMG}" bs=1 count=1 seek=$((OEM_SIZE_BYTES - 1)) |
524 | 528 |
525 # Tune and mount OEM partner partition. | 529 # Tune and mount OEM partner partition. |
526 UUID=$(uuidgen) | 530 UUID=$(uuidgen) |
527 DISK_LABEL="C-OEM" | 531 DISK_LABEL="C-OEM" |
528 sudo losetup "${OEM_LOOP_DEV}" "${OEM_FS_IMG}" | 532 sudo losetup "${OEM_LOOP_DEV}" "${OEM_FS_IMG}" |
529 sudo mkfs.ext3 "${OEM_LOOP_DEV}" | 533 sudo mkfs.ext3 "${OEM_LOOP_DEV}" |
530 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${OEM_LOOP_DEV}" | 534 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${OEM_LOOP_DEV}" |
531 sudo mount "${OEM_LOOP_DEV}" "${OEM_FS_DIR}" | 535 sudo mount "${OEM_LOOP_DEV}" "${OEM_FS_DIR}" |
532 | 536 |
| 537 # Populate OEM partner partition. |
| 538 if [ -n ${FLAGS_oem_customization} ]; then |
| 539 if [ ! -d ${FLAGS_oem_customization} ]; then |
| 540 echo "Specified OEM content directory does not exist. exiting." |
| 541 exit 1 |
| 542 fi |
| 543 for ITEM in `ls -A ${FLAGS_oem_customization}` |
| 544 do sudo cp -a "${FLAGS_oem_customization}/$ITEM" "${OEM_FS_DIR}" |
| 545 done |
| 546 sudo find "${OEM_FS_DIR}" -type d -exec chmod 755 "{}" \; |
| 547 sudo find "${OEM_FS_DIR}" -type f -exec chmod 644 "{}" \; |
| 548 sudo chown -R root:root "${OEM_FS_DIR}" |
| 549 fi |
| 550 |
533 # -- Install packages into the root file system -- | 551 # -- Install packages into the root file system -- |
534 | 552 |
535 # We need to install libc manually from the cross toolchain. | 553 # We need to install libc manually from the cross toolchain. |
536 # TODO: Improve this? We only want libc and not the whole toolchain. | 554 # TODO: Improve this? We only want libc and not the whole toolchain. |
537 PKGDIR="/var/lib/portage/pkgs/cross/" | 555 PKGDIR="/var/lib/portage/pkgs/cross/" |
538 sudo tar jxvpf \ | 556 sudo tar jxvpf \ |
539 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \ | 557 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \ |
540 -C "${ROOT_FS_DIR}" --strip-components=3 \ | 558 -C "${ROOT_FS_DIR}" --strip-components=3 \ |
541 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o | 559 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o |
542 | 560 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 712 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
695 fi | 713 fi |
696 | 714 |
697 print_time_elapsed | 715 print_time_elapsed |
698 | 716 |
699 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 717 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
700 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 718 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
701 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 719 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
702 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 720 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
703 echo "from the scripts directory where you entered the chroot." | 721 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |