~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu_lvm_raid_probe.patch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2011-09-05 16:12:50 UTC
  • Revision ID: package-import@ubuntu.com-20110905161250-eim1f4ktbsr044tl
Tags: 1.99-12ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme and an appropriate background for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel option.
  - Bypass menu unless other OSes are installed or Shift is pressed.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Reduce visual clutter in normal mode.
  - Remove verbose messages printed before reading configuration.
  - Suppress kernel/initrd progress messages, except in recovery mode.
  - Show the boot menu if the previous boot failed.
  - Don't generate device.map during grub-install or grub-mkconfig.
  - Adjust upgrade version checks for Ubuntu.
  - Suppress "GRUB loading" message unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack first.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Check hardware support before using gfxpayload=keep.
  - Put second and subsequent Linux menu entries in a submenu.
  - Preferred resolution detection for VBE.
  - Set vt.handoff=7 for smooth handoff to kernel graphical mode.
  - Update default/grub.md5sum to include maverick's default md5sum.
  - Add nomodeset to Linux kernel arguments in recovery mode.
  - Skip Windows os-prober entries on Wubi systems.
* Suppress the menu by default on Wubi systems with no other-OS entries
  apart from Windows (LP: #826378).
* Always store hostdisk drive names in canonical form, fixing 'grub-probe
  --target=drive' output when device.map is absent (LP: #820500).

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
===================================================================
46
46
--- a/grub-core/kern/emu/hostdisk.c
47
47
+++ b/grub-core/kern/emu/hostdisk.c
48
 
@@ -1659,6 +1659,48 @@
 
48
@@ -1008,6 +1008,24 @@
 
49
     .next = 0
 
50
   };
 
51
 
 
52
+static char *
 
53
+canonicalize_device_name (const char *path)
 
54
+{
 
55
+  char *ret;
 
56
+
 
57
+#ifdef __linux__
 
58
+  /* Leave /dev/mapper/ alone on Linux; such devices are the canonical form
 
59
+     despite sometimes being symlinks. */
 
60
+  if (strncmp (path, "/dev/mapper/", 12) == 0)
 
61
+    return xstrdup (path);
 
62
+#endif
 
63
+
 
64
+  ret = canonicalize_file_name (path);
 
65
+  if (! ret)
 
66
+    grub_util_error ("cannot get the real path of `%s'", path);
 
67
+  return ret;
 
68
+}
 
69
+
 
70
 static void
 
71
 read_device_map (const char *dev_map)
 
72
 {
 
73
@@ -1102,19 +1120,7 @@
 
74
            }
 
75
        }
 
76
 
 
77
-#ifdef __linux__
 
78
-      /* On Linux, the devfs uses symbolic links horribly, and that
 
79
-        confuses the interface very much, so use realpath to expand
 
80
-        symbolic links.  Leave /dev/mapper/ alone, though.  */
 
81
-      if (strncmp (p, "/dev/mapper/", 12) != 0)
 
82
-       {
 
83
-         map[drive].device = xmalloc (PATH_MAX);
 
84
-         if (! realpath (p, map[drive].device))
 
85
-           grub_util_error ("cannot get the real path of `%s'", p);
 
86
-       }
 
87
-      else
 
88
-#endif
 
89
-      map[drive].device = xstrdup (p);
 
90
+      map[drive].device = canonicalize_device_name (p);
 
91
     }
 
92
 
 
93
   fclose (fp);
 
94
@@ -1623,7 +1629,7 @@
 
95
   if (convert)
 
96
     os_disk = convert_system_partition_to_system_disk (os_dev, st);
 
97
   else
 
98
-    os_disk = xstrdup (os_dev);
 
99
+    os_disk = canonicalize_device_name (os_dev);
 
100
   if (! os_disk)
 
101
     return -1;
 
102
 
 
103
@@ -1659,6 +1665,51 @@
49
104
   return find_system_device (os_dev, &st, 1, 0) != -1;
50
105
 }
51
106
 
53
108
+store_grub_dev (const char *grub_disk, const char *os_disk)
54
109
+{
55
110
+  unsigned int i;
 
111
+  char *canonical_os_disk;
 
112
+
 
113
+  canonical_os_disk = canonicalize_device_name (os_disk);
56
114
+
57
115
+  for (i = 0; i < ARRAY_SIZE (map); i++)
58
116
+    if (! map[i].device)
59
117
+      break;
60
118
+    else if (strcmp (map[i].drive, grub_disk) == 0)
61
119
+      {
62
 
+       if (strcmp (map[i].device, os_disk) == 0)
 
120
+       if (strcmp (map[i].device, canonical_os_disk) == 0)
63
121
+         return;
64
122
+       grub_util_error (_("drive `%s' already mapped to `%s'"),
65
123
+                        map[i].drive, map[i].device);
69
127
+    grub_util_error (_("device count exceeds limit"));
70
128
+
71
129
+  map[i].drive = xstrdup (grub_disk);
72
 
+  map[i].device = xstrdup (os_disk);
 
130
+  map[i].device = canonical_os_disk; /* steal memory */
73
131
+}
74
132
+
75
133
+static int num_hd = 0;
118
176
 #include <grub/term.h>
119
177
 #include <grub/env.h>
120
178
 #include <grub/raid.h>
121
 
@@ -307,6 +308,7 @@
 
179
@@ -310,6 +311,7 @@
122
180
 {
123
181
   char *dev_map = 0;
124
182
   char *argument;
126
184
 
127
185
   set_program_name (argv[0]);
128
186
 
129
 
@@ -391,6 +393,11 @@
 
187
@@ -394,6 +396,11 @@
130
188
   /* Initialize the emulated biosdisk driver.  */
131
189
   grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
132
190