Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/scripts/build_gpt.sh

Issue 1613008: move mkimage (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/scripts/build_image » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 board_root "" \
25 "The build directory, needed to find tools for ARM."
26 24
27 # Usage. 25 # Usage.
28 FLAGS_HELP=$(cat <<EOF 26 FLAGS_HELP=$(cat <<EOF
29 27
30 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV 28 Usage: $(basename $0) [flags] IMAGEDIR OUTDEV
31 29
32 This takes the image components in IMAGEDIR and creates a bootable, 30 This takes the image components in IMAGEDIR and creates a bootable,
33 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device. 31 GPT-formatted image in OUTDEV. OUTDEV can be a file or block device.
34 32
35 EOF 33 EOF
(...skipping 27 matching lines...) Expand all
63 ;; 61 ;;
64 *86) 62 *86)
65 ARCH="x86" 63 ARCH="x86"
66 ;; 64 ;;
67 *) 65 *)
68 error "Unable to determine ARCH from toolchain: $CHOST" 66 error "Unable to determine ARCH from toolchain: $CHOST"
69 exit 1 67 exit 1
70 esac 68 esac
71 fi 69 fi
72 70
73 if [[ -z "$FLAGS_board_root" ]]; then
74 FLAGS_board_root="/build/${FLAGS_board}"
75 fi
76
77 # Only now can we die on error. shflags functions leak non-zero error codes, 71 # Only now can we die on error. shflags functions leak non-zero error codes,
78 # so will die prematurely if 'set -e' is specified before now. 72 # so will die prematurely if 'set -e' is specified before now.
79 set -e 73 set -e
80 # Die on uninitialized variables. 74 # Die on uninitialized variables.
81 set -u 75 set -u
82 76
83 # Check for missing parts. 77 # Check for missing parts.
84 ROOTFS_IMG="${IMAGEDIR}/rootfs.image" 78 ROOTFS_IMG="${IMAGEDIR}/rootfs.image"
85 if [[ ! -s ${ROOTFS_IMG} ]]; then 79 if [[ ! -s ${ROOTFS_IMG} ]]; then
86 error "Can't find ${ROOTFS_IMG}" 80 error "Can't find ${ROOTFS_IMG}"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 BOOTARGS="${BOOTARGS} init=/sbin/init" 117 BOOTARGS="${BOOTARGS} init=/sbin/init"
124 BOOTARGS="${BOOTARGS} console=ttySAC2,115200" 118 BOOTARGS="${BOOTARGS} console=ttySAC2,115200"
125 BOOTARGS="${BOOTARGS} mem=1024M" 119 BOOTARGS="${BOOTARGS} mem=1024M"
126 BOOTARGS="${BOOTARGS} rootwait" 120 BOOTARGS="${BOOTARGS} rootwait"
127 121
128 MBR_SCRIPT="${IMAGEDIR}/mbr_script" 122 MBR_SCRIPT="${IMAGEDIR}/mbr_script"
129 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \ 123 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \
130 "setenv bootargs ${BOOTARGS}\n" \ 124 "setenv bootargs ${BOOTARGS}\n" \
131 "mmc read 1 C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \ 125 "mmc read 1 C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \
132 "bootm C0008000" > ${MBR_SCRIPT} 126 "bootm C0008000" > ${MBR_SCRIPT}
133 MKIMAGE="${FLAGS_board_root}/u-boot/mkimage" 127 MKIMAGE="/usr/bin/mkimage"
134 if [[ -f "$MKIMAGE".gz ]]; then 128 if [[ -f "$MKIMAGE".gz ]]; then
135 sudo gunzip "$MKIMAGE".gz 129 sudo gunzip "$MKIMAGE".gz
136 fi 130 fi
137 if [[ -x "$MKIMAGE" ]]; then 131 if [[ -x "$MKIMAGE" ]]; then
138 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" 132 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg"
139 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \ 133 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \
140 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} 134 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG}
141 MBR_IMG=${IMAGEDIR}/mbr.img 135 MBR_IMG=${IMAGEDIR}/mbr.img
142 dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ 136 dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \
143 if="$MBR_SCRIPT_UIMG" of="$MBR_IMG" conv=notrunc 137 if="$MBR_SCRIPT_UIMG" of="$MBR_IMG" conv=notrunc
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 echo "Copying rootfs..." 169 echo "Copying rootfs..."
176 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A } 170 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A }
177 171
178 echo "Copying EFI system partition..." 172 echo "Copying EFI system partition..."
179 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} 173 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP}
180 174
181 # Clean up temporary files. 175 # Clean up temporary files.
182 if [[ -n "${MBR_IMG:-}" ]]; then 176 if [[ -n "${MBR_IMG:-}" ]]; then
183 rm "${MBR_IMG}" 177 rm "${MBR_IMG}"
184 fi 178 fi
OLDNEW
« no previous file with comments | « no previous file | src/scripts/build_image » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698