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

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

Issue 445002: Switch to GPT partition format.
Patch Set: Address adlr comment Created 11 years 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 | « src/platform/installer/debian/rules ('k') | src/scripts/common.sh » ('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) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 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 to build a bootable keyfob-based chromeos system image. 7 # Script to build a bootable keyfob-based chromeos system image.
8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to 8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to
9 # create a base file system. It then cusotmizes the file system and adds 9 # create a base file system. It then cusotmizes the file system and adds
10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB 10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 # Determine build version 57 # Determine build version
58 . "${SCRIPTS_DIR}/chromeos_version.sh" 58 . "${SCRIPTS_DIR}/chromeos_version.sh"
59 59
60 # Use canonical path since some tools (e.g. mount) do not like symlinks 60 # Use canonical path since some tools (e.g. mount) do not like symlinks
61 # Append build attempt to output directory 61 # Append build attempt to output directory
62 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}" 62 IMAGE_SUBDIR="${CHROMEOS_VERSION_STRING}-a${FLAGS_build_attempt}"
63 OUTPUT_DIR="${FLAGS_output_root}/${IMAGE_SUBDIR}" 63 OUTPUT_DIR="${FLAGS_output_root}/${IMAGE_SUBDIR}"
64 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs" 64 ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
65 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image" 65 ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
66 MBR_IMG="${OUTPUT_DIR}/mbr.image" 66 MBR_IMG="${OUTPUT_DIR}/mbr.image"
67 OUTPUT_IMG="${OUTPUT_DIR}/usb.img"
68 67
69 # These paths are relative to SCRIPTS_DIR. 68 # These paths are relative to SCRIPTS_DIR.
70 ROOTFS_PACKAGE_INSTALL_SCRIPT="install_packages.sh" 69 ROOTFS_PACKAGE_INSTALL_SCRIPT="install_packages.sh"
71 ROOTFS_CUSTOMIZE_SCRIPT="customize_rootfs.sh" 70 ROOTFS_CUSTOMIZE_SCRIPT="customize_rootfs.sh"
72 71
73 ROOTFS_STATIC_DATA="${SRC_ROOT}/rootfs_static_data" 72 ROOTFS_STATIC_DATA="${SRC_ROOT}/rootfs_static_data"
74 ROOTFS_SETUP_DIR="/tmp/chromeos_setup" 73 ROOTFS_SETUP_DIR="/tmp/chromeos_setup"
75 SETUP_DIR="${ROOT_FS_DIR}/${ROOTFS_SETUP_DIR}" 74 SETUP_DIR="${ROOT_FS_DIR}/${ROOTFS_SETUP_DIR}"
76 75
77 LOOP_DEV= 76 LOOP_DEV=
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 menu label chromeos-hd 252 menu label chromeos-hd
254 kernel vmlinuz 253 kernel vmlinuz
255 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n oresume noswap i915.modeset=1 loglevel=1 254 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n oresume noswap i915.modeset=1 loglevel=1
256 EOF 255 EOF
257 256
258 # Make partition bootable and label it. 257 # Make partition bootable and label it.
259 sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot" 258 sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot"
260 259
261 cleanup_rootfs_loop 260 cleanup_rootfs_loop
262 261
263 # Create a master boot record. 262 # Create a GPT-booting master boot record for use by extlinux boot. In order to
264 # Start with the syslinux master boot record. We need to zero-pad to 263 # make a nicer mbr we zero-pad to fill out a 512-byte sector size.
265 # fill out a 512-byte sector size. 264 SYSLINUX_BUILD_ROOT="${FLAGS_build_root}/x86/obj/src/third_party/syslinux/"
266 SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin" 265 cat "$SYSLINUX_BUILD_ROOT"/syslinux-*/mbr/gptmbr.bin | \
267 dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync 266 dd of="$MBR_IMG" bs=512 count=1 conv=sync
268 # Create a partition table in the MBR. 267
269 NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512)) 268 # Copy utilities needed to create a bootable image to the output directory.
adlr 2009/12/17 08:17:52 would it be easier (or more future proof?) to just
270 sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF 269 cp "${SCRIPTS_DIR}/common.sh" "${OUTPUT_DIR}"
271 ,$NUM_SECTORS,L,-, 270 cp "${SCRIPTS_DIR}/image_to_usb.sh" "${OUTPUT_DIR}/make_bootable_image.sh"
272 ,$NUM_SECTORS,S,-, 271 cp "${SRC_ROOT}/platform/installer/chromeos_install_functions.sh" \
273 ,$NUM_SECTORS,L,*, 272 "${OUTPUT_DIR}"
274 ; 273 cp "${SRC_ROOT}/third_party/shflags/files/src/shflags" "${OUTPUT_DIR}"
275 EOF 274 if [ ! -x "${SRC_ROOT}/third_party/gpt/gpt-host" ]; then
275 # We'll have to build the host version of the gpt utility.
276 cd "${SRC_ROOT}/third_party/gpt"
277 make gpt-host
278 cd -
279 fi
280 cp "${SRC_ROOT}/third_party/gpt/gpt-host" "${OUTPUT_DIR}/gpt"
276 281
277 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" 282 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}"
278 echo "Done. Image created in ${OUTPUT_DIR}" 283 echo "Done. Image created in ${OUTPUT_DIR}"
279 echo "To copy to USB keyfob, outside the chroot, do something like:" 284 echo "To copy to USB keyfob, outside the chroot, do something like:"
280 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" 285 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb"
281 echo "To convert to VMWare image, outside the chroot, do something like:" 286 echo "To convert to VMWare image, outside the chroot, do something like:"
282 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 287 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
283 288
284 trap - EXIT 289 trap - EXIT
OLDNEW
« no previous file with comments | « src/platform/installer/debian/rules ('k') | src/scripts/common.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698