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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" | 335 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin" |
336 fi | 336 fi |
337 | 337 |
338 # Install packages required for testing. | 338 # Install packages required for testing. |
339 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then | 339 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then |
340 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | 340 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ |
341 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 341 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
342 --usepkgonly chromeos-test $EMERGE_JOBS | 342 --usepkgonly chromeos-test $EMERGE_JOBS |
343 fi | 343 fi |
344 | 344 |
345 # Perform any customizations on the root file system that are needed. | |
346 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="" | |
347 if [ $FLAGS_withdev -eq $FLAGS_TRUE ]; then | |
348 EXTRA_CUSTOMIZE_ROOTFS_FLAGS="--withdev" | |
349 fi | |
350 | |
351 # Extract the kernel from the root filesystem for use by the GPT image. Legacy | 345 # Extract the kernel from the root filesystem for use by the GPT image. Legacy |
352 # BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will | 346 # BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will |
353 # use the kernel partition. | 347 # use the kernel partition. |
354 sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | 348 sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" |
355 | 349 |
356 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI | 350 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI |
357 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk | 351 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk |
358 # images the same for both x86 and ARM. | 352 # images the same for both x86 and ARM. |
359 ESP_IMG=${OUTPUT_DIR}/esp.image | 353 ESP_IMG=${OUTPUT_DIR}/esp.image |
360 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code | 354 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 # By default, dev mode should be activated for either development builds or | 393 # By default, dev mode should be activated for either development builds or |
400 # test builds. | 394 # test builds. |
401 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\ | 395 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\ |
402 [[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then | 396 [[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then |
403 sudo touch "$ROOT_FS_DIR/root/.dev_mode" | 397 sudo touch "$ROOT_FS_DIR/root/.dev_mode" |
404 | 398 |
405 # Re-run ldconfig to fix /etc/ldconfig.so.cache. | 399 # Re-run ldconfig to fix /etc/ldconfig.so.cache. |
406 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" | 400 sudo /sbin/ldconfig -r "$ROOT_FS_DIR" |
407 fi | 401 fi |
408 | 402 |
| 403 # Perform any customizations on the root file system that are needed. |
409 "${SCRIPTS_DIR}/customize_rootfs" \ | 404 "${SCRIPTS_DIR}/customize_rootfs" \ |
410 --root="$ROOT_FS_DIR" \ | 405 --root="$ROOT_FS_DIR" \ |
411 --target="$ARCH" \ | 406 --target="$ARCH" \ |
412 --board="$BOARD" \ | 407 --board="$BOARD" |
413 $EXTRA_CUSTOMIZE_ROOTFS_FLAGS | |
414 | 408 |
415 # Check that the image has been correctly created. | 409 # Check that the image has been correctly created. |
416 "${SCRIPTS_DIR}/test_image" \ | 410 "${SCRIPTS_DIR}/test_image" \ |
417 --root="$ROOT_FS_DIR" \ | 411 --root="$ROOT_FS_DIR" \ |
418 --target="$ARCH" | 412 --target="$ARCH" |
419 | 413 |
420 # Clean up symlinks so they work on a running target rooted at "/". | 414 # Clean up symlinks so they work on a running target rooted at "/". |
421 # Here development packages are rooted at /usr/local. However, do not | 415 # Here development packages are rooted at /usr/local. However, do not |
422 # create /usr/local or /var on host (already exist on target). | 416 # create /usr/local or /var on host (already exist on target). |
423 setup_symlinks_on_root "/usr/local" "/var" | 417 setup_symlinks_on_root "/usr/local" "/var" |
(...skipping 18 matching lines...) Expand all Loading... |
442 | 436 |
443 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 437 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
444 echo "Done. Image created in ${OUTPUT_DIR}" | 438 echo "Done. Image created in ${OUTPUT_DIR}" |
445 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 439 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
446 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 440 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
447 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 441 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
448 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 442 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
449 echo "from the scripts directory where you entered the chroot." | 443 echo "from the scripts directory where you entered the chroot." |
450 | 444 |
451 trap - EXIT | 445 trap - EXIT |
OLD | NEW |