summaryrefslogtreecommitdiffstats
path: root/master/debian/grub_legacy_0_based_partitions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'master/debian/grub_legacy_0_based_partitions.patch')
-rw-r--r--master/debian/grub_legacy_0_based_partitions.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/master/debian/grub_legacy_0_based_partitions.patch b/master/debian/grub_legacy_0_based_partitions.patch
new file mode 100644
index 0000000..f245434
--- /dev/null
+++ b/master/debian/grub_legacy_0_based_partitions.patch
@@ -0,0 +1,43 @@
+Index: b/grub-core/kern/emu/hostdisk.c
+===================================================================
+--- a/grub-core/kern/emu/hostdisk.c
++++ b/grub-core/kern/emu/hostdisk.c
+@@ -1131,7 +1131,7 @@
+ char *bsd_part_str = NULL;
+
+ if (dos_part >= 0)
+- dos_part_str = xasprintf (",%d", dos_part + 1);
++ dos_part_str = xasprintf (",%d", dos_part + (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS") ? 0 : 1));
+
+ if (bsd_part >= 0)
+ bsd_part_str = xasprintf (",%d", bsd_part + 1);
+@@ -1619,6 +1619,29 @@
+
+ if (start == part_start)
+ {
++ if (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS"))
++ {
++ int dos_part, bsd_part;
++ char *fullname, *comma;
++
++ if (partition->parent)
++ {
++ dos_part = partition->parent->number;
++ bsd_part = partition->number;
++ }
++ else
++ {
++ dos_part = partition->number;
++ bsd_part = -1;
++ }
++
++ fullname = make_device_name (drive, dos_part, bsd_part);
++ comma = strchr (fullname, ',');
++ partname = comma ? xstrdup (comma + 1) : NULL;
++ free (fullname);
++ return 1;
++ }
++
+ partname = grub_partition_get_name (partition);
+ return 1;
+ }