| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Load common constants. This should be the first executable line. | 7 # Load common constants. This should be the first executable line. |
| 8 # The path to common.sh should be relative to your script's location. | 8 # The path to common.sh should be relative to your script's location. |
| 9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
| 10 | 10 |
| 11 # Load functions and constants for chromeos-install | 11 # Load functions and constants for chromeos-install |
| 12 . "$(dirname "$0")/chromeos-common.sh" | 12 . "$(dirname "$0")/chromeos-common.sh" |
| 13 | 13 |
| 14 # Script must be run inside the chroot. | 14 # Script must be run inside the chroot. |
| 15 restart_in_chroot_if_needed $* | 15 restart_in_chroot_if_needed $* |
| 16 | 16 |
| 17 get_default_board | 17 get_default_board |
| 18 | 18 |
| 19 # Flags. | 19 # Flags. |
| 20 DEFINE_string arch "" \ | 20 DEFINE_string arch "" \ |
| 21 "The target architecture (\"arm\" or \"x86\")." | 21 "The target architecture (\"arm\" or \"x86\")." |
| 22 DEFINE_string board "$DEFAULT_BOARD" \ | 22 DEFINE_string board "$DEFAULT_BOARD" \ |
| 23 "The board to build an image for." | 23 "The board to build an image for." |
| 24 DEFINE_string arm_extra_bootargs "" \ | 24 DEFINE_string arm_extra_bootargs "" \ |
| 25 "Additional command line options to pass to the ARM kernel." | 25 "Additional command line options to pass to the ARM kernel." |
| 26 DEFINE_boolean recovery $FLAGS_FALSE \ | 26 DEFINE_boolean recovery $FLAGS_FALSE \ |
| 27 "Build GPT for a recovery image. Default: False." | 27 "Build GPT for a recovery image. Default: False." |
| 28 DEFINE_integer rootfs_partition_size 1024 \ |
| 29 "rootfs parition size in MBs." |
| 28 | 30 |
| 29 # Usage. | 31 # Usage. |
| 30 FLAGS_HELP=$(cat <<EOF | 32 FLAGS_HELP=$(cat <<EOF |
| 31 | 33 |
| 32 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV | 34 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV |
| 33 | 35 |
| 34 This takes the image components in IMAGEDIR and creates a bootable, | 36 This takes the image components in IMAGEDIR and creates a bootable, |
| 35 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device. | 37 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device. |
| 36 | 38 |
| 37 EOF | 39 EOF |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 # systems will use a U-Boot script temporarily, but it goes in the same place. | 110 # systems will use a U-Boot script temporarily, but it goes in the same place. |
| 109 if [[ "$ARCH" = "arm" ]]; then | 111 if [[ "$ARCH" = "arm" ]]; then |
| 110 PMBRCODE=/dev/zero | 112 PMBRCODE=/dev/zero |
| 111 else | 113 else |
| 112 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) | 114 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) |
| 113 fi | 115 fi |
| 114 | 116 |
| 115 # Create the GPT. This has the side-effect of setting some global vars | 117 # Create the GPT. This has the side-effect of setting some global vars |
| 116 # describing the partition table entries (see the comments in the source). | 118 # describing the partition table entries (see the comments in the source). |
| 117 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG \ | 119 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG \ |
| 118 false $FLAGS_recovery | 120 false $FLAGS_recovery $FLAGS_rootfs_partition_size |
| 119 | 121 |
| 120 if [[ "$ARCH" = "arm" ]]; then | 122 if [[ "$ARCH" = "arm" ]]; then |
| 121 # assume /dev/mmcblk1. we could not get this from ${OUTDEV} | 123 # assume /dev/mmcblk1. we could not get this from ${OUTDEV} |
| 122 DEVICE=1 | 124 DEVICE=1 |
| 123 MBR_SCRIPT_UIMG=$(make_arm_mbr \ | 125 MBR_SCRIPT_UIMG=$(make_arm_mbr \ |
| 124 ${START_KERN_A} \ | 126 ${START_KERN_A} \ |
| 125 ${NUM_KERN_SECTORS} \ | 127 ${NUM_KERN_SECTORS} \ |
| 126 ${DEVICE} \ | 128 ${DEVICE} \ |
| 127 "${FLAGS_arm_extra_bootargs}") | 129 "${FLAGS_arm_extra_bootargs}") |
| 128 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ | 130 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 seek=${START_ROOTFS_B} | 165 seek=${START_ROOTFS_B} |
| 164 fi | 166 fi |
| 165 | 167 |
| 166 echo "Copying EFI system partition..." | 168 echo "Copying EFI system partition..." |
| 167 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} | 169 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} |
| 168 | 170 |
| 169 # Clean up temporary files. | 171 # Clean up temporary files. |
| 170 if [[ -n "${MBR_IMG:-}" ]]; then | 172 if [[ -n "${MBR_IMG:-}" ]]; then |
| 171 rm "${MBR_IMG}" | 173 rm "${MBR_IMG}" |
| 172 fi | 174 fi |
| OLD | NEW |