| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 # Use canonical path since some tools (e.g. mount) do not like symlinks | 60 # Use canonical path since some tools (e.g. mount) do not like symlinks |
| 61 # Append build attempt to output directory | 61 # Append build attempt to output directory |
| 62 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" | 62 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" |
| 63 OUTPUT_DIR="${FLAGS_output_root}/${IMAGE_SUBDIR}" | 63 OUTPUT_DIR="${FLAGS_output_root}/${IMAGE_SUBDIR}" |
| 64 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs" | 64 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs" |
| 65 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" | 65 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" |
| 66 MBR_IMG="${OUTPUT_DIR}/mbr.image" | 66 MBR_IMG="${OUTPUT_DIR}/mbr.image" |
| 67 OUTPUT_IMG="${OUTPUT_DIR}/usb.img" | 67 OUTPUT_IMG="${OUTPUT_DIR}/usb.img" |
| 68 | 68 |
| 69 # These paths are relative to SCRIPTS_DIR. |
| 69 ROOTFS_PACKAGE_INSTALL_SCRIPT="install_packages.sh" | 70 ROOTFS_PACKAGE_INSTALL_SCRIPT="install_packages.sh" |
| 70 ROOTFS_CUSTOMIZE_SCRIPT="customize_rootfs.sh" | 71 ROOTFS_CUSTOMIZE_SCRIPT="customize_rootfs.sh" |
| 72 |
| 73 ROOTFS_STATIC_DATA="${SRC_ROOT}/rootfs_static_data" |
| 71 ROOTFS_SETUP_DIR="/tmp/chromeos_setup" | 74 ROOTFS_SETUP_DIR="/tmp/chromeos_setup" |
| 72 SETUP_DIR="${ROOT_FS_DIR}/${ROOTFS_SETUP_DIR}" | 75 SETUP_DIR="${ROOT_FS_DIR}/${ROOTFS_SETUP_DIR}" |
| 73 | 76 |
| 74 LOOP_DEV= | 77 LOOP_DEV= |
| 75 | 78 |
| 76 # Handle existing directory | 79 # Handle existing directory |
| 77 if [ -e "$OUTPUT_DIR" ] | 80 if [ -e "$OUTPUT_DIR" ] |
| 78 then | 81 then |
| 79 if [ $FLAGS_replace -eq $FLAGS_TRUE ] | 82 if [ $FLAGS_replace -eq $FLAGS_TRUE ] |
| 80 then | 83 then |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 # TODO: also use this instead of SETUP_DIR for other things below? | 178 # TODO: also use this instead of SETUP_DIR for other things below? |
| 176 sudo mkdir -p "$ROOT_FS_DIR/trunk" | 179 sudo mkdir -p "$ROOT_FS_DIR/trunk" |
| 177 sudo mount --bind "$GCLIENT_ROOT" "$ROOT_FS_DIR/trunk" | 180 sudo mount --bind "$GCLIENT_ROOT" "$ROOT_FS_DIR/trunk" |
| 178 | 181 |
| 179 # Create setup directory and copy over scripts, config files, and locally | 182 # Create setup directory and copy over scripts, config files, and locally |
| 180 # built packages. | 183 # built packages. |
| 181 mkdir -p "$SETUP_DIR" | 184 mkdir -p "$SETUP_DIR" |
| 182 mkdir -p "${SETUP_DIR}/local_packages" | 185 mkdir -p "${SETUP_DIR}/local_packages" |
| 183 cp "${SCRIPTS_DIR}/${ROOTFS_PACKAGE_INSTALL_SCRIPT}" "$SETUP_DIR" | 186 cp "${SCRIPTS_DIR}/${ROOTFS_PACKAGE_INSTALL_SCRIPT}" "$SETUP_DIR" |
| 184 cp "${SCRIPTS_DIR}/${ROOTFS_CUSTOMIZE_SCRIPT}" "$SETUP_DIR" | 187 cp "${SCRIPTS_DIR}/${ROOTFS_CUSTOMIZE_SCRIPT}" "$SETUP_DIR" |
| 188 cp -r "$ROOTFS_STATIC_DATA" "$SETUP_DIR" |
| 185 cp "$FLAGS_pkglist" "${SETUP_DIR}/package-list-prod.txt" | 189 cp "$FLAGS_pkglist" "${SETUP_DIR}/package-list-prod.txt" |
| 186 cp "${FLAGS_build_root}/x86/local_packages"/* "${SETUP_DIR}/local_packages" | 190 cp "${FLAGS_build_root}/x86/local_packages"/* "${SETUP_DIR}/local_packages" |
| 187 | 191 |
| 188 if [ -n "$FLAGS_pkglist2" ] | 192 if [ -n "$FLAGS_pkglist2" ] |
| 189 then | 193 then |
| 190 cp "$FLAGS_pkglist2" "${SETUP_DIR}/package-list-2.txt" | 194 cp "$FLAGS_pkglist2" "${SETUP_DIR}/package-list-2.txt" |
| 191 fi | 195 fi |
| 192 | 196 |
| 193 # Set up repository for local packages to install in the rootfs via apt-get. | 197 # Set up repository for local packages to install in the rootfs via apt-get. |
| 194 cd "$SETUP_DIR" | 198 cd "$SETUP_DIR" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 EOF | 275 EOF |
| 272 | 276 |
| 273 OUTSIDE_OUTPUT_DIR="~/chromeos/src/build/images/${IMAGE_SUBDIR}" | 277 OUTSIDE_OUTPUT_DIR="~/chromeos/src/build/images/${IMAGE_SUBDIR}" |
| 274 echo "Done. Image created in ${OUTPUT_DIR}" | 278 echo "Done. Image created in ${OUTPUT_DIR}" |
| 275 echo "To copy to USB keyfob, outside the chroot, do something like:" | 279 echo "To copy to USB keyfob, outside the chroot, do something like:" |
| 276 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 280 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
| 277 echo "To convert to VMWare image, outside the chroot, do something like:" | 281 echo "To convert to VMWare image, outside the chroot, do something like:" |
| 278 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 282 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 279 | 283 |
| 280 trap - EXIT | 284 trap - EXIT |
| OLD | NEW |