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 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if [[ -x "$MKIMAGE" ]]; then | 123 if [[ -x "$MKIMAGE" ]]; then |
124 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" | 124 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" |
125 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \ | 125 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \ |
126 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} | 126 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} |
127 MBR_IMG=${IMAGEDIR}/mbr.img | 127 MBR_IMG=${IMAGEDIR}/mbr.img |
128 dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ | 128 dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ |
129 if="$MBR_SCRIPT_UIMG" of="$MBR_IMG" conv=notrunc | 129 if="$MBR_SCRIPT_UIMG" of="$MBR_IMG" conv=notrunc |
130 hexdump -v -C "$MBR_IMG" | 130 hexdump -v -C "$MBR_IMG" |
131 else | 131 else |
132 echo "Error: u-boot mkimage not found or not executable." | 132 echo "Error: u-boot mkimage not found or not executable." |
| 133 exit 1 |
133 fi | 134 fi |
134 PMBRCODE=${MBR_IMG} | 135 PMBRCODE=${MBR_IMG} |
135 else | 136 else |
136 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) | 137 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) |
137 fi | 138 fi |
138 | 139 |
139 # Create the GPT. This has the side-effect of setting some global vars | 140 # Create the GPT. This has the side-effect of setting some global vars |
140 # describing the partition table entries (see the comments in the source). | 141 # describing the partition table entries (see the comments in the source). |
141 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE | 142 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE |
142 | 143 |
| 144 # Emit helpful scripts for testers, etc. |
| 145 ${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}" |
| 146 |
143 # Now populate the partitions. | 147 # Now populate the partitions. |
144 echo "Copying stateful partition..." | 148 echo "Copying stateful partition..." |
145 dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_STATEFUL} | 149 dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_STATEFUL} |
146 | 150 |
147 echo "Copying kernel..." | 151 echo "Copying kernel..." |
148 dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} | 152 dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} |
149 | 153 |
150 echo "Copying rootfs..." | 154 echo "Copying rootfs..." |
151 dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A} | 155 dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A} |
152 | 156 |
| 157 # Clean up temporary files. |
| 158 if [[ -n "${MBR_IMG:-}" ]]; then |
| 159 rm "${MBR_IMG}" |
| 160 fi |
OLD | NEW |