* LVM on debian
@ 2008-01-07 20:10 Martin Braure de Calignon
2008-01-07 22:07 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-07 20:10 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 774 bytes --]
I've just try for the first time grub2.
I'm on debian/unstable (grub2 version 1.95+20080105)
I have only one thing to say. It's simply amazing !
I love it !
I have an lvm /usr partition. And everything works great.
I only have to look on /etc/grub.d/10_linux to see what was the variable
for command line option of the kernel.
So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to
edit /etc/grub.d/00_header because grub does not work if he cannot
access to the font (that are on my /usr partition). So I added "insmod
lvm" before font loading.
But it work and it looks very promising.
Thanks all for your work. Now I'm looking forward to the next upload of
grub2 on debian to have TGA image support :-)
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-07 22:07 UTC (permalink / raw)
To: The development of GRUB 2
Hi Martin!
On Mon, Jan 07, 2008 at 09:10:18PM +0100, Martin Braure de Calignon wrote:
> I've just try for the first time grub2.
>
> I'm on debian/unstable (grub2 version 1.95+20080105)
> I have only one thing to say. It's simply amazing !
> I love it !
Glad to hear that.
> I have an lvm /usr partition. And everything works great.
> I only have to look on /etc/grub.d/10_linux to see what was the variable
> for command line option of the kernel.
Yeah I'm afraid we lack documentation. We could use some help on that ;-)
> So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to
> edit /etc/grub.d/00_header because grub does not work if he cannot
> access to the font (that are on my /usr partition).
There's something wrong here. update-grub is supposed to detect when your
/usr is inaccessible and disable font automaticaly. You mean that it
falls back to text mode, or that it won't install/boot at all?
> So I added "insmod
> lvm" before font loading.
Ah yes, this is a long-standing issue..
> Thanks all for your work. Now I'm looking forward to the next upload of
> grub2 on debian to have TGA image support :-)
I can't yet! I'm waiting for #459352
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
0 siblings, 2 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-07 22:31 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 2187 bytes --]
On lun, 2008-01-07 at 23:07 +0100, Robert Millan wrote:
> Hi Martin!
>
> On Mon, Jan 07, 2008 at 09:10:18PM +0100, Martin Braure de Calignon wrote:
> > I've just try for the first time grub2.
> >
> > I'm on debian/unstable (grub2 version 1.95+20080105)
> > I have only one thing to say. It's simply amazing !
> > I love it !
>
> Glad to hear that.
>
> > I have an lvm /usr partition. And everything works great.
> > I only have to look on /etc/grub.d/10_linux to see what was the variable
> > for command line option of the kernel.
>
> Yeah I'm afraid we lack documentation. We could use some help on that ;-)
Of course. One possible temporary solution would be to insert all
customization variables in 10_linux and other files in /etc/default/grub
with no value no and a simple comment over it (all the common used
variables). I can try to do it if you want, but I've just discovered
grub2 so it's quite risky.
Is it complicated to convert kopt= options in grub menu.lst to the
GRUB_CMDLINE_LINUX ? in postinst ?
> > So I had to had GRUB_CMDLINE_LINUX on /etc/default/grub. I also have to
> > edit /etc/grub.d/00_header because grub does not work if he cannot
> > access to the font (that are on my /usr partition).
>
> There's something wrong here. update-grub is supposed to detect when your
> /usr is inaccessible and disable font automaticaly. You mean that it
> falls back to text mode, or that it won't install/boot at all?
Well, when I tried, I had a graphical menu with no entry. I had to type
'ESC' and try to find what was wrong (that's where I discover insert
lvm). If you wan't me to try again somes things, I can. I think it
disable font but try to load graphic mode without font. Is it possible ?
> > Thanks all for your work. Now I'm looking forward to the next upload of
> > grub2 on debian to have TGA image support :-)
>
> I can't yet! I'm waiting for #459352
So I just need to wait until the next upload of debian-desktop that's it
no ? black color is better for text of course :-). But I'm not
debian-desktop developper. I'm not DD, so I can't upload it :-/
Cheers,
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-07 22:31 ` Martin Braure de Calignon
@ 2008-01-07 23:20 ` Luca Capello
2008-01-08 9:24 ` Robert Millan
1 sibling, 0 replies; 62+ messages in thread
From: Luca Capello @ 2008-01-07 23:20 UTC (permalink / raw)
To: The development of GRUB 2
Hi all!
Maybe a bit too Debian-specific :-)
On Mon, 07 Jan 2008 23:31:17 +0100, Martin Braure de Calignon wrote:
> On lun, 2008-01-07 at 23:07 +0100, Robert Millan wrote:
>> On Mon, Jan 07, 2008 at 09:10:18PM +0100, Martin Braure de Calignon wrote:
>>> I have an lvm /usr partition. And everything works great.
>>> I only have to look on /etc/grub.d/10_linux to see what was the variable
>>> for command line option of the kernel.
>>
>> Yeah I'm afraid we lack documentation. We could use some help on that ;-)
>
> Of course. One possible temporary solution would be to insert all
> customization variables in 10_linux and other files in /etc/default/grub
> with no value no and a simple comment over it (all the common used
> variables). I can try to do it if you want, but I've just discovered
> grub2 so it's quite risky.
Filling /etc/default/grub with all the variables empty by default (or
commented, as other files in the same dir, e.g. ifupdown) is for sure an
improvement over the current situation.
> Is it complicated to convert kopt= options in grub menu.lst to the
> GRUB_CMDLINE_LINUX ? in postinst ?
This would work for upgrades grub -> grub2, but not for existing
installations (see Debian bug #459247 [1]). So, yes, this can be done,
but having proper documentation (hint, `man update-grub`) would be the
best thing to do. What's funny is that I had on my ToDo list a note to
submit a Debian bug about the same issue ;-)
Thx, bye,
Gismo / Luca
Footnotes:
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=459247
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
1 sibling, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 9:24 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Jan 07, 2008 at 11:31:17PM +0100, Martin Braure de Calignon wrote:
>
> Of course. One possible temporary solution would be to insert all
> customization variables in 10_linux and other files in /etc/default/grub
> with no value no and a simple comment over it (all the common used
> variables).
I don't like it. 10_linux is technicaly a config file, but it's also a script,
which means it's much more likely to be updated (causing upgrade conflicts for
those who modify it) than /etc/default/grub.
Also, /etc/default/grub is provided by debian, while 10_linux is not. We
wouldn't want to put "GRUB_DISTRIBUTOR=Debian" in 10_linux would we ?
And not all variables in /etc/default/grub are meant for 10_linux. Some are
there for 00_header. And even GRUB_DISTRIBUTOR is also used by 10_hurd.
> Is it complicated to convert kopt= options in grub menu.lst to the
> GRUB_CMDLINE_LINUX ? in postinst ?
Maybe. It's basicaly just some sedding, but you have to be careful to get all
the corner cases right. I didn't do it because I didn't consider it important,
but feel free to send a patch.
> > There's something wrong here. update-grub is supposed to detect when your
> > /usr is inaccessible and disable font automaticaly. You mean that it
> > falls back to text mode, or that it won't install/boot at all?
>
> Well, when I tried, I had a graphical menu with no entry. I had to type
> 'ESC' and try to find what was wrong (that's where I discover insert
> lvm). If you wan't me to try again somes things, I can. I think it
> disable font but try to load graphic mode without font. Is it possible ?
Yes, but first I need to understand better what you saw. Does "graphical"
mean it was in VESA mode? You can tell that because "terminal" command would
return "gfxterm" rather than "console". Or does it simply mean you had a
menu?
When you say "with no entry", does this mean you didn't see any text at all
(including the messages at the top and bottom)? Or just that there were no
options in the menu?
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
0 siblings, 2 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 10:21 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 3197 bytes --]
On mar, 2008-01-08 at 10:24 +0100, Robert Millan wrote:
> On Mon, Jan 07, 2008 at 11:31:17PM +0100, Martin Braure de Calignon wrote:
> > Of course. One possible temporary solution would be to insert all
> > customization variables in 10_linux and other files in /etc/default/grub
> > with no value no and a simple comment over it (all the common used
> > variables).
>
> I don't like it. 10_linux is technicaly a config file, but it's also a script,
> which means it's much more likely to be updated (causing upgrade conflicts for
> those who modify it) than /etc/default/grub.
>
> Also, /etc/default/grub is provided by debian, while 10_linux is not. We
> wouldn't want to put "GRUB_DISTRIBUTOR=Debian" in 10_linux would we ?
>
> And not all variables in /etc/default/grub are meant for 10_linux. Some are
> there for 00_header. And even GRUB_DISTRIBUTOR is also used by 10_hurd.
Ok it makes sense to not include all the variables in /etc/default/grub
because of course, /etc/default/grub should only contains variable that
do not really depends on script. But a kernel command line
personalization should be in there. If there's no default in there with
non-valued variables, it should be documented.
> > Is it complicated to convert kopt= options in grub menu.lst to the
> > GRUB_CMDLINE_LINUX ? in postinst ?
>
> Maybe. It's basicaly just some sedding, but you have to be careful to get all
> the corner cases right. I didn't do it because I didn't consider it important,
> but feel free to send a patch.
Well, I think it can be important when you want grub2 to replace grub
because people don't want their computer do not boot any longer (some
options (noapictimer) missing can make my system unbootable). For now,
it's probably not urgent.
A simple
sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst
gives the kernel command line
Then one could use a "echo GRUB_CMD_LINE_LINUX=$(sed '/^# kopt=/!d;s/^#
kopt=//g' /boot/grub/menu.lst) >> /etc/default/grub
It's probably not very robust, so a better transitional solution could
be to ask in debconf for experimental importing of grub1 configuration.
If not, one could also add these informations to README.Debian
I can try to do a patch for this, but I need some advices do not make
common and obvious mistakes on how manage this conversion.
> Yes, but first I need to understand better what you saw. Does "graphical"
> mean it was in VESA mode? You can tell that because "terminal" command would
> return "gfxterm" rather than "console". Or does it simply mean you had a
> menu?
> When you say "with no entry", does this mean you didn't see any text
at all
> (including the messages at the top and bottom)? Or just that there were no
> options in the menu?
>
I've just reinstall the default configuration files of grub2 and reboot.
What I have is a black and white screen with "GNU GRub Version 1.95",
then a menu without any entry and then the message on the bottom saying
me that I can do some commands.
Then I go in 'command mode', do a insmod lvm, then
configFile /boot/grub/grub.cfg and it works perfectly.
Cheers,
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* debian upgrades and extracting kopt from menu.lst (Re: LVM on debian)
2008-01-08 10:21 ` Martin Braure de Calignon
@ 2008-01-08 12:10 ` Robert Millan
2008-01-08 12:13 ` LVM on debian Robert Millan
1 sibling, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 12:10 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 11:21:43AM +0100, Martin Braure de Calignon wrote:
>
> Ok it makes sense to not include all the variables in /etc/default/grub
> because of course, /etc/default/grub should only contains variable that
> do not really depends on script. But a kernel command line
> personalization should be in there. If there's no default in there with
> non-valued variables, it should be documented.
Ah, right. I didn't understand you. You mean we should add a commented
GRUB_CMDLINE_LINUX in that file?
> Well, I think it can be important when you want grub2 to replace grub
> because people don't want their computer do not boot any longer (some
> options (noapictimer) missing can make my system unbootable). For now,
> it's probably not urgent.
> A simple
> sed '/^# kopt=/!d;s/^# kopt=//g' /boot/grub/menu.lst
> gives the kernel command line
> Then one could use a "echo GRUB_CMD_LINE_LINUX=$(sed '/^# kopt=/!d;s/^#
> kopt=//g' /boot/grub/menu.lst) >> /etc/default/grub
>
> It's probably not very robust,
That's incomplete. First, kopt includes a "root=" parameter which update-grub2
generates automaticaly; that should be skipped. You need to consider what
happens if you run this code multiple times, or if GRUB_CMD_LINE_LINUX was
already in /etc/default/grub, etc...
The hard part about this is not extracting the data, but handling all the
corner cases and making sure nothing breaks.
> so a better transitional solution could
> be to ask in debconf for experimental importing of grub1 configuration.
> If not, one could also add these informations to README.Debian
In general, I really dislike documenting bugs or limitations. If the code is
not robust, I think it's better to spend time in improving its robustness
than documenting that it isn't robust.
> I can try to do a patch for this, but I need some advices do not make
> common and obvious mistakes on how manage this conversion.
You need to make sure GRUB_CMD_LINE_LINUX is only added once, and only when
it contains relevant info (for "ro" I don't know what it helps with, but I'd
just skip it unless we see some indication that it serves a purpose).
And you can't assume menu.lst exists.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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 ` Robert Millan
2008-01-08 13:00 ` Martin Braure de Calignon
1 sibling, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 12:13 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 11:21:43AM +0100, Martin Braure de Calignon wrote:
> > Yes, but first I need to understand better what you saw. Does "graphical"
> > mean it was in VESA mode? You can tell that because "terminal" command would
> > return "gfxterm" rather than "console". Or does it simply mean you had a
> > menu?
> > When you say "with no entry", does this mean you didn't see any text
> at all
> > (including the messages at the top and bottom)? Or just that there were no
> > options in the menu?
> >
> I've just reinstall the default configuration files of grub2 and reboot.
> What I have is a black and white screen with "GNU GRub Version 1.95",
> then a menu without any entry and then the message on the bottom saying
> me that I can do some commands.
Ok, so you have fonts. What are the color settings? (run "set" and check
for menu_color_* variables)
> Then I go in 'command mode', do a insmod lvm, then
> configFile /boot/grub/grub.cfg and it works perfectly.
When you're in command mode, is "normal" module inserted? (use lsmod)
What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg
directly?
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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:13 ` Robert Millan
0 siblings, 2 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 13:00 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1.1: Type: text/plain, Size: 791 bytes --]
On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> Ok, so you have fonts. What are the color settings? (run "set" and check
> for menu_color_* variables)
set gives the following output :
?=1
color_highlight=
color_normal=
default=0
prefix=(hd0,9)/boot/grub
root=(hd0,9)
so no menu_color* variables
> When you're in command mode, is "normal" module inserted? (use lsmod)
yes it is (modules loaded are : font, normal, _chain, biosdisk, pc, ext2 and fshelp)
> What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg
> directly?
It try to load it, then it seems it can't, because I'm again on the same black & white menu.
Here's my grub.cfg in attachement (it has been generated by update-grub)
Cheers,
--
Martin Braure de Calignon
[-- Attachment #1.2: grub.cfg --]
[-- Type: text/plain, Size: 1119 bytes --]
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,9)
font (mainvg-usr)/share/grub/unicode.pff
set gfxmode=640x480
insmod gfxterm
insmod vbe
terminal gfxterm
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64" {
linux (hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro noapictimer splash vga=792 quiet
initrd (hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64 (single-user mode)" {
linux (hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro single noapictimer splash vga=792 quiet
initrd (hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
### END /etc/grub.d/10_linux ###
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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:14 ` LVM on debian Robert Millan
2008-01-08 13:13 ` Robert Millan
1 sibling, 2 replies; 62+ messages in thread
From: Bean @ 2008-01-08 13:06 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
>
> On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > Ok, so you have fonts. What are the color settings? (run "set" and check
> > for menu_color_* variables)
> set gives the following output :
> ?=1
Here is the problem ! Some command return error code, then the script
is not parsed correctly. this problem can be fixed by my parser patch.
--
Bean
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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:14 ` LVM on debian Robert Millan
1 sibling, 1 reply; 62+ messages in thread
From: Bean @ 2008-01-08 13:11 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 8, 2008 9:06 PM, Bean <bean123ch@gmail.com> wrote:
> On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
> >
> > On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > > Ok, so you have fonts. What are the color settings? (run "set" and check
> > > for menu_color_* variables)
> > set gives the following output :
> > ?=1
>
> Here is the problem ! Some command return error code, then the script
> is not parsed correctly. this problem can be fixed by my parser patch.
I think the most likely command to cause the error is
font (mainvg-usr)/share/grub/unicode.pff
or
terminal gfxterm
--
Bean
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 13:00 ` Martin Braure de Calignon
2008-01-08 13:06 ` Bean
@ 2008-01-08 13:13 ` Robert Millan
2008-01-08 14:01 ` Martin Braure de Calignon
1 sibling, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 13:13 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 02:00:10PM +0100, Martin Braure de Calignon wrote:
>
> On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > Ok, so you have fonts. What are the color settings? (run "set" and check
> > for menu_color_* variables)
> set gives the following output :
> ?=1
> color_highlight=
> color_normal=
> default=0
> prefix=(hd0,9)/boot/grub
> root=(hd0,9)
>
> so no menu_color* variables
>
> > When you're in command mode, is "normal" module inserted? (use lsmod)
> yes it is (modules loaded are : font, normal, _chain, biosdisk, pc, ext2 and fshelp)
>
> > What happens if you don't insmod lvm and try configfile /boot/grub/grub.cfg
> > directly?
> It try to load it, then it seems it can't, because I'm again on the same black & white menu.
Does your empty menu look exactly like this one?
http://aybabtu.com/tmp/screenshot.png
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 13:06 ` Bean
2008-01-08 13:11 ` Bean
@ 2008-01-08 13:14 ` Robert Millan
2008-01-08 13:18 ` Bean
1 sibling, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 13:14 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 09:06:41PM +0800, Bean wrote:
> On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
> >
> > On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > > Ok, so you have fonts. What are the color settings? (run "set" and check
> > > for menu_color_* variables)
> > set gives the following output :
> > ?=1
>
> Here is the problem ! Some command return error code, then the script
> is not parsed correctly. this problem can be fixed by my parser patch.
Ugh.. I forgot about that one. Will you check it in soon?
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 13:14 ` LVM on debian Robert Millan
@ 2008-01-08 13:18 ` Bean
2008-01-08 14:27 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Bean @ 2008-01-08 13:18 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 8, 2008 9:14 PM, Robert Millan <rmh@aybabtu.com> wrote:
>
> On Tue, Jan 08, 2008 at 09:06:41PM +0800, Bean wrote:
> > On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
> > >
> > > On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > > > Ok, so you have fonts. What are the color settings? (run "set" and check
> > > > for menu_color_* variables)
> > > set gives the following output :
> > > ?=1
> >
> > Here is the problem ! Some command return error code, then the script
> > is not parsed correctly. this problem can be fixed by my parser patch.
>
> Ugh.. I forgot about that one. Will you check it in soon?
should i wait for macro to check it first ?
--
Bean
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 13:11 ` Bean
@ 2008-01-08 13:20 ` Martin Braure de Calignon
2008-01-08 13:28 ` Bean
` (2 more replies)
0 siblings, 3 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 13:20 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
On mar, 2008-01-08 at 21:11 +0800, Bean wrote:
> I think the most likely command to cause the error is
>
> font (mainvg-usr)/share/grub/unicode.pff
> or
> terminal gfxterm
I think 'font' line can't work because font are on my /usr, and /usr is
LVM and lvm module is not loaded... But I though grub2 know how to deals
with it.
You're patch for the parser is on the cvs or svn or git (I don't know
which one you use)
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
2 siblings, 0 replies; 62+ messages in thread
From: Bean @ 2008-01-08 13:28 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 8, 2008 9:20 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
>
> On mar, 2008-01-08 at 21:11 +0800, Bean wrote:
> > I think the most likely command to cause the error is
> >
> > font (mainvg-usr)/share/grub/unicode.pff
> > or
> > terminal gfxterm
>
> I think 'font' line can't work because font are on my /usr, and /usr is
> LVM and lvm module is not loaded... But I though grub2 know how to deals
> with it.
> You're patch for the parser is on the cvs or svn or git (I don't know
> which one you use)
It's here:
http://lists.gnu.org/archive/html/grub-devel/2007-12/msg00204.html
--
Bean
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
0 siblings, 2 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 14:01 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 330 bytes --]
On mar, 2008-01-08 at 14:13 +0100, Robert Millan wrote:
>
> Does your empty menu look exactly like this one?
>
> http://aybabtu.com/tmp/screenshot.png
Not exactly, it looks like this one, but I have a rectangular zone and a
highlighted blank line where the menu should be
Cheers,
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
1 sibling, 0 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 14:21 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 463 bytes --]
On mar, 2008-01-08 at 15:01 +0100, Martin Braure de Calignon wrote:
> On mar, 2008-01-08 at 14:13 +0100, Robert Millan wrote:
> >
> > Does your empty menu look exactly like this one?
> >
> > http://aybabtu.com/tmp/screenshot.png
>
> Not exactly, it looks like this one, but I have a rectangular zone and a
> highlighted blank line where the menu should be
like this:
http://braure.free.fr/screenshot_gimped.png
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
2 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 14:26 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 02:20:53PM +0100, Martin Braure de Calignon wrote:
>
> On mar, 2008-01-08 at 21:11 +0800, Bean wrote:
> > I think the most likely command to cause the error is
> >
> > font (mainvg-usr)/share/grub/unicode.pff
> > or
> > terminal gfxterm
>
> I think 'font' line can't work because font are on my /usr, and /usr is
> LVM and lvm module is not loaded... But I though grub2 know how to deals
> with it.
Uhm unfortunately update-grub doesn't know how to detect that this file
won't be accessible (since this is in fact a bug..).
But I'd rather fix the bug than adding a bug detector in update-grub ;-)
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 13:18 ` Bean
@ 2008-01-08 14:27 ` Robert Millan
2008-01-15 12:18 ` Marco Gerards
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 14:27 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 09:18:47PM +0800, Bean wrote:
> On Jan 8, 2008 9:14 PM, Robert Millan <rmh@aybabtu.com> wrote:
> >
> > On Tue, Jan 08, 2008 at 09:06:41PM +0800, Bean wrote:
> > > On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
> > > >
> > > > On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
> > > > > Ok, so you have fonts. What are the color settings? (run "set" and check
> > > > > for menu_color_* variables)
> > > > set gives the following output :
> > > > ?=1
> > >
> > > Here is the problem ! Some command return error code, then the script
> > > is not parsed correctly. this problem can be fixed by my parser patch.
> >
> > Ugh.. I forgot about that one. Will you check it in soon?
>
> should i wait for macro to check it first ?
I don't know. You can try mailing him directly.
Anyway, if you did something wrong we can always revert it.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
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
1 sibling, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 14:29 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 03:01:12PM +0100, Martin Braure de Calignon wrote:
>
> On mar, 2008-01-08 at 14:13 +0100, Robert Millan wrote:
> >
> > Does your empty menu look exactly like this one?
> >
> > http://aybabtu.com/tmp/screenshot.png
>
> Not exactly, it looks like this one, but I have a rectangular zone and a
> highlighted blank line where the menu should be
Ok. That means it has nothing to do with colors (I was afraid that you
got black on black menu color somehow).
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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 ` Robert Millan
2008-01-08 15:21 ` Robert Millan
` (2 more replies)
2 siblings, 3 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 15:01 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
On Tue, Jan 08, 2008 at 02:20:53PM +0100, Martin Braure de Calignon wrote:
>
> On mar, 2008-01-08 at 21:11 +0800, Bean wrote:
> > I think the most likely command to cause the error is
> >
> > font (mainvg-usr)/share/grub/unicode.pff
> > or
> > terminal gfxterm
>
> I think 'font' line can't work because font are on my /usr, and /usr is
> LVM and lvm module is not loaded... But I though grub2 know how to deals
> with it.
It's a bit funny. I tried to fix your problem, and at some point I realized
I was fixing something else. Then got back at your problem, and turned out
we just need to force load of "lvm" and "raid" before entering normal mode.
Please try attached patch and report (note: this is unrelated to the parser
error Bean fixed; the parser error simply makes the real problem in your
setup go away unnoticed).
--
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: 439 bytes --]
diff -ur grub2/kern/main.c grub2.lvm/kern/main.c
--- grub2/kern/main.c 2008-01-05 13:04:35.000000000 +0100
+++ grub2.lvm/kern/main.c 2008-01-08 15:57:54.000000000 +0100
@@ -99,6 +99,11 @@
static void
grub_load_normal_mode (void)
{
+ /* Before entering normal mode, always insert these whenever
+ they're available. */
+ grub_dl_load ("lvm");
+ grub_dl_load ("raid");
+
/* Load the module. */
grub_dl_load ("normal");
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
2008-01-08 16:06 ` Martin Braure de Calignon
2008-01-08 21:05 ` Jan Nieuwenhuizen
2008-01-08 15:25 ` Jan Nieuwenhuizen
2008-01-08 16:07 ` Martin Braure de Calignon
2 siblings, 2 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 15:21 UTC (permalink / raw)
To: The development of GRUB 2
Cc: Trent Buck, Centurion Computer Technology (2005) Ltd, Sam Morris,
Jan Nieuwenhuizen
[-- 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);
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
@ 2008-01-08 15:25 ` Jan Nieuwenhuizen
2008-01-08 15:39 ` Robert Millan
2008-01-08 16:07 ` Martin Braure de Calignon
2 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-08 15:25 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> It's a bit funny. I tried to fix your problem, and at some point I realized
> I was fixing something else. Then got back at your problem, and turned out
> we just need to force load of "lvm" and "raid" before entering normal mode.
Ah, but this looks promising form my lvm in core bug too, I'll give it a
test.
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 15:25 ` Jan Nieuwenhuizen
@ 2008-01-08 15:39 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 15:39 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 04:25:28PM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > It's a bit funny. I tried to fix your problem, and at some point I realized
> > I was fixing something else. Then got back at your problem, and turned out
> > we just need to force load of "lvm" and "raid" before entering normal mode.
>
> Ah, but this looks promising form my lvm in core bug too, I'll give it a
> test.
Don't expect grub_dl_load("lvm") to give you lvm.mod if you need lvm.mod in
order to access lvm.mod in first place :-)
In those cases, the only way to load lvm.mod in core.img is to have it in from
the beginning (this is what my other patch hopefuly does).
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 15:21 ` Robert Millan
@ 2008-01-08 16:06 ` Martin Braure de Calignon
2008-01-08 21:05 ` Jan Nieuwenhuizen
1 sibling, 0 replies; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 16:06 UTC (permalink / raw)
To: The development of GRUB 2
Cc: Trent Buck, Centurion Computer Technology (2005) Ltd, Sam Morris,
Jan Nieuwenhuizen
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]
On mar, 2008-01-08 at 16:21 +0100, Robert Millan wrote:
> 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)
Ok it works perfectly here after a grub-install "(hd0)"
I didn't test graphical console before, it's really slow but everythings
works now :-)
Thanks
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
2008-01-08 15:25 ` Jan Nieuwenhuizen
@ 2008-01-08 16:07 ` Martin Braure de Calignon
2008-01-08 20:53 ` Robert Millan
2 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 16:07 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
On mar, 2008-01-08 at 16:01 +0100, Robert Millan wrote:
> On Tue, Jan 08, 2008 at 02:20:53PM +0100, Martin Braure de Calignon wrote:
> >
> > On mar, 2008-01-08 at 21:11 +0800, Bean wrote:
> > > I think the most likely command to cause the error is
> > >
> > > font (mainvg-usr)/share/grub/unicode.pff
> > > or
> > > terminal gfxterm
> >
> > I think 'font' line can't work because font are on my /usr, and /usr is
> > LVM and lvm module is not loaded... But I though grub2 know how to deals
> > with it.
>
> It's a bit funny. I tried to fix your problem, and at some point I realized
> I was fixing something else. Then got back at your problem, and turned out
> we just need to force load of "lvm" and "raid" before entering normal mode.
>
> Please try attached patch and report (note: this is unrelated to the parser
> error Bean fixed; the parser error simply makes the real problem in your
> setup go away unnoticed).
my previous post was for this patch testing
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 16:07 ` Martin Braure de Calignon
@ 2008-01-08 20:53 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 20:53 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 05:07:10PM +0100, Martin Braure de Calignon wrote:
> >
> > Please try attached patch and report (note: this is unrelated to the parser
> > error Bean fixed; the parser error simply makes the real problem in your
> > setup go away unnoticed).
>
> my previous post was for this patch testing
Good. Could you also try the other one and run:
grub-probe --target=type /usr/...../unifont.pff ?
It should tell you that you need lvm. update-grub can use that to add
conditional "insmod lvm" calls. I think that'd be the right way to solve it.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 15:21 ` Robert Millan
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 21:55 ` Robert Millan
1 sibling, 2 replies; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-08 21:05 UTC (permalink / raw)
To: Robert Millan; +Cc: The development of GRUB 2
Robert Millan writes:
> 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.
I applied both pathces, but lvm does not work for me yet. The second
patch has
+devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
but my grub-probe patched against latest CVS does grok --target=type, it
says
Try ``grub-probe --help'' for more information.
-t, --target=(fs|drive|device|partmap)
Should I be pulling some git branch of yours?
When I replace the line above with
+devtype_module=`$grub_probe --target=device --device-map=${device_map} ${grubdir}`
grub-install issues
grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 /dev/mapper/lvmraid-lvm1 biosdisk _chain
grub-mkimage: error: cannot stat /dev/mapper/lvmraid-lvm1.mod
(odd btw, how there is also no gpt in the list. that won't work, right?)
This grub-mkimage line gave me an idea: you have lvm loaded before ext2,
which could be why lvm inserted in core.img does not work. So I
manually did
grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
grub-setup '(hd0)'
but that again gave me a grub rescue> prompt with exactly the same
problems as before: error: unknown device, until I rmmod lvm, insmod lvm
by hand
(reboot)
grub rescue> set
prefix=(lvmraid-lvm0)/boot/grub
root=lvmraid-lvm0
grub rescue> insmod normal
error: unknown device
grub rescue> lsmod
Name Ref Count Dependencies
biosdisk 1
gpt 1
pc 1
ext2 1 fshelp
fshelp 2
lvm 1
grub rescue> ls
(hd0) (hd0,1) (hd0,5) (hd0,6) (hd0) (hd1,1) (hd1,5) (hd1,6)
grub rescue> rmmod lvm
grub rescue> insmod (hd1,1)/boot/grub/lvm.mod
grub rescue> ls
(lvmraid-lvm0) ...
grub rescue> insmod normal
grub rescue> normal
(See
http://lists.gnu.org/archive/html/grub-devel/2008-01/msg00146.html)
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 21:05 ` Jan Nieuwenhuizen
@ 2008-01-08 21:44 ` Robert Millan
2008-01-08 22:18 ` Jan Nieuwenhuizen
2008-01-08 22:52 ` Martin Braure de Calignon
2008-01-08 21:55 ` Robert Millan
1 sibling, 2 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 21:44 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]
On Tue, Jan 08, 2008 at 10:05:59PM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > 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.
>
> I applied both pathces, but lvm does not work for me yet. The second
> patch has
>
> +devtype_module=`$grub_probe --target=type --device-map=${device_map} ${grubdir}`
>
> but my grub-probe patched against latest CVS does grok --target=type, it
> says
>
> Try ``grub-probe --help'' for more information.
> -t, --target=(fs|drive|device|partmap)
>
> Should I be pulling some git branch of yours?
Try this one.
> When I replace the line above with
>
> +devtype_module=`$grub_probe --target=device --device-map=${device_map} ${grubdir}`
No, --target=device returns a device name which is not what you want.
--
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: 5251 bytes --]
Only in grub2.lvm: config.h.in~
diff -x configure -x config.h.in -ur grub2/include/grub/util/getroot.h grub2.lvm/include/grub/util/getroot.h
--- grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
+++ grub2.lvm/include/grub/util/getroot.h 2008-01-08 22:19:17.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 configure -x config.h.in -ur grub2/util/getroot.c grub2.lvm/util/getroot.c
--- grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
+++ grub2.lvm/util/getroot.c 2008-01-08 22:19:17.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 configure -x config.h.in -ur grub2/util/grub-probe.c grub2.lvm/util/grub-probe.c
--- grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
+++ grub2.lvm/util/grub-probe.c 2008-01-08 22:40: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);
@@ -206,6 +220,8 @@
print = PRINT_DEVICE;
else if (!strcmp (optarg, "partmap"))
print = PRINT_PARTMAP;
+ else if (!strcmp (optarg, "type"))
+ print = PRINT_TYPE;
else
usage (1);
break;
Only in grub2.lvm/util: grub-probe.c~
diff -x configure -x config.h.in -ur grub2/util/i386/pc/grub-install.in grub2.lvm/util/i386/pc/grub-install.in
--- grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ grub2.lvm/util/i386/pc/grub-install.in 2008-01-08 22:19:17.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 configure -x config.h.in -ur grub2/util/i386/pc/grub-setup.c grub2.lvm/util/i386/pc/grub-setup.c
--- grub2/util/i386/pc/grub-setup.c 2008-01-05 13:20:28.000000000 +0100
+++ grub2.lvm/util/i386/pc/grub-setup.c 2008-01-08 22:19:17.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);
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 21:05 ` Jan Nieuwenhuizen
2008-01-08 21:44 ` Robert Millan
@ 2008-01-08 21:55 ` Robert Millan
2008-01-09 9:00 ` Jan Nieuwenhuizen
1 sibling, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 21:55 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 10:05:59PM +0100, Jan Nieuwenhuizen wrote:
>
> grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
> grub-setup '(hd0)'
>
> but that again gave me a grub rescue> prompt with exactly the same
> problems as before: error: unknown device, until I rmmod lvm, insmod lvm
> by hand
What happens if you change grub-mkimage parameter order? Put "lvm" as the
last one.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 21:44 ` Robert Millan
@ 2008-01-08 22:18 ` Jan Nieuwenhuizen
2008-01-08 23:33 ` Robert Millan
2008-01-08 22:52 ` Martin Braure de Calignon
1 sibling, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-08 22:18 UTC (permalink / raw)
To: Robert Millan; +Cc: The development of GRUB 2
Robert Millan writes:
> Try this one.
That's better, grub-install now does
grub-mkimage --output=/tmp/boot/grub/core.img --prefix=/tmp/boot/grub ext2 lvm biosdisk _chain
I haven't tested yet, but this won't work, gpt (or pc?) is also needed, right?
I remember having seen
grub rescue> ls
(hd0) (hd1)
ie: no partitions when I tried without gpt/pc. I do not know how to
recover from that from withing grub (cannot mount anything to insmod
gpt/pc from).
Here's how grub-probe is called
grub-probe --target=partmap --device-map=/boot/grub/device.map /boot/grub
grub-probe: error: Cannot detect partition map for lvmraid-lvm1
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 21:44 ` Robert Millan
2008-01-08 22:18 ` Jan Nieuwenhuizen
@ 2008-01-08 22:52 ` Martin Braure de Calignon
2008-01-08 23:35 ` Robert Millan
1 sibling, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-08 22:52 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
With your second patch, executing :
grub-probe --target=type /usr/share/grub/unicode.pff
output :
lvm
So it seems to gives correct output (but I have only unicode.pff not
unifont.pff)
So I think it's great :-)
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 22:18 ` Jan Nieuwenhuizen
@ 2008-01-08 23:33 ` Robert Millan
2008-01-09 9:08 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-08 23:33 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: The development of GRUB 2
On Tue, Jan 08, 2008 at 11:18:28PM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > Try this one.
>
> That's better, grub-install now does
>
> grub-mkimage --output=/tmp/boot/grub/core.img --prefix=/tmp/boot/grub ext2 lvm biosdisk _chain
Try putting lvm after biosdisk (I mentioned this in another mail).
> I haven't tested yet, but this won't work, gpt (or pc?) is also needed, right?
Yep.
> I remember having seen
>
> grub rescue> ls
> (hd0) (hd1)
>
> ie: no partitions when I tried without gpt/pc. I do not know how to
> recover from that from withing grub (cannot mount anything to insmod
> gpt/pc from).
You can't.
> grub-probe --target=partmap --device-map=/boot/grub/device.map /boot/grub
> grub-probe: error: Cannot detect partition map for lvmraid-lvm1
Wait, do lvm devices actually contain a partition map? If not, then this is
normal, although in this case grub-probe should tell you the partmap for
whatever physical partition contains the lvm data.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 22:52 ` Martin Braure de Calignon
@ 2008-01-08 23:35 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-08 23:35 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 08, 2008 at 11:52:57PM +0100, Martin Braure de Calignon wrote:
>
> With your second patch, executing :
>
> grub-probe --target=type /usr/share/grub/unicode.pff
> output :
> lvm
>
> So it seems to gives correct output (but I have only unicode.pff not
> unifont.pff)
>
> So I think it's great :-)
Great. When I have a minute I'll polish that patch and eventually will
be checked in.
Thanks
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 21:55 ` Robert Millan
@ 2008-01-09 9:00 ` Jan Nieuwenhuizen
2008-01-09 11:41 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-09 9:00 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> > grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
> What happens if you change grub-mkimage parameter order? Put "lvm" as the
> last one.
Yes, that's it. For the archives, this
grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm
works for me. Thanks!
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-08 23:33 ` Robert Millan
@ 2008-01-09 9:08 ` Jan Nieuwenhuizen
2008-01-09 10:35 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-09 9:08 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> Wait, do lvm devices actually contain a partition map?
I don't think so. LVM devices have volume groups and logical volumes.
> If not, then this is
> normal, although in this case grub-probe should tell you the partmap
> for
> whatever physical partition contains the lvm data.
Yes. Or at least grub-install should check if grub-probe reports an
error when checking for the partmap and warn the user or insert gpt/pc.
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 9:08 ` Jan Nieuwenhuizen
@ 2008-01-09 10:35 ` Robert Millan
2008-01-09 10:53 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-09 10:35 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 10:08:50AM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > Wait, do lvm devices actually contain a partition map?
>
> I don't think so. LVM devices have volume groups and logical volumes.
>
> > If not, then this is
> > normal, although in this case grub-probe should tell you the partmap
> > for
> > whatever physical partition contains the lvm data.
>
> Yes. Or at least grub-install should check if grub-probe reports an
> error when checking for the partmap and warn the user or insert gpt/pc.
Partition maps aren't really mandatory; much like lvm/raid.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 10:35 ` Robert Millan
@ 2008-01-09 10:53 ` Jan Nieuwenhuizen
2008-01-09 11:48 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-09 10:53 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> Partition maps aren't really mandatory; much like lvm/raid.
Hmm, yes of course. But having one may save your day if booting fails
and
you have useful non-lvm partitions. It is very useful if
you can browse/use all your hdx,y if booting fails?
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 9:00 ` Jan Nieuwenhuizen
@ 2008-01-09 11:41 ` Robert Millan
2008-01-09 13:36 ` Jan Nieuwenhuizen
` (2 more replies)
0 siblings, 3 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-09 11:41 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
On Wed, Jan 09, 2008 at 10:00:37AM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > > grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
>
> > What happens if you change grub-mkimage parameter order? Put "lvm" as the
> > last one.
>
> Yes, that's it. For the archives, this
>
> grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm
>
> works for me. Thanks!
I reworked and cleaned up the patch a bit. Please, can you test this one?
--
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: 12732 bytes --]
diff -x configure -x config.h.in -ur ../grub2/include/grub/util/getroot.h ./include/grub/util/getroot.h
--- ../grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
+++ ./include/grub/util/getroot.h 2008-01-09 12:36:13.000000000 +0100
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,8 +19,16 @@
#ifndef GRUB_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
+enum grub_dev_abstraction_types {
+ GRUB_DEV_ABSTRACTION_NONE,
+ GRUB_DEV_ABSTRACTION_LVM,
+ GRUB_DEV_ABSTRACTION_RAID,
+ GRUB_DEV_ABSTRACTION_UNKNOWN,
+};
+
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);
+int grub_util_get_dev_abstraction (const char *os_dev);
+char *grub_util_get_grub_dev (const int dev_abstraction, const char *os_dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
diff -x configure -x config.h.in -ur ../grub2/util/getroot.c ./util/getroot.c
--- ../grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
+++ ./util/getroot.c 2008-01-09 12:36:23.000000000 +0100
@@ -1,7 +1,7 @@
/* getroot.c - Get root device */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <grub/util/misc.h>
#include <grub/util/biosdisk.h>
+#include <grub/util/getroot.h>
static void
strip_extra_slashes (char *dir)
@@ -239,27 +240,45 @@
return os_dev;
}
-char *
-grub_util_get_grub_dev (const char *os_dev)
+int
+grub_util_get_dev_abstraction (const char *os_dev)
{
/* Check for LVM. */
if (!strncmp (os_dev, "/dev/mapper/", 12))
- {
- char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
-
- strcpy (grub_dev, os_dev+12);
-
- return grub_dev;
- }
+ return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */
if (!strncmp (os_dev, "/dev/md", 7))
+ return GRUB_DEV_ABSTRACTION_RAID;
+
+ /* No abstraction found. */
+ return GRUB_DEV_ABSTRACTION_NONE;
+}
+
+char *
+grub_util_get_grub_dev (int abstraction, const char *os_dev)
+{
+ char *grub_dev;
+
+ if (abstraction == GRUB_DEV_ABSTRACTION_UNKNOWN)
+ abstraction = grub_util_get_dev_abstraction (os_dev);
+
+ switch (abstraction)
{
- const char *p;
- char *grub_dev = xmalloc (20);
+ case GRUB_DEV_ABSTRACTION_LVM:
+ grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
+
+ strcpy (grub_dev, os_dev + 12);
+
+ break;
+
+ case GRUB_DEV_ABSTRACTION_RAID:
+ grub_dev = xmalloc (20);
if (os_dev[7] == '_' && os_dev[8] == 'd')
{
+ const char *p;
+
/* This a partitionable RAID device of the form /dev/md_dNNpMM. */
int i;
@@ -297,17 +316,17 @@
}
else if (os_dev[7] >= '0' && os_dev[7] <= '9')
{
- p = os_dev + 5;
- memcpy (grub_dev, p, 7);
+ memcpy (grub_dev, os_dev + 5, 7);
grub_dev[7] = '\0';
}
else
grub_util_error ("Unknown kind of RAID device `%s'", os_dev);
+ break;
- return grub_dev;
+ default: /* GRUB_DEV_ABSTRACTION_NONE */
+ grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
}
- /* If it's not RAID or LVM, it should be a biosdisk. */
- return grub_util_biosdisk_get_grub_dev (os_dev);
+ return grub_dev;
}
diff -x configure -x config.h.in -ur ../grub2/util/grub.d/00_header.in ./util/grub.d/00_header.in
--- ../grub2/util/grub.d/00_header.in 2007-07-22 01:32:31.000000000 +0200
+++ ./util/grub.d/00_header.in 2008-01-09 12:35:33.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# update-grub helper script.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@
# for convert_system_path_to_grub_path()
. ${libdir}/grub/update-grub_lib
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+ echo "insmod $i"
+done
+
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
diff -x configure -x config.h.in -ur ../grub2/util/grub-probe.c ./util/grub-probe.c
--- ../grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
+++ ./util/grub-probe.c 2008-01-09 12:36:36.000000000 +0100
@@ -1,7 +1,7 @@
/* grub-probe.c - probe device information for a given path */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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_ABSTRACTION,
+};
int print = PRINT_FS;
@@ -74,6 +77,7 @@
{
char *device_name;
char *drive_name = NULL;
+ int abstraction_type;
grub_device_t dev;
grub_fs_t fs;
@@ -87,7 +91,29 @@
goto end;
}
- drive_name = grub_util_get_grub_dev (device_name);
+ abstraction_type = grub_util_get_dev_abstraction (device_name);
+ /* No need to check for errors; lack of abstraction is permissible. */
+
+ if (print == PRINT_ABSTRACTION)
+ {
+ char *abstraction_name;
+ switch (abstraction_type)
+ {
+ case GRUB_DEV_ABSTRACTION_NONE:
+ grub_util_info ("did not find LVM/RAID in %s, assuming raw device", device_name);
+ goto end;
+ case GRUB_DEV_ABSTRACTION_LVM:
+ abstraction_name = "lvm";
+ break;
+ case GRUB_DEV_ABSTRACTION_RAID:
+ abstraction_name = "raid";
+ break;
+ }
+ printf ("%s\n", abstraction_name);
+ goto end;
+ }
+
+ drive_name = grub_util_get_grub_dev (abstraction_type, device_name);
if (! drive_name)
grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
@@ -159,7 +185,7 @@
Probe device information for a given path.\n\
\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
- -t, --target=(fs|drive|device|partmap)\n\
+ -t, --target=(fs|drive|device|partmap|abstraction)\n\
print filesystem module, GRUB drive, system device or partition map module [default=fs]\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
@@ -206,6 +232,8 @@
print = PRINT_DEVICE;
else if (!strcmp (optarg, "partmap"))
print = PRINT_PARTMAP;
+ else if (!strcmp (optarg, "abstraction"))
+ print = PRINT_ABSTRACTION;
else
usage (1);
break;
diff -x configure -x config.h.in -ur ../grub2/util/i386/pc/grub-install.in ./util/i386/pc/grub-install.in
--- ../grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ ./util/i386/pc/grub-install.in 2008-01-09 12:36:50.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
diff -x configure -x config.h.in -ur ../grub2/util/i386/pc/grub-setup.c ./util/i386/pc/grub-setup.c
--- ../grub2/util/i386/pc/grub-setup.c 2008-01-05 13:20:28.000000000 +0100
+++ ./util/i386/pc/grub-setup.c 2008-01-09 12:37:04.000000000 +0100
@@ -1,7 +1,7 @@
/* grub-setup.c - make GRUB usable */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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 (GRUB_DEV_ABSTRACTION_UNKNOWN, 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 (GRUB_DEV_ABSTRACTION_UNKNOWN, 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 (GRUB_DEV_ABSTRACTION_UNKNOWN, devicelist[i]), 1);
}
free (raid_prefix);
diff -x configure -x config.h.in -ur ../grub2/util/update-grub.in ./util/update-grub.in
--- ../grub2/util/update-grub.in 2007-12-30 09:52:06.000000000 +0100
+++ ./util/update-grub.in 2008-01-09 12:37:24.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@
# These are defined in this script, export them here so that user can
# override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
# These are optional, user-defined variables.
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
diff -x configure -x config.h.in -ur ../grub2/util/update-grub_lib.in ./util/update-grub_lib.in
--- ../grub2/util/update-grub_lib.in 2007-12-25 10:09:43.000000000 +0100
+++ ./util/update-grub_lib.in 2008-01-09 12:37:42.000000000 +0100
@@ -1,5 +1,5 @@
# Helper library for update-grub
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@
font_path ()
{
- if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
- echo "${GRUB_FONT_PATH}"
- return 0
- fi
-
# Prefer system path for space reasons (/boot/grub might be a very small
# partition in case of OpenFirmware, etc).
for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
# Prefer complete fonts over incomplete ones.
for basename in unicode unifont ascii ; do
- if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
- GRUB_FONT_PATH="${path}"
- echo "${GRUB_FONT_PATH}"
+ path="${dir}/${basename}.pff"
+ if convert_system_path_to_grub_path ${path} ; then
+ GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstraction ${path}`"
return 0
fi
done
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 10:53 ` Jan Nieuwenhuizen
@ 2008-01-09 11:48 ` Robert Millan
2008-01-09 13:07 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-09 11:48 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 11:53:53AM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > Partition maps aren't really mandatory; much like lvm/raid.
>
> Hmm, yes of course. But having one may save your day if booting fails
> and
> you have useful non-lvm partitions. It is very useful if
> you can browse/use all your hdx,y if booting fails?
The problem with that is it can't really solve the problem, only provide a
half-baked solution. If you include pc and gpt, you're misusing space in
a component where it's really critical, and you still don't support all
partitions GRUB might be installed on. For that, you'd have to load _all_
partition maps, which means even more space.
My point is that if you try at blindly guessing which partition map is needed,
whether it works or not simply depends on your luck at guessing. And if you
pick more than one option, it doesn't come for free.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 11:48 ` Robert Millan
@ 2008-01-09 13:07 ` Jan Nieuwenhuizen
2008-01-09 14:29 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-09 13:07 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> The problem with that is it can't really solve the problem, only provide a
> half-baked solution. If you include pc and gpt, you're misusing space in
> a component where it's really critical, and you still don't support all
> partitions GRUB might be installed on. For that, you'd have to load _all_
> partition maps, which means even more space.
I understand, and I've been wondering about this. As I do not have much
if any knowledge for the sizing constraints of a bootloader, so I cannot
appreciate the efforts of reducing space.
As a (blonde) user, I would think that you'd want to use *as much*
rather than as little space you can. Why not (from a sizing pov,
stability could be another issue), after core.img contains
all necessary modules, fill up any `remaining' space (if that is how it
works) with extra non-essential modules? Little harm in the ability
to read more devices, I would say?
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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:56 ` [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian) Martin Braure de Calignon
2 siblings, 1 reply; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-09 13:36 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
Robert Millan writes:
> I reworked and cleaned up the patch a bit. Please, can you test this one?
This has lvm after biosdisk, which looks ok.
grub-mkimage --output=/boot/grub/core.img --prefix=/tmp/boot/grub ext2 biosdisk lvm _chain
Haven't boot-tested this yet, but should be ok.
Btw, I'm editing grub-install all the time to not really install, what about a
--dry-run option? (patch against your version attached)
Greetings,
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
[-- Attachment #2: grub-install.diff --]
[-- Type: text/x-patch, Size: 3239 bytes --]
Index: ChangeLog
===================================================================
RCS file: /sources/grub/grub2/ChangeLog,v
retrieving revision 1.484
diff -p -u -r1.484 ChangeLog
--- ChangeLog 8 Jan 2008 11:38:18 -0000 1.484
+++ ChangeLog 9 Jan 2008 13:33:51 -0000
@@ -1,3 +1,7 @@
+2008-01-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * util/i386/pc/grub-install.in: Add --dry-run option.
+
2008-01-08 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/linux.c (grub_rescue_cmd_linux): For
--- util/i386/pc/grub-install.in~ 2008-01-09 14:32:02.000000000 +0100
+++ util/i386/pc/grub-install.in 2008-01-09 14:28:25.000000000 +0100
@@ -44,6 +44,7 @@
force_lba=
recheck=no
debug=no
+dry_run=
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/update-grub_lib
@@ -57,6 +58,7 @@
-h, --help print this message and exit
-v, --version print the version information and exit
+ -n, --dry-run do not install grub, just print install commands
--modules=MODULES pre-load specified modules MODULES
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
@@ -86,6 +88,8 @@
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
+ -n | --dry-run)
+ dry_run=echo ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--root-directory=*)
@@ -174,8 +178,8 @@
fi
# Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
-test -d "$grubdir" || mkdir "$grubdir" || exit 1
+test -d "$bootdir" || $dry_run mkdir "$bootdir" || exit 1
+test -d "$grubdir" || $dry_run mkdir "$grubdir" || exit 1
# If --recheck is specified, remove the device map, if present.
if test $recheck = yes; then
@@ -203,11 +207,11 @@
# Copy the GRUB images to the GRUB directory.
for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
if test -f $file && [ "`basename $file`" != menu.lst ]; then
- rm -f $file || exit 1
+ $dry_run rm -f $file || exit 1
fi
done
for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
- cp -f $file ${grubdir} || exit 1
+ $dry_run cp -f $file ${grubdir} || exit 1
done
# Create the core image. First, auto-detect the filesystem module.
@@ -229,13 +233,14 @@
# _chain is often useful
modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
-$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
+$dry_run $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
# Now perform the installation.
-$grub_setup --directory=${grubdir} --device-map=${device_map} \
+$dry_run $grub_setup --directory=${grubdir} --device-map=${device_map} \
${install_device} || exit 1
# Prompt the user to check if the device map is correct.
+test -n "$dry_run" && echo "DRY RUN: Grub was not (re)installed."
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 11:41 ` Robert Millan
2008-01-09 13:36 ` Jan Nieuwenhuizen
@ 2008-01-09 13:40 ` Martin Braure de Calignon
2008-01-09 13:50 ` Martin Braure de Calignon
2008-01-09 13:56 ` [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian) Martin Braure de Calignon
2 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-09 13:40 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
Le mercredi 09 janvier 2008 à 12:41 +0100, Robert Millan a écrit :
> On Wed, Jan 09, 2008 at 10:00:37AM +0100, Jan Nieuwenhuizen wrote:
> > Robert Millan writes:
> >
> > > > grub-mkimage --output=/boot/grub/core.img --prefix=/boot/grub ext2 lvm pc gpt biosdisk _chain
> >
> > > What happens if you change grub-mkimage parameter order? Put "lvm" as the
> > > last one.
> >
> > Yes, that's it. For the archives, this
> >
> > grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm
> >
> > works for me. Thanks!
>
> I reworked and cleaned up the patch a bit. Please, can you test this one?
Préparation du remplacement de grub-pc 1.95+20080107-1 (en
utilisant .../grub-pc_1.95+20080107-1_amd64.deb) ...
Dépaquetage de la mise à jour de grub-pc ...
Paramétrage de grub-pc (1.95+20080107-1) ...
Installation de la nouvelle version du fichier de
configuration /etc/grub.d/00_header ...
/usr/lib/grub/update-grub_lib: line 103: probe: command not found
Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.23-1-amd64
Found initrd image: /boot/initrd.img-2.6.23-1-amd64
done
after dpkg-reocnfigure grub-pc
dpkg-reconfigure grub-pc
/usr/lib/grub/update-grub_lib: line 103: probe: command not found
Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.23-1-amd64
Found initrd image: /boot/initrd.img-2.6.23-1-amd64
done
seems that ${grub-probe} = probe ?
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
0 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-09 13:50 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 501 bytes --]
Le mercredi 09 janvier 2008 à 14:40 +0100, Martin Braure de Calignon a
écrit :
> /usr/lib/grub/update-grub_lib: line 103: probe: command not found
> Updating /boot/grub/grub.cfg ...
> Found linux image: /boot/vmlinuz-2.6.23-1-amd64
> Found initrd image: /boot/initrd.img-2.6.23-1-amd64
> done
GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac
on this line change ${grub-probe} ${grub_probe}
now I reboot to see if it works
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 11:41 ` Robert Millan
2008-01-09 13:36 ` Jan Nieuwenhuizen
2008-01-09 13:40 ` Martin Braure de Calignon
@ 2008-01-09 13:56 ` Martin Braure de Calignon
2008-01-09 14:34 ` Robert Millan
2 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-09 13:56 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 96 bytes --]
Is it normal ?
> grub-probe /usr
> ext2
and not lvm :-/
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 13:07 ` Jan Nieuwenhuizen
@ 2008-01-09 14:29 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-09 14:29 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 02:07:20PM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > The problem with that is it can't really solve the problem, only provide a
> > half-baked solution. If you include pc and gpt, you're misusing space in
> > a component where it's really critical, and you still don't support all
> > partitions GRUB might be installed on. For that, you'd have to load _all_
> > partition maps, which means even more space.
>
> I understand, and I've been wondering about this. As I do not have much
> if any knowledge for the sizing constraints of a bootloader, so I cannot
> appreciate the efforts of reducing space.
The mission of core.img is being able to access /boot/grub, from where you can
load anything you want. It has to be as small as possible, because if it won't
fit in partition boot record, this can be a significant inconvenient.
Ironicaly, the big problem is for LVM/RAID users themselves:
if (must_embed && !able_to_embed)
grub_util_error ("Can't embed the core image, but this is required when\n"
"the root device is on a RAID array or LVM volume.");
> As a (blonde) user,
Uhm how is the color of your hear related to this? :-)
> I would think that you'd want to use *as much*
> rather than as little space you can. Why not (from a sizing pov,
> stability could be another issue), after core.img contains
> all necessary modules, fill up any `remaining' space (if that is how it
> works) with extra non-essential modules? Little harm in the ability
> to read more devices, I would say?
No, the goal in core.img is not to provide useful features, just access
/boot/grub. It has to be as small as possible. The smaller, the more
chances it'll work.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 13:36 ` Jan Nieuwenhuizen
@ 2008-01-09 14:32 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-09 14:32 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 02:36:28PM +0100, Jan Nieuwenhuizen wrote:
> Robert Millan writes:
>
> > I reworked and cleaned up the patch a bit. Please, can you test this one?
>
> This has lvm after biosdisk, which looks ok.
>
> grub-mkimage --output=/boot/grub/core.img --prefix=/tmp/boot/grub ext2 biosdisk lvm _chain
>
> Haven't boot-tested this yet, but should be ok.
That's fine. You could also test `update-grub' though. Well, not you, someone
who has LVM in /usr but not in /boot.
> Btw, I'm editing grub-install all the time to not really install, what about a
> --dry-run option? (patch against your version attached)
Not sure what will others think, but I don't see this as something useful
enough for the general user to justify the added complexity.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-09 14:34 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 02:56:42PM +0100, Martin Braure de Calignon wrote:
> Is it normal ?
>
> > grub-probe /usr
> > ext2
>
> and not lvm :-/
Yes, the default is "-t fs". Try with "-t abstraction".
Did my patch work?
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-09 14:34 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 02:50:20PM +0100, Martin Braure de Calignon wrote:
> GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac
>
>
> on this line change ${grub-probe} ${grub_probe}
Thanks
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
2008-01-09 14:34 ` Robert Millan
@ 2008-01-09 14:55 ` Martin Braure de Calignon
2008-01-09 15:36 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-09 14:55 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1.1: Type: text/plain, Size: 801 bytes --]
Le mercredi 09 janvier 2008 à 15:34 +0100, Robert Millan a écrit :
> On Wed, Jan 09, 2008 at 02:50:20PM +0100, Martin Braure de Calignon wrote:
> > GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac
> >
> >
> > on this line change ${grub-probe} ${grub_probe}
>
> Thanks
It didn't work because I only do a dpkg -i grub-pc_*.deb and the old
conf-files still exists..
But I have removed all my /etc/grub.d/ then do a dpkg with
--force-confmiss
Here's my grub.cfg in attachement. I don't see any insmod lvm :-/
Did I missed something ? I didn't reboot yet. If you think everything is
ok, I'll try to reboot. But I have apply the first page you gave us
(with modification in kern.c to insmod lvm on normal module loading)
--
Martin Braure de Calignon
[-- Attachment #1.2: grub.cfg --]
[-- Type: text/plain, Size: 1070 bytes --]
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,9)
font (mainvg-usr)/share/grub/unicode.pff
terminal console
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64" {
linux (hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro noapictimer splash vga=792 quiet
initrd (hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.23-1-amd64 (single-user mode)" {
linux (hd0,9)/boot/vmlinuz-2.6.23-1-amd64 root=/dev/hda9 ro single noapictimer splash vga=792 quiet
initrd (hd0,9)/boot/initrd.img-2.6.23-1-amd64
}
### END /etc/grub.d/10_linux ###
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-09 15:36 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jan 09, 2008 at 03:55:18PM +0100, Martin Braure de Calignon wrote:
>
> Le mercredi 09 janvier 2008 à 15:34 +0100, Robert Millan a écrit :
> > On Wed, Jan 09, 2008 at 02:50:20PM +0100, Martin Braure de Calignon wrote:
> > > GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub-probe} -t abstrac
> > >
> > >
> > > on this line change ${grub-probe} ${grub_probe}
> >
> > Thanks
>
> It didn't work because I only do a dpkg -i grub-pc_*.deb and the old
> conf-files still exists..
> But I have removed all my /etc/grub.d/ then do a dpkg with
> --force-confmiss
>
> Here's my grub.cfg in attachement. I don't see any insmod lvm :-/
There should be one. Can you find out why 00_header is not echoing it?
> (with modification in kern.c to insmod lvm on normal module loading)
Please discard that, my latest patch obsoletes it.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] force load of lvm and raid before entering normal mode (Re: LVM on debian)
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
0 siblings, 1 reply; 62+ messages in thread
From: Martin Braure de Calignon @ 2008-01-09 16:27 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
Le mercredi 09 janvier 2008 à 16:36 +0100, Robert Millan a écrit :
> There should be one. Can you find out why 00_header is not echoing it?
because font_path is never called ?
with font_path under update-grub_lib in 00headers it works
--
Martin Braure de Calignon
[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
2008-01-09 16:27 ` Martin Braure de Calignon
@ 2008-01-09 23:49 ` Robert Millan
2008-01-10 12:43 ` Robert Millan
2008-01-10 13:24 ` Jan Nieuwenhuizen
0 siblings, 2 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-09 23:49 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]
I just installed an LVM test system to debug this.
On Wed, Jan 09, 2008 at 05:27:37PM +0100, Martin Braure de Calignon wrote:
>
> Le mercredi 09 janvier 2008 à 16:36 +0100, Robert Millan a écrit :
>
> > There should be one. Can you find out why 00_header is not echoing it?
>
> because font_path is never called ?
It was; the problem had to do with the variable not being exported.
I'm proposing the attached patch for commit (ChangeLog entry in patch header).
This fixes the two known problems regarding load of lvm/raid modules. I found
other two issues with lvm in runtime, which I just committed since the fix was
one-liner.
The remaining known problem is detecting partmap; I'll probably find time to do
that one too, but I'll need to know how can one obtain a machine-parseable
list of physical devices that conform an LVM virtual device (and the same for
software RAID).
--
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: 18032 bytes --]
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
(grub_util_get_grub_dev): Add `dev_abstraction' parameter.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-emu.c (main): Update calls to grub_util_get_grub_dev()
with new `dev_abstraction' parameter.
* util/i386/pc/grub-setup.c (main): Likewise.
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
diff -urp grub2/include/grub/util/getroot.h lvm/include/grub/util/getroot.h
--- grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
+++ lvm/include/grub/util/getroot.h 2008-01-10 00:30:16.000000000 +0100
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,8 +19,16 @@
#ifndef GRUB_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
+enum grub_dev_abstraction_types {
+ GRUB_DEV_ABSTRACTION_NONE,
+ GRUB_DEV_ABSTRACTION_LVM,
+ GRUB_DEV_ABSTRACTION_RAID,
+ GRUB_DEV_ABSTRACTION_UNKNOWN,
+};
+
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);
+int grub_util_get_dev_abstraction (const char *os_dev);
+char *grub_util_get_grub_dev (const int dev_abstraction, const char *os_dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
diff -urp grub2/util/getroot.c lvm/util/getroot.c
--- grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
+++ lvm/util/getroot.c 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
/* getroot.c - Get root device */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <grub/util/misc.h>
#include <grub/util/biosdisk.h>
+#include <grub/util/getroot.h>
static void
strip_extra_slashes (char *dir)
@@ -239,27 +240,45 @@ grub_guess_root_device (const char *dir)
return os_dev;
}
-char *
-grub_util_get_grub_dev (const char *os_dev)
+int
+grub_util_get_dev_abstraction (const char *os_dev)
{
/* Check for LVM. */
if (!strncmp (os_dev, "/dev/mapper/", 12))
- {
- char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
-
- strcpy (grub_dev, os_dev+12);
-
- return grub_dev;
- }
+ return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */
if (!strncmp (os_dev, "/dev/md", 7))
+ return GRUB_DEV_ABSTRACTION_RAID;
+
+ /* No abstraction found. */
+ return GRUB_DEV_ABSTRACTION_NONE;
+}
+
+char *
+grub_util_get_grub_dev (int abstraction, const char *os_dev)
+{
+ char *grub_dev;
+
+ if (abstraction == GRUB_DEV_ABSTRACTION_UNKNOWN)
+ abstraction = grub_util_get_dev_abstraction (os_dev);
+
+ switch (abstraction)
{
- const char *p;
- char *grub_dev = xmalloc (20);
+ case GRUB_DEV_ABSTRACTION_LVM:
+ grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
+
+ strcpy (grub_dev, os_dev + 12);
+
+ break;
+
+ case GRUB_DEV_ABSTRACTION_RAID:
+ grub_dev = xmalloc (20);
if (os_dev[7] == '_' && os_dev[8] == 'd')
{
+ const char *p;
+
/* This a partitionable RAID device of the form /dev/md_dNNpMM. */
int i;
@@ -297,17 +316,17 @@ grub_util_get_grub_dev (const char *os_d
}
else if (os_dev[7] >= '0' && os_dev[7] <= '9')
{
- p = os_dev + 5;
- memcpy (grub_dev, p, 7);
+ memcpy (grub_dev, os_dev + 5, 7);
grub_dev[7] = '\0';
}
else
grub_util_error ("Unknown kind of RAID device `%s'", os_dev);
+ break;
- return grub_dev;
+ default: /* GRUB_DEV_ABSTRACTION_NONE */
+ grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
}
- /* If it's not RAID or LVM, it should be a biosdisk. */
- return grub_util_biosdisk_get_grub_dev (os_dev);
+ return grub_dev;
}
diff -urp grub2/util/grub.d/00_header.in lvm/util/grub.d/00_header.in
--- grub2/util/grub.d/00_header.in 2007-07-22 01:32:31.000000000 +0200
+++ lvm/util/grub.d/00_header.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# update-grub helper script.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@ platform=@platform@
# for convert_system_path_to_grub_path()
. ${libdir}/grub/update-grub_lib
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+ echo "insmod $i"
+done
+
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
diff -urp grub2/util/grub-emu.c lvm/util/grub-emu.c
--- grub2/util/grub-emu.c 2007-08-02 19:24:06.000000000 +0200
+++ lvm/util/grub-emu.c 2008-01-10 00:30:16.000000000 +0100
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -186,7 +186,7 @@ main (int argc, char *argv[])
if (! device_name)
grub_util_error ("cannot find a device for %s.\n", args.dir ? : DEFAULT_DIRECTORY);
- args.root_dev = grub_util_get_grub_dev (device_name);
+ args.root_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, device_name);
if (! args.root_dev)
{
grub_util_info ("guessing the root device failed, because of `%s'",
diff -urp grub2/util/grub-probe.c lvm/util/grub-probe.c
--- grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
+++ lvm/util/grub-probe.c 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
/* grub-probe.c - probe device information for a given path */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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_ABSTRACTION,
+};
int print = PRINT_FS;
@@ -74,6 +77,7 @@ probe (const char *path)
{
char *device_name;
char *drive_name = NULL;
+ int abstraction_type;
grub_device_t dev;
grub_fs_t fs;
@@ -87,7 +91,29 @@ probe (const char *path)
goto end;
}
- drive_name = grub_util_get_grub_dev (device_name);
+ abstraction_type = grub_util_get_dev_abstraction (device_name);
+ /* No need to check for errors; lack of abstraction is permissible. */
+
+ if (print == PRINT_ABSTRACTION)
+ {
+ char *abstraction_name;
+ switch (abstraction_type)
+ {
+ case GRUB_DEV_ABSTRACTION_NONE:
+ grub_util_info ("did not find LVM/RAID in %s, assuming raw device", device_name);
+ goto end;
+ case GRUB_DEV_ABSTRACTION_LVM:
+ abstraction_name = "lvm";
+ break;
+ case GRUB_DEV_ABSTRACTION_RAID:
+ abstraction_name = "raid";
+ break;
+ }
+ printf ("%s\n", abstraction_name);
+ goto end;
+ }
+
+ drive_name = grub_util_get_grub_dev (abstraction_type, device_name);
if (! drive_name)
grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
@@ -159,8 +185,8 @@ Usage: grub-probe [OPTION]... PATH\n\
Probe device information for a given path.\n\
\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
- -t, --target=(fs|drive|device|partmap)\n\
- print filesystem module, GRUB drive, system device or partition map module [default=fs]\n\
+ -t, --target=(fs|drive|device|partmap|abstraction)\n\
+ print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\
@@ -206,6 +232,8 @@ main (int argc, char *argv[])
print = PRINT_DEVICE;
else if (!strcmp (optarg, "partmap"))
print = PRINT_PARTMAP;
+ else if (!strcmp (optarg, "abstraction"))
+ print = PRINT_ABSTRACTION;
else
usage (1);
break;
diff -urp grub2/util/i386/efi/grub-install.in lvm/util/i386/efi/grub-install.in
--- grub2/util/i386/efi/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvm/util/i386/efi/grub-install.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your EFI partition.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -190,8 +190,11 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
$grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
diff -urp grub2/util/i386/pc/grub-install.in lvm/util/i386/pc/grub-install.in
--- grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvm/util/i386/pc/grub-install.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
diff -urp grub2/util/i386/pc/grub-setup.c lvm/util/i386/pc/grub-setup.c
--- grub2/util/i386/pc/grub-setup.c 2008-01-05 13:20:28.000000000 +0100
+++ lvm/util/i386/pc/grub-setup.c 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
/* grub-setup.c - make GRUB usable */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -668,7 +668,7 @@ main (int argc, char *argv[])
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 (GRUB_DEV_ABSTRACTION_UNKNOWN, argv[optind]);
if (! dest_dev)
{
fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
@@ -694,7 +694,7 @@ main (int argc, char *argv[])
}
else
{
- root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
+ root_dev = grub_util_get_grub_dev (GRUB_DEV_ABSTRACTION_UNKNOWN, 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 @@ main (int argc, char *argv[])
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 (GRUB_DEV_ABSTRACTION_UNKNOWN, devicelist[i]), 1);
}
free (raid_prefix);
diff -urp grub2/util/powerpc/ieee1275/grub-install.in lvm/util/powerpc/ieee1275/grub-install.in
--- grub2/util/powerpc/ieee1275/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvm/util/powerpc/ieee1275/grub-install.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -176,7 +176,10 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
-modules="$modules $fs_module $partmap_module"
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
+modules="$modules $fs_module $partmap_module $devabstraction_module"
# Now perform the installation.
"$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
diff -urp grub2/util/update-grub.in lvm/util/update-grub.in
--- grub2/util/update-grub.in 2007-12-30 09:52:06.000000000 +0100
+++ lvm/util/update-grub.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -103,7 +103,10 @@ esac
# check for terminals that require fonts
case ${GRUB_TERMINAL} in
gfxterm)
- if GRUB_FONT_PATH=`font_path` ; then : ; else
+ if path=`font_path` ; then
+ GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
+ GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
+ else
# fallback to console
GRUB_TERMINAL=console
fi
@@ -121,7 +124,7 @@ esac
# These are defined in this script, export them here so that user can
# override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
# These are optional, user-defined variables.
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
diff -urp grub2/util/update-grub_lib.in lvm/util/update-grub_lib.in
--- grub2/util/update-grub_lib.in 2007-12-25 10:09:43.000000000 +0100
+++ lvm/util/update-grub_lib.in 2008-01-10 00:30:16.000000000 +0100
@@ -1,5 +1,5 @@
# Helper library for update-grub
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
font_path ()
{
- if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
- echo "${GRUB_FONT_PATH}"
- return 0
- fi
-
# Prefer system path for space reasons (/boot/grub might be a very small
# partition in case of OpenFirmware, etc).
for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
# Prefer complete fonts over incomplete ones.
for basename in unicode unifont ascii ; do
- if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
- GRUB_FONT_PATH="${path}"
- echo "${GRUB_FONT_PATH}"
+ path="${dir}/${basename}.pff"
+ if convert_system_path_to_grub_path ${path} > /dev/null ; then
+ echo "${path}"
return 0
fi
done
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
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-10 13:24 ` Jan Nieuwenhuizen
1 sibling, 2 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-10 12:43 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
New patch, a bit simpler (after giving it a though, I don't think the gained
speed is worth the extra complication)
--
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: 15138 bytes --]
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
diff -x configure -x config.h.in -urp grub2/include/grub/util/getroot.h lvmraid/include/grub/util/getroot.h
--- grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
+++ lvmraid/include/grub/util/getroot.h 2008-01-10 13:34:40.000000000 +0100
@@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,8 +19,15 @@
#ifndef GRUB_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
+enum grub_dev_abstraction_types {
+ GRUB_DEV_ABSTRACTION_NONE,
+ GRUB_DEV_ABSTRACTION_LVM,
+ GRUB_DEV_ABSTRACTION_RAID,
+};
+
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
+int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
diff -x configure -x config.h.in -urp grub2/util/getroot.c lvmraid/util/getroot.c
--- grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
+++ lvmraid/util/getroot.c 2008-01-10 13:33:02.000000000 +0100
@@ -1,7 +1,7 @@
/* getroot.c - Get root device */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <grub/util/misc.h>
#include <grub/util/biosdisk.h>
+#include <grub/util/getroot.h>
static void
strip_extra_slashes (char *dir)
@@ -239,27 +240,42 @@ grub_guess_root_device (const char *dir)
return os_dev;
}
-char *
-grub_util_get_grub_dev (const char *os_dev)
+int
+grub_util_get_dev_abstraction (const char *os_dev)
{
/* Check for LVM. */
if (!strncmp (os_dev, "/dev/mapper/", 12))
- {
- char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
-
- strcpy (grub_dev, os_dev+12);
-
- return grub_dev;
- }
+ return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */
if (!strncmp (os_dev, "/dev/md", 7))
+ return GRUB_DEV_ABSTRACTION_RAID;
+
+ /* No abstraction found. */
+ return GRUB_DEV_ABSTRACTION_NONE;
+}
+
+char *
+grub_util_get_grub_dev (const char *os_dev)
+{
+ char *grub_dev;
+
+ switch (grub_util_get_dev_abstraction (os_dev))
{
- const char *p;
- char *grub_dev = xmalloc (20);
+ case GRUB_DEV_ABSTRACTION_LVM:
+ grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
+
+ strcpy (grub_dev, os_dev + 12);
+
+ break;
+
+ case GRUB_DEV_ABSTRACTION_RAID:
+ grub_dev = xmalloc (20);
if (os_dev[7] == '_' && os_dev[8] == 'd')
{
+ const char *p;
+
/* This a partitionable RAID device of the form /dev/md_dNNpMM. */
int i;
@@ -297,17 +313,17 @@ grub_util_get_grub_dev (const char *os_d
}
else if (os_dev[7] >= '0' && os_dev[7] <= '9')
{
- p = os_dev + 5;
- memcpy (grub_dev, p, 7);
+ memcpy (grub_dev, os_dev + 5, 7);
grub_dev[7] = '\0';
}
else
grub_util_error ("Unknown kind of RAID device `%s'", os_dev);
+ break;
- return grub_dev;
+ default: /* GRUB_DEV_ABSTRACTION_NONE */
+ grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
}
- /* If it's not RAID or LVM, it should be a biosdisk. */
- return grub_util_biosdisk_get_grub_dev (os_dev);
+ return grub_dev;
}
diff -x configure -x config.h.in -urp grub2/util/grub.d/00_header.in lvmraid/util/grub.d/00_header.in
--- grub2/util/grub.d/00_header.in 2007-07-22 01:32:31.000000000 +0200
+++ lvmraid/util/grub.d/00_header.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# update-grub helper script.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@ platform=@platform@
# for convert_system_path_to_grub_path()
. ${libdir}/grub/update-grub_lib
+# Do this as early as possible, since other commands might depend on it.
+# (e.g. the `font' command might need lvm or raid modules)
+for i in ${GRUB_PRELOAD_MODULES} ; do
+ echo "insmod $i"
+done
+
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
diff -x configure -x config.h.in -urp grub2/util/grub-probe.c lvmraid/util/grub-probe.c
--- grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
+++ lvmraid/util/grub-probe.c 2008-01-10 13:33:17.000000000 +0100
@@ -1,7 +1,7 @@
/* grub-probe.c - probe device information for a given path */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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_ABSTRACTION,
+};
int print = PRINT_FS;
@@ -74,6 +77,7 @@ probe (const char *path)
{
char *device_name;
char *drive_name = NULL;
+ int abstraction_type;
grub_device_t dev;
grub_fs_t fs;
@@ -87,6 +91,28 @@ probe (const char *path)
goto end;
}
+ abstraction_type = grub_util_get_dev_abstraction (device_name);
+ /* No need to check for errors; lack of abstraction is permissible. */
+
+ if (print == PRINT_ABSTRACTION)
+ {
+ char *abstraction_name;
+ switch (abstraction_type)
+ {
+ case GRUB_DEV_ABSTRACTION_NONE:
+ grub_util_info ("did not find LVM/RAID in %s, assuming raw device", device_name);
+ goto end;
+ case GRUB_DEV_ABSTRACTION_LVM:
+ abstraction_name = "lvm";
+ break;
+ case GRUB_DEV_ABSTRACTION_RAID:
+ abstraction_name = "raid";
+ break;
+ }
+ printf ("%s\n", abstraction_name);
+ goto end;
+ }
+
drive_name = grub_util_get_grub_dev (device_name);
if (! drive_name)
grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
@@ -159,8 +185,8 @@ Usage: grub-probe [OPTION]... PATH\n\
Probe device information for a given path.\n\
\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
- -t, --target=(fs|drive|device|partmap)\n\
- print filesystem module, GRUB drive, system device or partition map module [default=fs]\n\
+ -t, --target=(fs|drive|device|partmap|abstraction)\n\
+ print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\
@@ -206,6 +232,8 @@ main (int argc, char *argv[])
print = PRINT_DEVICE;
else if (!strcmp (optarg, "partmap"))
print = PRINT_PARTMAP;
+ else if (!strcmp (optarg, "abstraction"))
+ print = PRINT_ABSTRACTION;
else
usage (1);
break;
diff -x configure -x config.h.in -urp grub2/util/i386/efi/grub-install.in lvmraid/util/i386/efi/grub-install.in
--- grub2/util/i386/efi/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvmraid/util/i386/efi/grub-install.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your EFI partition.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -190,8 +190,11 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module _chain"
+modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
$grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
diff -x configure -x config.h.in -urp grub2/util/i386/pc/grub-install.in lvmraid/util/i386/pc/grub-install.in
--- grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvmraid/util/i386/pc/grub-install.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -223,8 +223,11 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
# _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
$grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
diff -x configure -x config.h.in -urp grub2/util/powerpc/ieee1275/grub-install.in lvmraid/util/powerpc/ieee1275/grub-install.in
--- grub2/util/powerpc/ieee1275/grub-install.in 2007-12-30 09:52:06.000000000 +0100
+++ lvmraid/util/powerpc/ieee1275/grub-install.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh
# Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -176,7 +176,10 @@ fi
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
-modules="$modules $fs_module $partmap_module"
+# Device abstraction module, if any (lvm, raid).
+devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
+
+modules="$modules $fs_module $partmap_module $devabstraction_module"
# Now perform the installation.
"$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
diff -x configure -x config.h.in -urp grub2/util/update-grub.in lvmraid/util/update-grub.in
--- grub2/util/update-grub.in 2007-12-30 09:52:06.000000000 +0100
+++ lvmraid/util/update-grub.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,7 +1,7 @@
#! /bin/sh -e
# Generate grub.cfg by inspecting /boot contents.
-# Copyright (C) 2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -103,7 +103,10 @@ esac
# check for terminals that require fonts
case ${GRUB_TERMINAL} in
gfxterm)
- if GRUB_FONT_PATH=`font_path` ; then : ; else
+ if path=`font_path` ; then
+ GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
+ GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
+ else
# fallback to console
GRUB_TERMINAL=console
fi
@@ -121,7 +124,7 @@ esac
# These are defined in this script, export them here so that user can
# override them.
-export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
+export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
# These are optional, user-defined variables.
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
diff -x configure -x config.h.in -urp grub2/util/update-grub_lib.in lvmraid/util/update-grub_lib.in
--- grub2/util/update-grub_lib.in 2007-12-25 10:09:43.000000000 +0100
+++ lvmraid/util/update-grub_lib.in 2008-01-10 12:26:16.000000000 +0100
@@ -1,5 +1,5 @@
# Helper library for update-grub
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
font_path ()
{
- if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
- echo "${GRUB_FONT_PATH}"
- return 0
- fi
-
# Prefer system path for space reasons (/boot/grub might be a very small
# partition in case of OpenFirmware, etc).
for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
# Prefer complete fonts over incomplete ones.
for basename in unicode unifont ascii ; do
- if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
- GRUB_FONT_PATH="${path}"
- echo "${GRUB_FONT_PATH}"
+ path="${dir}/${basename}.pff"
+ if convert_system_path_to_grub_path ${path} > /dev/null ; then
+ echo "${path}"
return 0
fi
done
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
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-10 13:24 ` Jan Nieuwenhuizen
1 sibling, 0 replies; 62+ messages in thread
From: Jan Nieuwenhuizen @ 2008-01-10 13:24 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan writes:
> The remaining known problem is detecting partmap; I'll probably find time to do
> that one too, but I'll need to know how can one obtain a machine-parseable
> list of physical devices that conform an LVM virtual device (and the same for
> software RAID).
pvdisplay -c
/dev/sdc2:lvmplain:976734105:-1:8:8:-1:4096:119230:59615:59615:ZvABzO-Tzzz-v5ho-r9pG-RTz5-DEEB-sWlM7G
/dev/md0:lvmraid:619514368:-1:8:8:-1:4096:75624:44904:30720:6AGq0k-ldg0-yswb-ft3W-LG1b-nuIe-40Mcl7
Jan.
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
2008-01-10 12:43 ` Robert Millan
@ 2008-01-12 15:10 ` Robert Millan
2008-01-15 11:23 ` Marco Gerards
1 sibling, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-12 15:10 UTC (permalink / raw)
To: The development of GRUB 2
Committed.
On Thu, Jan 10, 2008 at 01:43:17PM +0100, Robert Millan wrote:
>
> New patch, a bit simpler (after giving it a though, I don't think the gained
> speed is worth the extra complication)
>
> --
> 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 /.)
>
> * include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
> (grub_util_get_dev_abstraction): New function prototype.
>
> * util/getroot.c: Include `<grub/util/getroot.h>'
> (grub_util_get_grub_dev): Move detection of abstraction type to ...
> (grub_util_get_dev_abstraction): ... here (new function).
>
> * util/grub-probe.c: Convert PRINT_* to an enum. Add
> `PRINT_ABSTRACTION'.
> (probe): Probe for abstraction type when requested.
> (main): Understand `--target=abstraction'.
>
> * util/i386/efi/grub-install.in: Add abstraction module to core
> image when it is found to be necessary.
> * util/i386/pc/grub-install.in: Likewise.
> * util/powerpc/ieee1275/grub-install.in: Likewise.
>
> * util/update-grub_lib.in (font_path): Return system path without
> converting to GRUB path.
> * util/update-grub.in: Convert system path returned by font_path()
> to a GRUB path. Use `grub-probe -t abstraction' to determine what
> abstraction module is needed for loading fonts (if any). Export
> that as `GRUB_PRELOAD_MODULES'.
> * util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
> insmod commands).
>
> diff -x configure -x config.h.in -urp grub2/include/grub/util/getroot.h lvmraid/include/grub/util/getroot.h
> --- grub2/include/grub/util/getroot.h 2007-07-22 01:32:25.000000000 +0200
> +++ lvmraid/include/grub/util/getroot.h 2008-01-10 13:34:40.000000000 +0100
> @@ -1,6 +1,6 @@
> /*
> * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2003, 2007 Free Software Foundation, Inc.
> + * Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
> *
> * GRUB is free software: you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -19,8 +19,15 @@
> #ifndef GRUB_UTIL_GETROOT_HEADER
> #define GRUB_UTIL_GETROOT_HEADER 1
>
> +enum grub_dev_abstraction_types {
> + GRUB_DEV_ABSTRACTION_NONE,
> + GRUB_DEV_ABSTRACTION_LVM,
> + GRUB_DEV_ABSTRACTION_RAID,
> +};
> +
> char *grub_guess_root_device (const char *dir);
> char *grub_get_prefix (const char *dir);
> +int grub_util_get_dev_abstraction (const char *os_dev);
> char *grub_util_get_grub_dev (const char *os_dev);
>
> #endif /* ! GRUB_UTIL_GETROOT_HEADER */
> diff -x configure -x config.h.in -urp grub2/util/getroot.c lvmraid/util/getroot.c
> --- grub2/util/getroot.c 2007-07-22 01:32:31.000000000 +0200
> +++ lvmraid/util/getroot.c 2008-01-10 13:33:02.000000000 +0100
> @@ -1,7 +1,7 @@
> /* getroot.c - Get root device */
> /*
> * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 1999,2000,2001,2002,2003,2006,2007 Free Software Foundation, Inc.
> + * Copyright (C) 1999,2000,2001,2002,2003,2006,2007,2008 Free Software Foundation, Inc.
> *
> * GRUB is free software: you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -24,6 +24,7 @@
>
> #include <grub/util/misc.h>
> #include <grub/util/biosdisk.h>
> +#include <grub/util/getroot.h>
>
> static void
> strip_extra_slashes (char *dir)
> @@ -239,27 +240,42 @@ grub_guess_root_device (const char *dir)
> return os_dev;
> }
>
> -char *
> -grub_util_get_grub_dev (const char *os_dev)
> +int
> +grub_util_get_dev_abstraction (const char *os_dev)
> {
> /* Check for LVM. */
> if (!strncmp (os_dev, "/dev/mapper/", 12))
> - {
> - char *grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
> -
> - strcpy (grub_dev, os_dev+12);
> -
> - return grub_dev;
> - }
> + return GRUB_DEV_ABSTRACTION_LVM;
>
> /* Check for RAID. */
> if (!strncmp (os_dev, "/dev/md", 7))
> + return GRUB_DEV_ABSTRACTION_RAID;
> +
> + /* No abstraction found. */
> + return GRUB_DEV_ABSTRACTION_NONE;
> +}
> +
> +char *
> +grub_util_get_grub_dev (const char *os_dev)
> +{
> + char *grub_dev;
> +
> + switch (grub_util_get_dev_abstraction (os_dev))
> {
> - const char *p;
> - char *grub_dev = xmalloc (20);
> + case GRUB_DEV_ABSTRACTION_LVM:
> + grub_dev = xmalloc (strlen (os_dev) - 12 + 1);
> +
> + strcpy (grub_dev, os_dev + 12);
> +
> + break;
> +
> + case GRUB_DEV_ABSTRACTION_RAID:
> + grub_dev = xmalloc (20);
>
> if (os_dev[7] == '_' && os_dev[8] == 'd')
> {
> + const char *p;
> +
> /* This a partitionable RAID device of the form /dev/md_dNNpMM. */
> int i;
>
> @@ -297,17 +313,17 @@ grub_util_get_grub_dev (const char *os_d
> }
> else if (os_dev[7] >= '0' && os_dev[7] <= '9')
> {
> - p = os_dev + 5;
> - memcpy (grub_dev, p, 7);
> + memcpy (grub_dev, os_dev + 5, 7);
> grub_dev[7] = '\0';
> }
> else
> grub_util_error ("Unknown kind of RAID device `%s'", os_dev);
>
> + break;
>
> - return grub_dev;
> + default: /* GRUB_DEV_ABSTRACTION_NONE */
> + grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
> }
>
> - /* If it's not RAID or LVM, it should be a biosdisk. */
> - return grub_util_biosdisk_get_grub_dev (os_dev);
> + return grub_dev;
> }
> diff -x configure -x config.h.in -urp grub2/util/grub.d/00_header.in lvmraid/util/grub.d/00_header.in
> --- grub2/util/grub.d/00_header.in 2007-07-22 01:32:31.000000000 +0200
> +++ lvmraid/util/grub.d/00_header.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,7 +1,7 @@
> #! /bin/sh -e
>
> # update-grub helper script.
> -# Copyright (C) 2006,2007 Free Software Foundation, Inc.
> +# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -24,6 +24,12 @@ platform=@platform@
> # for convert_system_path_to_grub_path()
> . ${libdir}/grub/update-grub_lib
>
> +# Do this as early as possible, since other commands might depend on it.
> +# (e.g. the `font' command might need lvm or raid modules)
> +for i in ${GRUB_PRELOAD_MODULES} ; do
> + echo "insmod $i"
> +done
> +
> if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
> if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
>
> diff -x configure -x config.h.in -urp grub2/util/grub-probe.c lvmraid/util/grub-probe.c
> --- grub2/util/grub-probe.c 2007-07-22 21:17:26.000000000 +0200
> +++ lvmraid/util/grub-probe.c 2008-01-10 13:33:17.000000000 +0100
> @@ -1,7 +1,7 @@
> /* grub-probe.c - probe device information for a given path */
> /*
> * GRUB -- GRand Unified Bootloader
> - * Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
> + * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
> *
> * GRUB is free software: you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -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_ABSTRACTION,
> +};
>
> int print = PRINT_FS;
>
> @@ -74,6 +77,7 @@ probe (const char *path)
> {
> char *device_name;
> char *drive_name = NULL;
> + int abstraction_type;
> grub_device_t dev;
> grub_fs_t fs;
>
> @@ -87,6 +91,28 @@ probe (const char *path)
> goto end;
> }
>
> + abstraction_type = grub_util_get_dev_abstraction (device_name);
> + /* No need to check for errors; lack of abstraction is permissible. */
> +
> + if (print == PRINT_ABSTRACTION)
> + {
> + char *abstraction_name;
> + switch (abstraction_type)
> + {
> + case GRUB_DEV_ABSTRACTION_NONE:
> + grub_util_info ("did not find LVM/RAID in %s, assuming raw device", device_name);
> + goto end;
> + case GRUB_DEV_ABSTRACTION_LVM:
> + abstraction_name = "lvm";
> + break;
> + case GRUB_DEV_ABSTRACTION_RAID:
> + abstraction_name = "raid";
> + break;
> + }
> + printf ("%s\n", abstraction_name);
> + goto end;
> + }
> +
> drive_name = grub_util_get_grub_dev (device_name);
> if (! drive_name)
> grub_util_error ("cannot find a GRUB drive for %s.\n", device_name);
> @@ -159,8 +185,8 @@ Usage: grub-probe [OPTION]... PATH\n\
> Probe device information for a given path.\n\
> \n\
> -m, --device-map=FILE use FILE as the device map [default=%s]\n\
> - -t, --target=(fs|drive|device|partmap)\n\
> - print filesystem module, GRUB drive, system device or partition map module [default=fs]\n\
> + -t, --target=(fs|drive|device|partmap|abstraction)\n\
> + print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\
> -h, --help display this message and exit\n\
> -V, --version print version information and exit\n\
> -v, --verbose print verbose messages\n\
> @@ -206,6 +232,8 @@ main (int argc, char *argv[])
> print = PRINT_DEVICE;
> else if (!strcmp (optarg, "partmap"))
> print = PRINT_PARTMAP;
> + else if (!strcmp (optarg, "abstraction"))
> + print = PRINT_ABSTRACTION;
> else
> usage (1);
> break;
> diff -x configure -x config.h.in -urp grub2/util/i386/efi/grub-install.in lvmraid/util/i386/efi/grub-install.in
> --- grub2/util/i386/efi/grub-install.in 2007-12-30 09:52:06.000000000 +0100
> +++ lvmraid/util/i386/efi/grub-install.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,7 +1,7 @@
> #! /bin/sh
>
> # Install GRUB on your EFI partition.
> -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
> +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -190,8 +190,11 @@ fi
> # filesystem will be accessible).
> partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
>
> +# Device abstraction module, if any (lvm, raid).
> +devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
> +
> # _chain is often useful
> -modules="$modules $fs_module $partmap_module _chain"
> +modules="$modules $fs_module $partmap_module $devabstraction_module _chain"
>
> $grub_mkimage --output=${grubdir}/grub.efi $modules || exit 1
>
> diff -x configure -x config.h.in -urp grub2/util/i386/pc/grub-install.in lvmraid/util/i386/pc/grub-install.in
> --- grub2/util/i386/pc/grub-install.in 2007-12-30 09:52:06.000000000 +0100
> +++ lvmraid/util/i386/pc/grub-install.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,7 +1,7 @@
> #! /bin/sh
>
> # Install GRUB on your drive.
> -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
> +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -223,8 +223,11 @@ fi
> # filesystem will be accessible).
> partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
>
> +# Device abstraction module, if any (lvm, raid).
> +devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
> +
> # _chain is often useful
> -modules="$modules $fs_module $partmap_module biosdisk _chain"
> +modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
>
> $grub_mkimage --output=${grubdir}/core.img --prefix=`make_system_path_relative_to_its_root ${grubdir}` $modules || exit 1
>
> diff -x configure -x config.h.in -urp grub2/util/powerpc/ieee1275/grub-install.in lvmraid/util/powerpc/ieee1275/grub-install.in
> --- grub2/util/powerpc/ieee1275/grub-install.in 2007-12-30 09:52:06.000000000 +0100
> +++ lvmraid/util/powerpc/ieee1275/grub-install.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,7 +1,7 @@
> #! /bin/sh
>
> # Install GRUB on your drive.
> -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
> +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -176,7 +176,10 @@ fi
> # filesystem will be accessible).
> partmap_module=`$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`
>
> -modules="$modules $fs_module $partmap_module"
> +# Device abstraction module, if any (lvm, raid).
> +devabstraction_module=`$grub_probe --target=abstraction --device-map=${device_map} ${grubdir}`
> +
> +modules="$modules $fs_module $partmap_module $devabstraction_module"
>
> # Now perform the installation.
> "$grub_mkimage" --output=${grubdir}/grub $modules || exit 1
> diff -x configure -x config.h.in -urp grub2/util/update-grub.in lvmraid/util/update-grub.in
> --- grub2/util/update-grub.in 2007-12-30 09:52:06.000000000 +0100
> +++ lvmraid/util/update-grub.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,7 +1,7 @@
> #! /bin/sh -e
>
> # Generate grub.cfg by inspecting /boot contents.
> -# Copyright (C) 2006,2007 Free Software Foundation, Inc.
> +# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -103,7 +103,10 @@ esac
> # check for terminals that require fonts
> case ${GRUB_TERMINAL} in
> gfxterm)
> - if GRUB_FONT_PATH=`font_path` ; then : ; else
> + if path=`font_path` ; then
> + GRUB_FONT_PATH="`convert_system_path_to_grub_path ${path}`"
> + GRUB_PRELOAD_MODULES="`${GRUB_PRELOAD_MODULES} ${grub_probe} -t abstraction ${path}`"
> + else
> # fallback to console
> GRUB_TERMINAL=console
> fi
> @@ -121,7 +124,7 @@ esac
>
> # These are defined in this script, export them here so that user can
> # override them.
> -export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
> +export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
>
> # These are optional, user-defined variables.
> export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
> diff -x configure -x config.h.in -urp grub2/util/update-grub_lib.in lvmraid/util/update-grub_lib.in
> --- grub2/util/update-grub_lib.in 2007-12-25 10:09:43.000000000 +0100
> +++ lvmraid/util/update-grub_lib.in 2008-01-10 12:26:16.000000000 +0100
> @@ -1,5 +1,5 @@
> # Helper library for update-grub
> -# Copyright (C) 2007 Free Software Foundation, Inc.
> +# Copyright (C) 2007,2008 Free Software Foundation, Inc.
> #
> # GRUB is free software: you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -93,19 +93,14 @@ convert_system_path_to_grub_path ()
>
> font_path ()
> {
> - if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
> - echo "${GRUB_FONT_PATH}"
> - return 0
> - fi
> -
> # Prefer system path for space reasons (/boot/grub might be a very small
> # partition in case of OpenFirmware, etc).
> for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
> # Prefer complete fonts over incomplete ones.
> for basename in unicode unifont ascii ; do
> - if path=`convert_system_path_to_grub_path ${dir}/${basename}.pff` ; then
> - GRUB_FONT_PATH="${path}"
> - echo "${GRUB_FONT_PATH}"
> + path="${dir}/${basename}.pff"
> + if convert_system_path_to_grub_path ${path} > /dev/null ; then
> + echo "${path}"
> return 0
> fi
> done
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
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
1 sibling, 1 reply; 62+ messages in thread
From: Marco Gerards @ 2008-01-15 11:23 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
> New patch, a bit simpler (after giving it a though, I don't think the gained
> speed is worth the extra complication)
What does this patch fix? Too many problems in one thread...
BTW, does it also work for the case both LVM and RAID are used?
--
Marco
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
2008-01-15 11:23 ` Marco Gerards
@ 2008-01-15 11:56 ` Robert Millan
2008-01-15 12:17 ` Marco Gerards
0 siblings, 1 reply; 62+ messages in thread
From: Robert Millan @ 2008-01-15 11:56 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 15, 2008 at 12:23:19PM +0100, Marco Gerards wrote:
> Robert Millan <rmh@aybabtu.com> writes:
>
> > New patch, a bit simpler (after giving it a though, I don't think the gained
> > speed is worth the extra complication)
>
> What does this patch fix? Too many problems in one thread...
It fixes loading of lvm/raid modules in two situations:
- In core.img, by grub-install, when they're needed to access /boot.
This is still not enough to get it working due to another bug
(detection of partmap).
- In grub.cfg, by update-grub, when they're needed to access /usr
for the font file.
> BTW, does it also work for the case both LVM and RAID are used?
No, for that we need to handle recursion in grub-probe, which is the same
we'll need to get partmap detection working on lvm/raid.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
2008-01-15 11:56 ` Robert Millan
@ 2008-01-15 12:17 ` Marco Gerards
2008-01-15 12:27 ` Robert Millan
0 siblings, 1 reply; 62+ messages in thread
From: Marco Gerards @ 2008-01-15 12:17 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
> On Tue, Jan 15, 2008 at 12:23:19PM +0100, Marco Gerards wrote:
>> Robert Millan <rmh@aybabtu.com> writes:
>>
>> > New patch, a bit simpler (after giving it a though, I don't think the gained
>> > speed is worth the extra complication)
>>
>> What does this patch fix? Too many problems in one thread...
>
> It fixes loading of lvm/raid modules in two situations:
>
> - In core.img, by grub-install, when they're needed to access /boot.
> This is still not enough to get it working due to another bug
> (detection of partmap).
>
> - In grub.cfg, by update-grub, when they're needed to access /usr
> for the font file.
Oh, great. Why can't this font be put in /boot/grub? Using /usr can
mean we need: raid, lvm, fshelp, a fs and a partitioning scheme module
in addition to what we need to access /boot.
>> BTW, does it also work for the case both LVM and RAID are used?
>
> No, for that we need to handle recursion in grub-probe, which is the same
> we'll need to get partmap detection working on lvm/raid.
You are working on this? Or is this bug documented?
--
Marco
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: LVM on debian
2008-01-08 14:27 ` Robert Millan
@ 2008-01-15 12:18 ` Marco Gerards
0 siblings, 0 replies; 62+ messages in thread
From: Marco Gerards @ 2008-01-15 12:18 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
> On Tue, Jan 08, 2008 at 09:18:47PM +0800, Bean wrote:
>> On Jan 8, 2008 9:14 PM, Robert Millan <rmh@aybabtu.com> wrote:
>> >
>> > On Tue, Jan 08, 2008 at 09:06:41PM +0800, Bean wrote:
>> > > On Jan 8, 2008 9:00 PM, Martin Braure de Calignon <braurede@free.fr> wrote:
>> > > >
>> > > > On mar, 2008-01-08 at 13:13 +0100, Robert Millan wrote:
>> > > > > Ok, so you have fonts. What are the color settings? (run "set" and check
>> > > > > for menu_color_* variables)
>> > > > set gives the following output :
>> > > > ?=1
>> > >
>> > > Here is the problem ! Some command return error code, then the script
>> > > is not parsed correctly. this problem can be fixed by my parser patch.
>> >
>> > Ugh.. I forgot about that one. Will you check it in soon?
>>
>> should i wait for macro to check it first ?
>
> I don't know. You can try mailing him directly.
>
> Anyway, if you did something wrong we can always revert it.
This patch was reviewed.
--
Marco
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH] fix `lvm' and `raid' loading for grub-install/core.img and update-grub/grub.cfg problems
2008-01-15 12:17 ` Marco Gerards
@ 2008-01-15 12:27 ` Robert Millan
0 siblings, 0 replies; 62+ messages in thread
From: Robert Millan @ 2008-01-15 12:27 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Jan 15, 2008 at 01:17:31PM +0100, Marco Gerards wrote:
> Robert Millan <rmh@aybabtu.com> writes:
>
> > On Tue, Jan 15, 2008 at 12:23:19PM +0100, Marco Gerards wrote:
> >> Robert Millan <rmh@aybabtu.com> writes:
> >>
> >> > New patch, a bit simpler (after giving it a though, I don't think the gained
> >> > speed is worth the extra complication)
> >>
> >> What does this patch fix? Too many problems in one thread...
> >
> > It fixes loading of lvm/raid modules in two situations:
> >
> > - In core.img, by grub-install, when they're needed to access /boot.
> > This is still not enough to get it working due to another bug
> > (detection of partmap).
> >
> > - In grub.cfg, by update-grub, when they're needed to access /usr
> > for the font file.
>
> Oh, great. Why can't this font be put in /boot/grub? Using /usr can
> mean we need: raid, lvm, fshelp, a fs and a partitioning scheme module
> in addition to what we need to access /boot.
/boot/grub might be a mount point for a small storage device, and so big
stuff like fonts might not fit (I got reports of this happening in Debian
BTS).
> >> BTW, does it also work for the case both LVM and RAID are used?
> >
> > No, for that we need to handle recursion in grub-probe, which is the same
> > we'll need to get partmap detection working on lvm/raid.
>
> You are working on this?
No, although I thought a bit about it and how to solve it.
> Or is this bug documented?
Maybe we have something buried deep in Debian BTS. It might take more time
to find it than to fix the bug, though ;-)
The problem is like: When LVM is based on physical partitions that belong
to a pc or gpt table, "grub-probe -t partmap /some/lvmed/mntpoint" won't work.
--
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 /.)
^ permalink raw reply [flat|nested] 62+ messages in thread
end of thread, other threads:[~2008-01-15 12:29 UTC | newest]
Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.