summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-01-28 13:45:06 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 01:37:19 -0700
commitd11983cefdc26988b9c2f8f72b1f115a3af3aee3 (patch)
tree11ea010601aaa1d7f9bdadb3b71f19553f43b511 /block
parentd99a3d35eaee7dff97c95d9c9759744682453190 (diff)
fs: partitions: efi: Add force_gpt_sector parameter
force_gpt_sector=<sector> causes the GPT partition search to look at the specified sector for a valid GPT header if the GPT is not found at the beginning or the end of the block device. Change-Id: I9b5f85ce24719c0538d42ec5a94344c7f6556b2b Signed-off-by: Colin Cross <ccross@android.com> Rebase-Id: Rbcbb8f2f0882f3750e748b5cc83038ca0f5940db
Diffstat (limited to 'block')
-rw-r--r--block/partitions/efi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index c85fc895ecdb..f318732cef4b 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -105,6 +105,7 @@
* the partition tables happens after init too.
*/
static int force_gpt;
+static u64 force_gpt_sector;
static int __init
force_gpt_fn(char *str)
{
@@ -113,6 +114,13 @@ force_gpt_fn(char *str)
}
__setup("gpt", force_gpt_fn);
+static int __init force_gpt_sector_fn(char *str)
+{
+ force_gpt_sector = simple_strtoull(str, NULL, 0);
+ return 1;
+}
+__setup("gpt_sector=", force_gpt_sector_fn);
+
/**
* efi_crc32() - EFI version of crc32 function
@@ -564,6 +572,9 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
if (!good_agpt && force_gpt)
good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes);
+ if (!good_agpt && force_gpt && force_gpt_sector)
+ good_agpt = is_gpt_valid(state, force_gpt_sector, &agpt, &aptes);
+
/* The obviously unsuccessful case */
if (!good_pgpt && !good_agpt)
goto fail;