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

Side by Side Diff: bin/cros_make_image_bootable

Issue 3569015: Add defaults for cros_make_image_bootable. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: Ws Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 # Script which ensures that a given image has an up-to-date 7 # Script which ensures that a given image has an up-to-date
8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs. 8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs.
9 9
10 # Load common constants. This should be the first executable line. 10 # Load common constants. This should be the first executable line.
(...skipping 10 matching lines...) Expand all
21 assert_inside_chroot 21 assert_inside_chroot
22 22
23 set -e 23 set -e
24 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize 24 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize
25 25
26 if [ $# -lt 2 ]; then 26 if [ $# -lt 2 ]; then
27 echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]" 27 echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]"
28 exit 1 28 exit 1
29 fi 29 fi
30 30
31 BOOT_DESC_FILE="${1}/boot.desc" 31 IMAGE_DIR="$(readlink -f "${1}")"
32 IMAGE="${1}/${2}" 32 BOOT_DESC_FILE="${IMAGE_DIR}/boot.desc"
33 IMAGE="${IMAGE_DIR}/${2}"
33 shift 34 shift
34 shift 35 shift
35 FLAG_OVERRIDES="${@}" 36 FLAG_OVERRIDES="${@}"
36 37
37 if [ ! -r "${BOOT_DESC_FILE}" ]; then 38 if [ ! -r "${BOOT_DESC_FILE}" ]; then
38 warn "${BOOT_DESC_FILE} cannot be read!" 39 warn "${BOOT_DESC_FILE} cannot be read!"
39 warn "Falling back to command line parsing" 40 warn "Falling back to command line parsing"
40 BOOT_DESC="${@}" 41 BOOT_DESC="${@}"
41 else 42 else
42 BOOT_DESC="$(cat ${BOOT_DESC_FILE} | tr -s '\n' ' ')" 43 BOOT_DESC="$(cat ${BOOT_DESC_FILE} | tr -s '\n' ' ')"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 --vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \ 227 --vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \
227 --usb_disk="${usb_disk}" \ 228 --usb_disk="${usb_disk}" \
228 ${bootloader_to_flags} \ 229 ${bootloader_to_flags} \
229 $kernel_part 230 $kernel_part
230 231
231 trap - EXIT 232 trap - EXIT
232 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \ 233 ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \
233 -s "${FLAGS_statefulfs_mountpoint}" 234 -s "${FLAGS_statefulfs_mountpoint}"
234 } 235 }
235 236
237 # Use default of current image location if the output dir doesn't exist.
238 if [ ! -d ${FLAGS_output_dir} ]; then
239 warn "Output dir not found, using ${IMAGE_DIR}."
240 FLAGS_output_dir="${IMAGE_DIR}"
241 FLAGS_rootfs_hash="${IMAGE_DIR}/rootfs.hash"
242 FLAGS_rootfs_mountpoint="${IMAGE_DIR}/rootfs_dir"
243 FLAGS_statefulfs_mountpoint="${IMAGE_DIR}/stateful_dir"
244 FLAGS_espfs_mountpoint="${IMAGE_DIR}/esp"
245 fi
246
236 # Create the directories if they don't exist. 247 # Create the directories if they don't exist.
237 mkdir -p ${FLAGS_rootfs_mountpoint} 248 mkdir -p ${FLAGS_rootfs_mountpoint}
238 mkdir -p ${FLAGS_statefulfs_mountpoint} 249 mkdir -p ${FLAGS_statefulfs_mountpoint}
239 mkdir -p ${FLAGS_espfs_mountpoint} 250 mkdir -p ${FLAGS_espfs_mountpoint}
240 251
241 make_image_bootable ${IMAGE} 252 make_image_bootable ${IMAGE}
242 253
243 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then 254 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then
244 rmdir ${FLAGS_rootfs_mountpoint} 255 rmdir ${FLAGS_rootfs_mountpoint}
245 rmdir ${FLAGS_statefulfs_mountpoint} 256 rmdir ${FLAGS_statefulfs_mountpoint}
246 rmdir ${FLAGS_espfs_mountpoint} 257 rmdir ${FLAGS_espfs_mountpoint}
247 fi 258 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698