| 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. | 7 # Script to build a bootable keyfob-based chromeos system image. |
| 8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to | 8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to |
| 9 # create a base file system. It then cusotmizes the file system and adds | 9 # create a base file system. It then cusotmizes the file system and adds |
| 10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB | 10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 DEFINE_integer build_attempt 1 \ | 26 DEFINE_integer build_attempt 1 \ |
| 27 "The build attempt for this image build." | 27 "The build attempt for this image build." |
| 28 DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ | 28 DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ |
| 29 "Directory in which to place image result directories (named by version)" | 29 "Directory in which to place image result directories (named by version)" |
| 30 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ | 30 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ |
| 31 "Root of build output" | 31 "Root of build output" |
| 32 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing output, if any." | 32 DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing output, if any." |
| 33 DEFINE_boolean increment $FLAGS_FALSE \ | 33 DEFINE_boolean increment $FLAGS_FALSE \ |
| 34 "Picks the latest build and increments the minor version by one." | 34 "Picks the latest build and increments the minor version by one." |
| 35 | 35 |
| 36 DEFINE_string mirror "$DEFAULT_EXT_MIRROR" "Repository mirror to use." | 36 DEFINE_string mirror "$DEFAULT_IMG_MIRROR" "Repository mirror to use." |
| 37 DEFINE_string suite "$DEFAULT_IMG_SUITE" "Repository suite to base image on." | 37 DEFINE_string suite "$DEFAULT_IMG_SUITE" "Repository suite to base image on." |
| 38 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ | 38 DEFINE_string pkglist "$DEFAULT_PKGLIST" \ |
| 39 "Name of file listing packages to install from repository." | 39 "Name of file listing packages to install from repository." |
| 40 DEFINE_boolean with_dev_pkgs $FLAGS_TRUE \ | 40 DEFINE_boolean with_dev_pkgs $FLAGS_TRUE \ |
| 41 "Include additional developer-friendly packages in the image." | 41 "Include additional developer-friendly packages in the image." |
| 42 | 42 |
| 43 # Parse command line | 43 # Parse command line |
| 44 FLAGS "$@" || exit 1 | 44 FLAGS "$@" || exit 1 |
| 45 eval set -- "${FLAGS_ARGV}" | 45 eval set -- "${FLAGS_ARGV}" |
| 46 | 46 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 # -- Install packages and customize root file system. -- | 121 # -- Install packages and customize root file system. -- |
| 122 PKGLIST="$FLAGS_pkglist" | 122 PKGLIST="$FLAGS_pkglist" |
| 123 if [ $FLAGS_with_dev_pkglist -eq $FLAGS_TRUE ]; then | 123 if [ $FLAGS_with_dev_pkglist -eq $FLAGS_TRUE ]; then |
| 124 PKGLIST="$PKGLIST,${SRC_ROOT}/package_repo/package-list-debug.txt" | 124 PKGLIST="$PKGLIST,${SRC_ROOT}/package_repo/package-list-debug.txt" |
| 125 fi | 125 fi |
| 126 "${SCRIPTS_DIR}/install_packages.sh" \ | 126 "${SCRIPTS_DIR}/install_packages.sh" \ |
| 127 --build_root="${FLAGS_build_root}" \ | 127 --build_root="${FLAGS_build_root}" \ |
| 128 --root="$ROOT_FS_DIR" \ | 128 --root="$ROOT_FS_DIR" \ |
| 129 --output_dir="${OUTPUT_DIR}" \ | 129 --output_dir="${OUTPUT_DIR}" \ |
| 130 --package_list="$PKGLIST" \ | 130 --package_list="$PKGLIST" \ |
| 131 --server="$FLAGS_mirror" \ | 131 --mirror="$FLAGS_mirror" \ |
| 132 --suite="$FLAGS_suite" | 132 --suite="$FLAGS_suite" |
| 133 | 133 |
| 134 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" | 134 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" |
| 135 | 135 |
| 136 # -- Turn root file system into bootable image -- | 136 # -- Turn root file system into bootable image -- |
| 137 | 137 |
| 138 # Setup extlinux configuration. | 138 # Setup extlinux configuration. |
| 139 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev | 139 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev |
| 140 # in the initramfs. When we figure that out, switch to root=UUID=$UUID. | 140 # in the initramfs. When we figure that out, switch to root=UUID=$UUID. |
| 141 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf | 141 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 EOF | 174 EOF |
| 175 | 175 |
| 176 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" | 176 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" |
| 177 echo "Done. Image created in ${OUTPUT_DIR}" | 177 echo "Done. Image created in ${OUTPUT_DIR}" |
| 178 echo "To copy to USB keyfob, outside the chroot, do something like:" | 178 echo "To copy to USB keyfob, outside the chroot, do something like:" |
| 179 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 179 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
| 180 echo "To convert to VMWare image, outside the chroot, do something like:" | 180 echo "To convert to VMWare image, outside the chroot, do something like:" |
| 181 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 181 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 182 | 182 |
| 183 trap - EXIT | 183 trap - EXIT |
| OLD | NEW |