| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 # Check for loop device before creating image. | 159 # Check for loop device before creating image. |
| 160 LOOP_DEV=$(sudo losetup -f) | 160 LOOP_DEV=$(sudo losetup -f) |
| 161 if [ -z "$LOOP_DEV" ] ; then | 161 if [ -z "$LOOP_DEV" ] ; then |
| 162 echo "No free loop device. Free up a loop device or reboot. exiting. " | 162 echo "No free loop device. Free up a loop device or reboot. exiting. " |
| 163 exit 1 | 163 exit 1 |
| 164 fi | 164 fi |
| 165 | 165 |
| 166 # Create root file system disk image to fit on a 1GB memory stick. | 166 # Create root file system disk image to fit on a 1GB memory stick. |
| 167 # 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes. | 167 # 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes. |
| 168 ROOT_SIZE_BYTES=$((1024 * 1024 * 640)) | 168 ROOT_SIZE_BYTES=$((1024 * 1024 * 720)) |
| 169 dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1)) | 169 dd if=/dev/zero of="$ROOT_FS_IMG" bs=1 count=1 seek=$((ROOT_SIZE_BYTES - 1)) |
| 170 sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG" | 170 sudo losetup "$LOOP_DEV" "$ROOT_FS_IMG" |
| 171 sudo mkfs.ext3 "$LOOP_DEV" | 171 sudo mkfs.ext3 "$LOOP_DEV" |
| 172 | 172 |
| 173 # Tune and mount rootfs. | 173 # Tune and mount rootfs. |
| 174 UUID=$(uuidgen) | 174 UUID=$(uuidgen) |
| 175 DISK_LABEL="C-KEYFOB" | 175 DISK_LABEL="C-KEYFOB" |
| 176 sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV" | 176 sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV" |
| 177 sudo mount "$LOOP_DEV" "$ROOT_FS_DIR" | 177 sudo mount "$LOOP_DEV" "$ROOT_FS_DIR" |
| 178 | 178 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 365 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
| 366 echo "Done. Image created in ${OUTPUT_DIR}" | 366 echo "Done. Image created in ${OUTPUT_DIR}" |
| 367 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 367 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
| 368 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 368 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
| 369 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 369 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
| 370 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 370 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
| 371 echo "from the scripts directory where you entered the chroot." | 371 echo "from the scripts directory where you entered the chroot." |
| 372 | 372 |
| 373 trap - EXIT | 373 trap - EXIT |
| OLD | NEW |