Added hybrid MBR support in image_to_usb.sh

BUG=chromium-os:32150
TEST=Run image_to_usb.sh with --hybrid_mbr flag

Change-Id: I91c5072bd3f5f5f431f0778a66adf162f2dbd75d
CQ-DEPEND=I8cdf6694782357162188020217bc2350116c3a6d
Reviewed-on: https://gerrit.chromium.org/gerrit/26992
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
This commit is contained in:
Liam McLoughlin 2012-07-09 17:51:20 -07:00 committed by Gerrit
parent d6f3d0771a
commit 0f21504982
2 changed files with 8 additions and 7 deletions

View File

@ -248,12 +248,6 @@ create_base_image() {
# Setup hybrid MBR if it was enabled
if [[ ${FLAGS_hybrid_mbr} -eq ${FLAGS_TRUE} ]]; then
info "Creating hybrid MBR"
sudo sfdisk "${BUILD_DIR}/${image_name}" <<EOF
unit: sectors
disk1 : start= $START_ESP, size= $NUM_ESP_SECTORS, Id= c, bootable
disk2 : start= 1, size= 1, Id= ee
EOF
install_hybrid_mbr "${BUILD_DIR}/${image_name}"
fi
}

View File

@ -41,6 +41,8 @@ DEFINE_boolean factory_install ${FLAGS_FALSE} \
"generate a factory install shim"
DEFINE_boolean factory ${FLAGS_FALSE} \
"generate a factory runing image, implies autotest and test"
DEFINE_boolean hybrid_mbr ${FLAGS_FALSE} \
"Creates a hybrid MBR rather than a protective one"
DEFINE_boolean copy_kernel ${FLAGS_FALSE} \
"copy the kernel to the fourth partition"
DEFINE_boolean test_image "${FLAGS_FALSE}" \
@ -367,6 +369,11 @@ if [ -b "${FLAGS_to}" ]; then
--arch="${FLAGS_arch}" \
--payload_image="${SRC_IMAGE}" \
--dst="${FLAGS_to}"
# Setup hybrid MBR if it was enabled
if [[ ${FLAGS_hybrid_mbr} -eq ${FLAGS_TRUE} ]]; then
install_hybrid_mbr "${FLAGS_to}"
fi
fi
elif [[ "${FLAGS_to}" == /dev/* ]]; then
# Did the user attempt to write to a non-existent block device?