From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: Trent Buck <trentbuck@gmail.com>,
"Centurion Computer Technology \(2005\) Ltd"
<daniel@centurion.net.nz>, Sam Morris <sam@robots.org.uk>,
Jan Nieuwenhuizen <janneke-list@xs4all.nl>
Subject: Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
Date: Tue, 8 Jan 2008 16:21:02 +0100 [thread overview]
Message-ID: <20080108152102.GA13078@thorin> (raw)
In-Reply-To: <20080108150140.GA470@thorin>
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
On Tue, Jan 08, 2008 at 04:01:40PM +0100, Robert Millan wrote:
>
> It's a bit funny. I tried to fix your problem, and at some point I realized
> I was fixing something else.
Ok, so I fixed lvm/raid handling in core.img (by grub-install). This will help
those who (unlike you) have their /boot under LVM or software RAID.
Please could someone test? (I'm CCing a few people who I heard have this
problem)
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
[-- Attachment #2: lvmraid.diff --]
[-- Type: text/x-diff, Size: 4936 bytes --]
diff -x '*~' -x configure -x config.h.in -ur grub2/include/grub/util/getroot.h test/include/grub/util/getroot.h
--- grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
+++ test/include/grub/util/getroot.h 2008-01-08 16:07:30.000000000 +0100
@@ -21,6 +21,6 @@
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
-char *grub_util_get_grub_dev (const char *os_dev);
+char *grub_util_get_grub_dev (const char *dev_type, const char *os_dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
diff -x '*~' -x configure -x config.h.in -ur grub2/util/getroot.c test/util/getroot.c
--- grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
+++ test/util/getroot.c 2008-01-08 16:11:01.000000000 +0100
@@ -239,11 +239,41 @@
return os_dev;
}
+static char *dev_types[] = {
+ "",
+ "lvm",
+ "raid",
+};
+
+enum {
+ TYPE_RAW,
+ TYPE_LVM,
+ TYPE_RAID,
+};
+
char *
-grub_util_get_grub_dev (const char *os_dev)
+grub_util_get_dev_type (const char *os_dev)
{
/* Check for LVM. */
if (!strncmp (os_dev, "/dev/mapper/", 12))
+ return dev_types[TYPE_LVM];
+
+ /* Check for RAID. */
+ if (!strncmp (os_dev, "/dev/md", 7))
+ return dev_types[TYPE_RAID];
+
+ /* If it's not RAID or LVM, it should be a biosdisk. */
+ return dev_types[TYPE_RAW];
+}
+
+char *
+grub_util_get_grub_dev (const char *type, const char *os_dev)
+{
+ if (! type)
+ type = grub_util_get_dev_type (os_dev);
+
+ /* Check for LVM. */
+ if (!strcmp (type, "lvm"))
{
char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
@@ -253,7 +283,7 @@
}
/* Check for RAID. */
- if (!strncmp (os_dev, "/dev/md", 7))
+ if (!strcmp (type, "raid"))
{
const char *p;
char *grub_dev = xmalloc (20);
diff -x '*~' -x configure -x config.h.in -ur grub2/util/grub-probe.c test/util/grub-probe.c
--- grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
+++ test/util/grub-probe.c 2008-01-08 16:12:38.000000000 +0100
@@ -39,10 +39,13 @@
#define _GNU_SOURCE 1
#include <getopt.h>
-#define PRINT_FS 0
-#define PRINT_DRIVE 1
-#define PRINT_DEVICE 2
-#define PRINT_PARTMAP 3
+enum {
+ PRINT_FS,
+ PRINT_DRIVE,
+ PRINT_DEVICE,
+ PRINT_PARTMAP,
+ PRINT_TYPE,
+};
int print = PRINT_FS;
@@ -74,6 +77,7 @@
{
char *device_name;
char *drive_name = NULL;
+ char *type_name;
grub_device_t dev;
grub_fs_t fs;
@@ -87,7 +91,17 @@
goto end;
}
- drive_name = grub_util_get_grub_dev (device_name);
+ type_name = grub_util_get_dev_type (device_name);
+ if (! type_name)
+ grub_util_error ("cannot identify drive type for %s.\n", device_name);
+
+ if (print == PRINT_TYPE)
+ {
+ printf ("(%s)\n", type_name);
+ goto end;
+ }
+
+ drive_name = grub_util_get_grub_dev (type_name, device_name);
if (! drive_name)
grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
diff -x '*~' -x configure -x config.h.in -ur grub2/util/i386/pc/grub-install.in test/util/i386/pc/grub-install.in
--- grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ test/util/i386/pc/grub-install.in 2008-01-08 16:14:31.000000000 +0100
@@ -223,8 +223,11 @@
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device type module, if any (lvm, raid).
+devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module $devtype_module biosdisk _chain"
$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
diff -x '*~' -x configure -x config.h.in -ur grub2/util/i386/pc/grub-setup.c test/util/i386/pc/grub-setup.c
--- grub2/util/i386/pc/grub-setup.c 2008-01-05 13:20:28.000000000 +0100
+++ test/util/i386/pc/grub-setup.c 2008-01-08 16:10:30.000000000 +0100
@@ -668,7 +668,7 @@
if (! dest_dev)
{
/* Possibly, the user specified an OS device file. */
- dest_dev = grub_util_get_grub_dev (argv[optind]);
+ dest_dev = grub_util_get_grub_dev (NULL, argv[optind]);
if (! dest_dev)
{
fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@
}
else
{
- root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+ root_dev = grub_util_get_grub_dev (NULL, grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
if (! root_dev)
{
grub_util_info ("guessing the root device failed, because of `%s'",
@@ -734,7 +734,7 @@
dir ? : DEFAULT_DIRECTORY,
boot_file ? : DEFAULT_BOOT_FILE,
core_file ? : DEFAULT_CORE_FILE,
- root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
+ root_dev, grub_util_get_grub_dev (NULL, devicelist[i]), 1);
}
free (raid_prefix);
next prev parent reply other threads:[~2008-01-08 15:22 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 20:10 LVM on debian Martin Braure de Calignon
2008-01-07 22:07 ` Robert Millan
2008-01-07 22:31 ` Martin Braure de Calignon
2008-01-07 23:20 ` Luca Capello
2008-01-08 9:24 ` Robert Millan
2008-01-08 10:21 ` Martin Braure de Calignon
2008-01-08 12:10 ` debian upgrades and extracting kopt from menu.lst (Re: LVM on debian) Robert Millan
2008-01-08 12:13 ` LVM on debian Robert Millan
2008-01-08 13:00 ` Martin Braure de Calignon
2008-01-08 13:06 ` Bean
2008-01-08 13:11 ` Bean
2008-01-08 13:20 ` Martin Braure de Calignon
2008-01-08 13:28 ` Bean
2008-01-08 14:26 ` Robert Millan
2008-01-08 15:01 ` [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian) Robert Millan
2008-01-08 15:21 ` Robert Millan [this message]
2008-01-08 16:06 ` Martin Braure de Calignon
2008-01-08 21:05 ` Jan Nieuwenhuizen
2008-01-08 21:44 ` Robert Millan
2008-01-08 22:18 ` Jan Nieuwenhuizen
2008-01-08 23:33 ` Robert Millan
2008-01-09 9:08 ` Jan Nieuwenhuizen
2008-01-09 10:35 ` Robert Millan
2008-01-09 10:53 ` Jan Nieuwenhuizen
2008-01-09 11:48 ` Robert Millan
2008-01-09 13:07 ` Jan Nieuwenhuizen
2008-01-09 14:29 ` Robert Millan
2008-01-08 22:52 ` Martin Braure de Calignon
2008-01-08 23:35 ` Robert Millan
2008-01-08 21:55 ` Robert Millan
2008-01-09 9:00 ` Jan Nieuwenhuizen
2008-01-09 11:41 ` Robert Millan
2008-01-09 13:36 ` Jan Nieuwenhuizen
2008-01-09 14:32 ` Robert Millan
2008-01-09 13:40 ` Martin Braure de Calignon
2008-01-09 13:50 ` Martin Braure de Calignon
2008-01-09 14:34 ` Robert Millan
2008-01-09 14:55 ` Martin Braure de Calignon
2008-01-09 15:36 ` Robert Millan
2008-01-09 16:27 ` Martin Braure de Calignon
2008-01-09 23:49 ` [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems Robert Millan
2008-01-10 12:43 ` Robert Millan
2008-01-12 15:10 ` Robert Millan
2008-01-15 11:23 ` Marco Gerards
2008-01-15 11:56 ` Robert Millan
2008-01-15 12:17 ` Marco Gerards
2008-01-15 12:27 ` Robert Millan
2008-01-10 13:24 ` Jan Nieuwenhuizen
2008-01-09 13:56 ` [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian) Martin Braure de Calignon
2008-01-09 14:34 ` Robert Millan
2008-01-08 15:25 ` Jan Nieuwenhuizen
2008-01-08 15:39 ` Robert Millan
2008-01-08 16:07 ` Martin Braure de Calignon
2008-01-08 20:53 ` Robert Millan
2008-01-08 13:14 ` LVM on debian Robert Millan
2008-01-08 13:18 ` Bean
2008-01-08 14:27 ` Robert Millan
2008-01-15 12:18 ` Marco Gerards
2008-01-08 13:13 ` Robert Millan
2008-01-08 14:01 ` Martin Braure de Calignon
2008-01-08 14:21 ` Martin Braure de Calignon
2008-01-08 14:29 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080108152102.GA13078@thorin \
--to=rmh@aybabtu.com \
--cc=daniel@centurion.net.nz \
--cc=grub-devel@gnu.org \
--cc=janneke-list@xs4all.nl \
--cc=sam@robots.org.uk \
--cc=trentbuck@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.