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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 -s "${STATEFUL_FS_DIR}" | 243 -s "${STATEFUL_FS_DIR}" |
244 | 244 |
245 # Determine the root dir for developer packages. | 245 # Determine the root dir for developer packages. |
246 local root_dev_dir="${ROOT_FS_DIR}" | 246 local root_dev_dir="${ROOT_FS_DIR}" |
247 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \ | 247 [ ${FLAGS_statefuldev} -eq ${FLAGS_TRUE} ] && \ |
248 root_dev_dir="${ROOT_FS_DIR}/usr/local" | 248 root_dev_dir="${ROOT_FS_DIR}/usr/local" |
249 | 249 |
250 # Install developer packages described in chromeos-dev. | 250 # Install developer packages described in chromeos-dev. |
251 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ | 251 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ |
252 --root="${root_dev_dir}" --root-deps=rdeps \ | 252 --root="${root_dev_dir}" --root-deps=rdeps \ |
253 --usepkgonly chromeos-dev ${EMERGE_JOBS} | 253 --usepkg chromeos-dev ${EMERGE_JOBS} |
254 | 254 |
255 # Re-run ldconfig to fix /etc/ldconfig.so.cache. | 255 # Re-run ldconfig to fix /etc/ldconfig.so.cache. |
256 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" | 256 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" |
257 | 257 |
258 # Mark the image as a developer image (input to chromeos_startup). | 258 # Mark the image as a developer image (input to chromeos_startup). |
259 sudo mkdir -p "${ROOT_FS_DIR}/root" | 259 sudo mkdir -p "${ROOT_FS_DIR}/root" |
260 sudo touch "${ROOT_FS_DIR}/root/.dev_mode" | 260 sudo touch "${ROOT_FS_DIR}/root/.dev_mode" |
261 | 261 |
262 # Additional changes to developer image. | 262 # Additional changes to developer image. |
263 | 263 |
(...skipping 27 matching lines...) Expand all Loading... |
291 echo "Adding recovery packages to ${image_name}" | 291 echo "Adding recovery packages to ${image_name}" |
292 | 292 |
293 # Create stateful partition of the same size as the rootfs. | 293 # Create stateful partition of the same size as the rootfs. |
294 trap "mount_gpt_cleanup \"${ROOT_FS_DIR}\" \"${STATEFUL_FS_DIR}\"" EXIT | 294 trap "mount_gpt_cleanup \"${ROOT_FS_DIR}\" \"${STATEFUL_FS_DIR}\"" EXIT |
295 | 295 |
296 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ | 296 ${SCRIPTS_DIR}/mount_gpt_image.sh --from "${OUTPUT_DIR}" \ |
297 --image "$( basename ${image_name} )" -r "${ROOT_FS_DIR}" \ | 297 --image "$( basename ${image_name} )" -r "${ROOT_FS_DIR}" \ |
298 -s "${STATEFUL_FS_DIR}" | 298 -s "${STATEFUL_FS_DIR}" |
299 | 299 |
300 # Install recovery installer. | 300 # Install recovery installer. |
301 sudo ${EMERGE_BOARD_CMD} --root=${ROOT_FS_DIR} --usepkgonly \ | 301 sudo ${EMERGE_BOARD_CMD} --root=${ROOT_FS_DIR} --usepkg \ |
302 --root-deps=rdeps --nodeps chromeos-recovery | 302 --root-deps=rdeps --nodeps chromeos-recovery |
303 | 303 |
304 # Re-run ldconfig to fix /etc/ldconfig.so.cache. | 304 # Re-run ldconfig to fix /etc/ldconfig.so.cache. |
305 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" | 305 sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" |
306 | 306 |
307 # Mark the image as a developer image (input to chromeos_startup). | 307 # Mark the image as a developer image (input to chromeos_startup). |
308 sudo mkdir -p "${ROOT_FS_DIR}/root" | 308 sudo mkdir -p "${ROOT_FS_DIR}/root" |
309 sudo touch "${ROOT_FS_DIR}/root/.recovery_installer" | 309 sudo touch "${ROOT_FS_DIR}/root/.recovery_installer" |
310 | 310 |
311 trap - EXIT | 311 trap - EXIT |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 411 |
412 # Perform binding rather than symlinking because directories must exist | 412 # Perform binding rather than symlinking because directories must exist |
413 # on rootfs so that we can bind at run-time since rootfs is read-only. | 413 # on rootfs so that we can bind at run-time since rootfs is read-only. |
414 echo "Binding directories from stateful partition onto the rootfs" | 414 echo "Binding directories from stateful partition onto the rootfs" |
415 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" | 415 sudo mkdir -p "${ROOT_FS_DIR}/usr/local" |
416 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" | 416 sudo mount --bind "${DEV_IMAGE_ROOT}" "${ROOT_FS_DIR}/usr/local" |
417 sudo mkdir -p "${ROOT_FS_DIR}/var" | 417 sudo mkdir -p "${ROOT_FS_DIR}/var" |
418 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var" | 418 sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var" |
419 sudo mkdir -p "${ROOT_FS_DIR}/dev" | 419 sudo mkdir -p "${ROOT_FS_DIR}/dev" |
420 | 420 |
421 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkgonly" all of the | 421 # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkg" all of the |
422 # runtime packages for chrome os. This builds up a chrome os image from | 422 # runtime packages for chrome os. This builds up a chrome os image from |
423 # binary packages with runtime dependencies only. We use INSTALL_MASK to | 423 # binary packages with runtime dependencies only. We use INSTALL_MASK to |
424 # trim the image size as much as possible. | 424 # trim the image size as much as possible. |
425 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ | 425 sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ |
426 --root="${ROOT_FS_DIR}" --root-deps=rdeps \ | 426 --root="${ROOT_FS_DIR}" --root-deps=rdeps \ |
427 --usepkgonly chromeos ${EMERGE_JOBS} | 427 --usepkg chromeos ${EMERGE_JOBS} |
428 | 428 |
429 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI | 429 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI |
430 # BIOS). We only need this for x86, but it's simpler and safer to keep the | 430 # BIOS). We only need this for x86, but it's simpler and safer to keep the |
431 # disk images the same for both x86 and ARM. | 431 # disk images the same for both x86 and ARM. |
432 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. | 432 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. |
433 # We'll hard-code it to 16M for now. | 433 # We'll hard-code it to 16M for now. |
434 ESP_BLOCKS=16384 | 434 ESP_BLOCKS=16384 |
435 /usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS} | 435 /usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS} |
436 ESP_LOOP_DEV=$(sudo losetup -f) | 436 ESP_LOOP_DEV=$(sudo losetup -f) |
437 if [ -z "${ESP_LOOP_DEV}" ] ; then | 437 if [ -z "${ESP_LOOP_DEV}" ] ; then |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 615 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
616 fi | 616 fi |
617 | 617 |
618 print_time_elapsed | 618 print_time_elapsed |
619 | 619 |
620 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 620 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
621 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 621 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
622 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 622 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
623 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 623 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
624 echo "from the scripts directory where you entered the chroot." | 624 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |