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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/installer/debian/rules ('k') | src/scripts/common.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/build_image.sh
diff --git a/src/scripts/build_image.sh b/src/scripts/build_image.sh
index 0e4ada5cdd330b776f0bd8eaabb11cf867df5add..e042457da79c40e68d258fbbd4f573ff85949004 100755
--- a/src/scripts/build_image.sh
+++ b/src/scripts/build_image.sh
@@ -64,7 +64,6 @@ OUTPUT_DIR="${FLAGS_output_root}/${IMAGE_SUBDIR}"
ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
MBR_IMG="${OUTPUT_DIR}/mbr.image"
-OUTPUT_IMG="${OUTPUT_DIR}/usb.img"
# These paths are relative to SCRIPTS_DIR.
ROOTFS_PACKAGE_INSTALL_SCRIPT="install_packages.sh"
@@ -260,19 +259,25 @@ sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot"
cleanup_rootfs_loop
-# Create a master boot record.
-# Start with the syslinux master boot record. We need to zero-pad to
-# fill out a 512-byte sector size.
-SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin"
-dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync
-# Create a partition table in the MBR.
-NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512))
-sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF
-,$NUM_SECTORS,L,-,
-,$NUM_SECTORS,S,-,
-,$NUM_SECTORS,L,*,
-;
-EOF
+# Create a GPT-booting master boot record for use by extlinux boot. In order to
+# make a nicer mbr we zero-pad to fill out a 512-byte sector size.
+SYSLINUX_BUILD_ROOT="${FLAGS_build_root}/x86/obj/src/third_party/syslinux/"
+cat "$SYSLINUX_BUILD_ROOT"/syslinux-*/mbr/gptmbr.bin | \
+ dd of="$MBR_IMG" bs=512 count=1 conv=sync
+
+# 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
+cp "${SCRIPTS_DIR}/common.sh" "${OUTPUT_DIR}"
+cp "${SCRIPTS_DIR}/image_to_usb.sh" "${OUTPUT_DIR}/make_bootable_image.sh"
+cp "${SRC_ROOT}/platform/installer/chromeos_install_functions.sh" \
+ "${OUTPUT_DIR}"
+cp "${SRC_ROOT}/third_party/shflags/files/src/shflags" "${OUTPUT_DIR}"
+if [ ! -x "${SRC_ROOT}/third_party/gpt/gpt-host" ]; then
+ # We'll have to build the host version of the gpt utility.
+ cd "${SRC_ROOT}/third_party/gpt"
+ make gpt-host
+ cd -
+fi
+cp "${SRC_ROOT}/third_party/gpt/gpt-host" "${OUTPUT_DIR}/gpt"
OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}"
echo "Done. Image created in ${OUTPUT_DIR}"
« 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