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 19 matching lines...) Expand all Loading... |
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_EXT_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 \ |
| 41 "Include additional developer-friendly packages in the image." |
40 | 42 |
41 # Parse command line | 43 # Parse command line |
42 FLAGS "$@" || exit 1 | 44 FLAGS "$@" || exit 1 |
43 eval set -- "${FLAGS_ARGV}" | 45 eval set -- "${FLAGS_ARGV}" |
44 | 46 |
45 # Die on any errors. | 47 # Die on any errors. |
46 set -e | 48 set -e |
47 | 49 |
48 # Determine build version | 50 # Determine build version |
49 . "${SCRIPTS_DIR}/chromeos_version.sh" | 51 . "${SCRIPTS_DIR}/chromeos_version.sh" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 fi | 112 fi |
111 UUID=`uuidgen` | 113 UUID=`uuidgen` |
112 DISK_LABEL=C-ROOT | 114 DISK_LABEL=C-ROOT |
113 LOOP_DEV=`sudo losetup -f` | 115 LOOP_DEV=`sudo losetup -f` |
114 sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG" | 116 sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG" |
115 sudo mkfs.ext3 "$LOOP_DEV" | 117 sudo mkfs.ext3 "$LOOP_DEV" |
116 sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV" | 118 sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV" |
117 sudo mount "$LOOP_DEV" "$ROOT_FS_DIR" | 119 sudo mount "$LOOP_DEV" "$ROOT_FS_DIR" |
118 | 120 |
119 # -- Install packages and customize root file system. -- | 121 # -- Install packages and customize root file system. -- |
120 | 122 PKGLIST="$FLAGS_pkglist" |
| 123 if [ $FLAGS_with_dev_pkglist -eq $FLAGS_TRUE ]; then |
| 124 PKGLIST="$PKGLIST,${SRC_ROOT}/package_repo/package-list-debug.txt" |
| 125 fi |
121 "${SCRIPTS_DIR}/install_packages.sh" \ | 126 "${SCRIPTS_DIR}/install_packages.sh" \ |
122 --build_root="${FLAGS_build_root}" \ | 127 --build_root="${FLAGS_build_root}" \ |
123 --root="$ROOT_FS_DIR" \ | 128 --root="$ROOT_FS_DIR" \ |
124 --output_dir="${OUTPUT_DIR}" \ | 129 --output_dir="${OUTPUT_DIR}" \ |
125 --package_list="$FLAGS_pkglist" \ | 130 --package_list="$PKGLIST" \ |
126 --server="$FLAGS_mirror" \ | 131 --server="$FLAGS_mirror" \ |
127 --suite="$FLAGS_suite" | 132 --suite="$FLAGS_suite" |
128 | 133 |
129 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" | 134 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" |
130 | 135 |
131 # -- Turn root file system into bootable image -- | 136 # -- Turn root file system into bootable image -- |
132 | 137 |
133 # Setup extlinux configuration. | 138 # Setup extlinux configuration. |
134 # 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 |
135 # 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. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EOF | 174 EOF |
170 | 175 |
171 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" | 176 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" |
172 echo "Done. Image created in ${OUTPUT_DIR}" | 177 echo "Done. Image created in ${OUTPUT_DIR}" |
173 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:" |
174 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" |
175 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:" |
176 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 181 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
177 | 182 |
178 trap - EXIT | 183 trap - EXIT |
OLD | NEW |