Package: grub2 / 2.02~beta3-5+deb9u2

grub_legacy_0_based_partitions.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From ae6b104218c594b928fe5f938547b8388756e92e Mon Sep 17 00:00:00 2001
From: Robert Millan <rmh@aybabtu.com>
Date: Mon, 13 Jan 2014 12:12:53 +0000
Subject: Support running grub-probe in grub-legacy's update-grub

Author: Colin Watson <cjwatson@debian.org>
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: grub_legacy_0_based_partitions.patch
---
 util/getroot.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/util/getroot.c b/util/getroot.c
index 92c0d709b..f874be8a9 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -245,6 +245,20 @@ find_partition (grub_disk_t dsk __attribute__ ((unused)),
 
   if (ctx->start == part_start)
     {
+      /* This is dreadfully hardcoded, but there's a limit to what GRUB
+         Legacy was able to deal with anyway.  */
+      if (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS"))
+	{
+	  if (partition->parent)
+	    /* Probably a BSD slice.  */
+	    ctx->partname = xasprintf ("%d,%d", partition->parent->number,
+				       partition->number + 1);
+	  else
+	    ctx->partname = xasprintf ("%d", partition->number);
+
+	  return 1;
+	}
+
       ctx->partname = grub_partition_get_name (partition);
       return 1;
     }