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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 sudo tune2fs -L "${DISK_LABEL}" \ | 562 sudo tune2fs -L "${DISK_LABEL}" \ |
563 -U clear \ | 563 -U clear \ |
564 -T 20091119110000 \ | 564 -T 20091119110000 \ |
565 -c 0 \ | 565 -c 0 \ |
566 -i 0 \ | 566 -i 0 \ |
567 -m 0 \ | 567 -m 0 \ |
568 -r 0 \ | 568 -r 0 \ |
569 -e remount-ro \ | 569 -e remount-ro \ |
570 "${LOOP_DEV}" | 570 "${LOOP_DEV}" |
571 # TODO(wad) call tune2fs prior to finalization to set the mount count to 0. | 571 # TODO(wad) call tune2fs prior to finalization to set the mount count to 0. |
572 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}" | 572 sudo mount -t ext2 "${LOOP_DEV}" "${ROOT_FS_DIR}" |
573 | 573 |
574 # Create stateful partition of the same size as the rootfs. | 574 # Create stateful partition of the same size as the rootfs. |
575 STATEFUL_LOOP_DEV=$(sudo losetup -f) | 575 STATEFUL_LOOP_DEV=$(sudo losetup -f) |
576 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then | 576 if [ -z "${STATEFUL_LOOP_DEV}" ] ; then |
577 echo "No free loop device. Free up a loop device or reboot. exiting. " | 577 echo "No free loop device. Free up a loop device or reboot. exiting. " |
578 exit 1 | 578 exit 1 |
579 fi | 579 fi |
580 STATEFUL_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_statefulfs_size})) | 580 STATEFUL_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_statefulfs_size})) |
581 dd if=/dev/zero of="${STATEFUL_FS_IMG}" bs=1 count=1 \ | 581 dd if=/dev/zero of="${STATEFUL_FS_IMG}" bs=1 count=1 \ |
582 seek=$((STATEFUL_SIZE_BYTES - 1)) | 582 seek=$((STATEFUL_SIZE_BYTES - 1)) |
583 | 583 |
584 # Tune and mount the stateful partition. | 584 # Tune and mount the stateful partition. |
585 UUID=$(uuidgen) | 585 UUID=$(uuidgen) |
586 DISK_LABEL="C-STATE" | 586 DISK_LABEL="C-STATE" |
587 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" | 587 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" |
588 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}" | 588 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}" |
589 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}" | 589 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}" |
590 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" | 590 sudo mount -t ext3 "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" |
591 | 591 |
592 # -- Install packages into the root file system -- | 592 # -- Install packages into the root file system -- |
593 | 593 |
594 # We need to install libc manually from the cross toolchain. | 594 # We need to install libc manually from the cross toolchain. |
595 # TODO: Improve this? We only want libc and not the whole toolchain. | 595 # TODO: Improve this? We only want libc and not the whole toolchain. |
596 # TODO(raymes): Remove this check after some time which ensures | 596 # TODO(raymes): Remove this check after some time which ensures |
597 # backward compatibility with the crossdev location change. | 597 # backward compatibility with the crossdev location change. |
598 PKGDIR="/var/lib/portage/pkgs" | 598 PKGDIR="/var/lib/portage/pkgs" |
599 LIBC_TAR="glibc-${LIBC_VERSION}.tbz2" | 599 LIBC_TAR="glibc-${LIBC_VERSION}.tbz2" |
600 NEW_LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}" | 600 NEW_LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 808 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
809 fi | 809 fi |
810 | 810 |
811 print_time_elapsed | 811 print_time_elapsed |
812 | 812 |
813 echo "To copy to USB keyfob, do something like:" | 813 echo "To copy to USB keyfob, do something like:" |
814 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 814 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
815 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 815 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
816 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 816 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
817 echo "from the scripts directory where you entered the chroot." | 817 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |