| 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 23 matching lines...) Expand all Loading... |
| 34 DEFINE_boolean installmask $FLAGS_TRUE \ | 34 DEFINE_boolean installmask $FLAGS_TRUE \ |
| 35 "Use INSTALL_MASK to shrink the resulting image." | 35 "Use INSTALL_MASK to shrink the resulting image." |
| 36 DEFINE_integer jobs -1 \ | 36 DEFINE_integer jobs -1 \ |
| 37 "How many packages to build in parallel at maximum." | 37 "How many packages to build in parallel at maximum." |
| 38 DEFINE_boolean statefuldev $FLAGS_TRUE \ | 38 DEFINE_boolean statefuldev $FLAGS_TRUE \ |
| 39 "Install development packages on stateful partition rather than the rootfs" | 39 "Install development packages on stateful partition rather than the rootfs" |
| 40 DEFINE_string to "" \ | 40 DEFINE_string to "" \ |
| 41 "The target image file or device" | 41 "The target image file or device" |
| 42 DEFINE_boolean withtest $FLAGS_FALSE \ | 42 DEFINE_boolean withtest $FLAGS_FALSE \ |
| 43 "Include packages required for testing and prepare image for testing" | 43 "Include packages required for testing and prepare image for testing" |
| 44 DEFINE_string factory_server "" \ | |
| 45 "Build a factory install image pointing to given server." | |
| 46 DEFINE_string arm_extra_bootargs "" \ | 44 DEFINE_string arm_extra_bootargs "" \ |
| 47 "Additional command line options to pass to the ARM kernel." | 45 "Additional command line options to pass to the ARM kernel." |
| 48 | 46 |
| 49 # Parse command line. | 47 # Parse command line. |
| 50 FLAGS "$@" || exit 1 | 48 FLAGS "$@" || exit 1 |
| 51 eval set -- "${FLAGS_ARGV}" | 49 eval set -- "${FLAGS_ARGV}" |
| 52 | 50 |
| 53 # Only now can we die on error. shflags functions leak non-zero error codes, | 51 # Only now can we die on error. shflags functions leak non-zero error codes, |
| 54 # so will die prematurely if 'set -e' is specified before now. | 52 # so will die prematurely if 'set -e' is specified before now. |
| 55 set -e | 53 set -e |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 --usepkgonly chromeos-dev $EMERGE_JOBS | 328 --usepkgonly chromeos-dev $EMERGE_JOBS |
| 331 | 329 |
| 332 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch | 330 # TODO(sosa@chromium.org) - Re-hide under statefuldev after switch |
| 333 # Flag will mount /usr/local on target device | 331 # Flag will mount /usr/local on target device |
| 334 sudo mkdir -p "$ROOT_FS_DIR/root" | 332 sudo mkdir -p "$ROOT_FS_DIR/root" |
| 335 | 333 |
| 336 # The ldd tool is a useful shell script but lives in glibc; just copy it. | 334 # The ldd tool is a useful shell script but lives in glibc; just copy it. |
| 337 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" | 335 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" |
| 338 fi | 336 fi |
| 339 | 337 |
| 340 if [ -n "$FLAGS_factory_server" ]; then | |
| 341 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | |
| 342 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | |
| 343 --usepkgonly chromeos-factoryinstall $EMERGE_JOBS | |
| 344 fi | |
| 345 | |
| 346 # Install packages required for testing. | 338 # Install packages required for testing. |
| 347 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then | 339 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then |
| 348 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | 340 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ |
| 349 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 341 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
| 350 --usepkgonly chromeos-test $EMERGE_JOBS | 342 --usepkgonly chromeos-test $EMERGE_JOBS |
| 351 fi | 343 fi |
| 352 | 344 |
| 353 # Perform any customizations on the root file system that are needed. | 345 # Perform any customizations on the root file system that are needed. |
| 354 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="" | 346 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="" |
| 355 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then | 347 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then |
| 356 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev" | 348 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev" |
| 357 fi | 349 fi |
| 358 if [ -n "$FLAGS_factory_server" ]; then | |
| 359 # Indentation off b/c of long line | |
| 360 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="$EXTRA_CUSTOMIZE_ROOTFS_FLAGS"\ | |
| 361 " --factory_server=$FLAGS_factory_server" | |
| 362 fi | |
| 363 | 350 |
| 364 # Extract the kernel from the root filesystem for use by the GPT image. Legacy | 351 # Extract the kernel from the root filesystem for use by the GPT image. Legacy |
| 365 # BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will | 352 # BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will |
| 366 # use the kernel partition. | 353 # use the kernel partition. |
| 367 sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | 354 sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" |
| 368 | 355 |
| 369 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI | 356 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI |
| 370 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk | 357 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk |
| 371 # images the same for both x86 and ARM. | 358 # images the same for both x86 and ARM. |
| 372 ESP_IMG=${OUTPUT_DIR}/esp.image | 359 ESP_IMG=${OUTPUT_DIR}/esp.image |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 442 |
| 456 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 443 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
| 457 echo "Done. Image created in ${OUTPUT_DIR}" | 444 echo "Done. Image created in ${OUTPUT_DIR}" |
| 458 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 445 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 459 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 446 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
| 460 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 447 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
| 461 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 448 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 462 echo "from the scripts directory where you entered the chroot." | 449 echo "from the scripts directory where you entered the chroot." |
| 463 | 450 |
| 464 trap - EXIT | 451 trap - EXIT |
| OLD | NEW |