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 assert_inside_chroot | 15 assert_inside_chroot |
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 "" \ |
| 25 "Additional command line options to pass to the ARM kernel." |
24 | 26 |
25 # Usage. | 27 # Usage. |
26 FLAGS_HELP=$(cat <<EOF | 28 FLAGS_HELP=$(cat <<EOF |
27 | 29 |
28 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV | 30 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV |
29 | 31 |
30 This takes the image components in IMAGEDIR and creates a bootable, | 32 This takes the image components in IMAGEDIR and creates a bootable, |
31 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device. | 33 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device. |
32 | 34 |
33 EOF | 35 EOF |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) | 109 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) |
108 fi | 110 fi |
109 | 111 |
110 # Create the GPT. This has the side-effect of setting some global vars | 112 # Create the GPT. This has the side-effect of setting some global vars |
111 # describing the partition table entries (see the comments in the source). | 113 # describing the partition table entries (see the comments in the source). |
112 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG | 114 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG |
113 | 115 |
114 if [[ "$ARCH" = "arm" ]]; then | 116 if [[ "$ARCH" = "arm" ]]; then |
115 # assume /dev/mmcblk1. we could not get this from ${OUTDEV} | 117 # assume /dev/mmcblk1. we could not get this from ${OUTDEV} |
116 DEVICE=1 | 118 DEVICE=1 |
117 MBR_SCRIPT_UIMG=$(make_arm_mbr ${START_KERN_A} ${NUM_KERN_SECTORS} ${DEVICE}) | 119 MBR_SCRIPT_UIMG=$(make_arm_mbr \ |
| 120 ${START_KERN_A} \ |
| 121 ${NUM_KERN_SECTORS} \ |
| 122 ${DEVICE} \ |
| 123 "${FLAGS_arm_extra_bootargs}") |
118 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ | 124 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ |
119 if="$MBR_SCRIPT_UIMG" of=${OUTDEV} conv=notrunc | 125 if="$MBR_SCRIPT_UIMG" of=${OUTDEV} conv=notrunc |
120 fi | 126 fi |
121 | 127 |
122 # Emit helpful scripts for testers, etc. | 128 # Emit helpful scripts for testers, etc. |
123 ${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}" | 129 ${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}" |
124 | 130 |
125 sudo= | 131 sudo= |
126 if [ ! -w "$OUTDEV" ] ; then | 132 if [ ! -w "$OUTDEV" ] ; then |
127 # use sudo when writing to a block device. | 133 # use sudo when writing to a block device. |
(...skipping 11 matching lines...) Expand all Loading... |
139 echo "Copying rootfs..." | 145 echo "Copying rootfs..." |
140 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A
} | 146 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A
} |
141 | 147 |
142 echo "Copying EFI system partition..." | 148 echo "Copying EFI system partition..." |
143 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} | 149 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} |
144 | 150 |
145 # Clean up temporary files. | 151 # Clean up temporary files. |
146 if [[ -n "${MBR_IMG:-}" ]]; then | 152 if [[ -n "${MBR_IMG:-}" ]]; then |
147 rm "${MBR_IMG}" | 153 rm "${MBR_IMG}" |
148 fi | 154 fi |
OLD | NEW |