Add option to create a hybrid MBR

This allows booting on boards that require their bootloader be on
the first partition of a MBR formatted disk

BUG=chromium-os:32150
TEST=Build an image using the --hybrid_mbr_hack flag, verify that
the ESP is visible on a system with GPT support

Change-Id: I4b137ef672b9ed7327bd42ec0a260d82a8c9d470
Reviewed-on: https://gerrit.chromium.org/gerrit/26071
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
This commit is contained in:
Liam McLoughlin 2012-06-25 17:31:11 -07:00 committed by Gerrit
parent 41a20345b0
commit 07279034a9
2 changed files with 15 additions and 2 deletions

View File

@ -64,8 +64,8 @@ show_help_if_requested "$@"
# not needed for the typical developer workflow.
DEFINE_integer build_attempt 1 \
"The build attempt for this image build."
DEFINE_string version "" \
"Overrides version number in name to this version."
DEFINE_boolean hybrid_mbr ${FLAGS_FALSE} \
"Creates a hybrid MBR rather than a protective one"
DEFINE_integer jobs -1 \
"How many packages to build in parallel at maximum."
DEFINE_boolean replace ${FLAGS_FALSE} \
@ -81,6 +81,8 @@ DEFINE_string verity_algorithm "sha1" \
"Cryptographic hash algorithm used for kernel vboot. Default : sha1"
DEFINE_string verity_salt "" \
"Root filesystem salt. Default: randomly generated."
DEFINE_string version "" \
"Overrides version number in name to this version."
# Parse command line.
FLAGS "$@" || exit 1

View File

@ -245,4 +245,15 @@ create_base_image() {
${image_name} \
${USE_DEV_KEYS}
fi
# Setup hybrid MBR if it was enabled
if [[ ${FLAGS_hybrid_mbr_hack} -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
fi
}