Skip to contentSkip to conversation

Broken common.rmk change

DISCUSSION David Miller 6 participants 19 messages Dec 6, 2009 – Dec 24, 2009

lore
Share & tools
lore
#0 lore raw

Robert, the set of objects used to build grub-mkdevicemap on sparc64-ieee1275 is not the same as those used on other architectures. So this change was not correct:

2009-11-26 Robert Millan <[email protected]>

* conf/common.rmk (sbin_UTILITIES): Add `grub-mkdevicemap'.
...
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-mkdevicemap'. (grub_mkdevicemap_SOURCES): Remove.
...
* conf/sparc64-ieee1275.rmk: Likewise.

In particular, we use a special implementation devicemap.c on sparc64-ieee1275 so that openfirmware device nodes are emitted instead of "hd0" et al.

So when you moved the build rule into common.rmk you broke this.

This is probably the primary reason that the current tree works for nobody on sparc64 :-)

Before I found this problem, I tested with an existing devicemap and config file on a Niagara LDOM Linux guest and current trunk worked as well as it did when I was last active several months ago and I was able to boot Linux kernels with it.

#1 lore raw
Quoted 20 lines · David Miller

Robert, the set of objects used to build grub-mkdevicemap on sparc64-ieee1275 is not the same as those used on other architectures. So this change was not correct:

2009-11-26 Robert Millan <[email protected]>

* conf/common.rmk (sbin_UTILITIES): Add `grub-mkdevicemap'.
...
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-mkdevicemap'. (grub_mkdevicemap_SOURCES): Remove.
...
* conf/sparc64-ieee1275.rmk: Likewise.

In particular, we use a special implementation devicemap.c on sparc64-ieee1275 so that openfirmware device nodes are emitted instead of "hd0" et al.

So when you moved the build rule into common.rmk you broke this.

Quoted 7 lines

This is probably the primary reason that the current tree works for nobody on sparc64 :-)

Before I found this problem, I tested with an existing devicemap and config file on a Niagara LDOM Linux guest and current trunk worked as well as it did when I was last active several months ago and I was able to boot Linux kernels with it.

We're actually in the process of getting rid of device.map; in fact the "hd0" names you see have no real effect on i386-pc, they're just ignored.

We now have more robust code that doesn't hardcode drive names. grub-setup now accepts plain system devices as arguments, even if they're not listed in device.map. grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

But I might have missed some detail. Is there a peculiarity of sparc64-ieee1275 that makes this approach unpractical?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 1 line

We're actually in the process of getting rid of device.map;

Meanwhile, please fix the regression you added to the tree. :-)

And I'll look into what you've mentioned to see if that kind of scheme will work properly on Sparc.

#3 lore raw
Quoted 6 lines · David Miller

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 1 line

We're actually in the process of getting rid of device.map;

Meanwhile, please fix the regression you added to the tree. :-)

I think this should do it. Please can you test?

Quoted 2 lines

And I'll look into what you've mentioned to see if that kind of scheme will work properly on Sparc.

Thanks!

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

=== modified file 'conf/common.rmk'

common.rmk +7 -1
@@ -3,7 +3,13 @@
 sbin_UTILITIES += grub-mkdevicemap
 grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
 	util/deviceiter.c \
-	util/devicemap.c util/misc.c
+	util/misc.c
+
+ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
+grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
+else
+grub_mkdevicemap_SOURCES += util/devicemap.c
+endif
 
 # For grub-mkelfimage.
 bin_UTILITIES += grub-mkelfimage
#4 lore raw

From: Robert Millan <[email protected]>
Date: Mon, 7 Dec 2009 15:04:11 +0100

Quoted 9 lines · David Miller
Quoted 6 lines

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 1 line

We're actually in the process of getting rid of device.map;

Meanwhile, please fix the regression you added to the tree. :-)

I think this should do it. Please can you test?

This patch works fine for me, thanks!

#5 lore raw
In reply to Robert Millan

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

#6 lore raw
Quoted 8 lines · David Miller

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

Then don't use that feature of grub-mkconfig (i.e. set GRUB_DISABLE_LINUX_UUID=false in /etc/default/grub). That's independent of device.map handling, though.

Signature · 1 line
Colin Watson                                       [[email protected]]
#7 lore raw

From: Colin Watson <[email protected]>
Date: Mon, 7 Dec 2009 10:20:16 +0000

Quoted 7 lines · David Miller
Quoted 6 lines

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Quoted 6 lines
Quoted 2 lines

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

Then don't use that feature of grub-mkconfig (i.e. set GRUB_DISABLE_LINUX_UUID=false in /etc/default/grub). That's independent of device.map handling, though.

grub-mkconfig actually seems to do this automatically for me.

#8 lore raw
In reply to David Miller
Quoted 4 lines · David Miller

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 8 lines
Quoted 3 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

The problem actually is the following:
When we're in OS we know the OS device name but not the firmware device name. So we're able to generate correct root= for kernel command line but can only guess which names you would need for grub's set root=. The solution we're going for is to have UUID of fs stored in grub.cfg and go through all partitions on boot and find the right one nd set it to root variable. As for passing root= kernel parameter the decision of using device name or UUID= is based on heuristics (sigh) but you can disable them altogether in /etc/default/grub:

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

Quoted 6 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#9 lore raw

From: Vladimir '$B&U(B-coder/phcoder' Serbinenko <[email protected]>
Date: Mon, 07 Dec 2009 11:48:07 +0100

Quoted 10 lines

The problem actually is the following:
When we're in OS we know the OS device name but not the firmware device name. So we're able to generate correct root= for kernel command line but can only guess which names you would need for grub's set root=. The solution we're going for is to have UUID of fs stored in grub.cfg and go through all partitions on boot and find the right one nd set it to root variable. As for passing root= kernel parameter the decision of using device name or UUID= is based on heuristics (sigh) but you can disable them altogether in /etc/default/grub:

Quoted 3 lines

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

UUIDs are convenient but can be very time consuming.

Some sparc64 systems come with 10 or 20 block OpenFirmware device aliases, and we're going probe all of them, one by one, to look for the UUID.

The firmware device name is so trivially obtainable, especially on ieee1275. That's what the grub-ofpathname tool I wrote does on sparc64. And it's what the 'ofpathname' script used by powerpc on grub does as well.

#10 lore raw
Quoted 21 lines · David Miller

From: Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>
Date: Mon, 07 Dec 2009 11:48:07 +0100

Quoted 10 lines

The problem actually is the following:
When we're in OS we know the OS device name but not the firmware device name. So we're able to generate correct root= for kernel command line but can only guess which names you would need for grub's set root=. The solution we're going for is to have UUID of fs stored in grub.cfg and go through all partitions on boot and find the right one nd set it to root variable. As for passing root= kernel parameter the decision of using device name or UUID= is based on heuristics (sigh) but you can disable them altogether in /etc/default/grub:

Quoted 4 lines

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

UUIDs are convenient but can be very time consuming.

Quoted 10 lines

Some sparc64 systems come with 10 or 20 block OpenFirmware device aliases, and we're going probe all of them, one by one, to look for the UUID.

The firmware device name is so trivially obtainable, especially on ieee1275. That's what the grub-ofpathname tool I wrote does on sparc64. And it's what the 'ofpathname' script used by powerpc on grub does as well.

I think we can go for the approach Seth Goldberg proposed: UUID with hint. First we check if hinted device has correct UUID and if so we return it, if not we do the search

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#11 lore raw
In reply to David Miller
Quoted 8 lines · David Miller

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

I was referring to use of UUIDs internally by GRUB (e.g. the search command instances grub-mkconfig generates).

We also pass UUIDs to Linux, but this can be disabled in /etc/default/grub.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#12 lore raw

From: Robert Millan <[email protected]>
Date: Mon, 7 Dec 2009 15:05:16 +0100

Quoted 12 lines · David Miller
Quoted 8 lines

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

I was referring to use of UUIDs internally by GRUB (e.g. the search command instances grub-mkconfig generates).

Ok, but as noted in another thread this can make grub very slow on ieee1275 systems as we are going to look for the UUID on every ieee1275 device alias present and there can be tons of those.

#13 lore raw
Quoted 13 lines · David Miller

From: Robert Millan <[email protected]>
Date: Mon, 7 Dec 2009 15:05:16 +0100

Quoted 10 lines · David Miller
Quoted 8 lines

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 2 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

Quoted 7 lines
Quoted 2 lines

I was referring to use of UUIDs internally by GRUB (e.g. the search command instances grub-mkconfig generates).

Ok, but as noted in another thread this can make grub very slow on ieee1275 systems as we are going to look for the UUID on every ieee1275 device alias present and there can be tons of those.

I'm afraid I missed that thread. In any case, we basically do/can do three things to paliate that problem:

- Cache the prepare_grub_to_access_device() calls at the shell/mkconfig layer (see util/grub.d/10_linux.in for an example).

- Disk cache (kern/disk.c).

- Adjust disk iteration order so that disks more likely to be the ones we're looking for show up first (e.g. on i386-pc we list hard disks before floppies or CD). Note that UUID search aborts as soon as a match is found; it doesn't iterate the whole list.

More ideas welcome, of course :-)

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#14 lore raw
Quoted 33 lines · Robert Millan
Quoted 16 lines · David Miller

From: Robert Millan <[email protected]>
Date: Mon, 7 Dec 2009 15:05:16 +0100

Quoted 12 lines · David Miller
Quoted 11 lines

From: Robert Millan <[email protected]>
Date: Sun, 6 Dec 2009 14:10:26 +0100

Quoted 3 lines

grub-mkconfig generates a grub.cfg that relies on UUIDs instead of hardcoding, etc.

Well, for one thing I don't use initrd's for my Linux kernels, therefore specifying root devices via UUIDs isn't going to work.

Quoted 8 lines
Quoted 3 lines

I was referring to use of UUIDs internally by GRUB (e.g. the search command instances grub-mkconfig generates).

Ok, but as noted in another thread this can make grub very slow on ieee1275 systems as we are going to look for the UUID on every ieee1275 device alias present and there can be tons of those.

I'm afraid I missed that thread. In any case, we basically do/can do three things to paliate that problem:

- Cache the prepare_grub_to_access_device() calls at the shell/mkconfig layer (see util/grub.d/10_linux.in for an example).

Quoted 10 lines

- Disk cache (kern/disk.c).

- Adjust disk iteration order so that disks more likely to be the ones we're looking for show up first (e.g. on i386-pc we list hard disks before floppies or CD). Note that UUID search aborts as soon as a match is found; it doesn't iterate the whole list.

More ideas welcome, of course :-)

Seth proposed a hinting technique:
search --fs_uuid ... -s root --hint hd0,1
then hd0,1 will be checked first and only on failure it will revert to scanning

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#15 lore raw
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Seth proposed a hinting technique:
search --fs_uuid ... -s root --hint hd0,1
then hd0,1 will be checked first and only on failure it will revert to scanning

Sounds good.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#16 lore raw
Quoted 5 lines · Robert Millan
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Seth proposed a hinting technique:
search --fs_uuid ... -s root --hint hd0,1
then hd0,1 will be checked first and only on failure it will revert to scanning

I assume, this --hint argument can be given multiple times, and while searching their order is followed ???

regards,

Signature · 1 line
bvk.chaitanya
#17 lore raw

That was my intent, yes.

--S

Quoting BVK Chaitanya, who wrote the following on Thu, 10 Dec 2009:

Quoted 23 lines · Robert Millan
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines

Seth proposed a hinting technique:
search --fs_uuid ... -s root --hint hd0,1
then hd0,1 will be checked first and only on failure it will revert to scanning

I assume, this --hint argument can be given multiple times, and while searching their order is followed ???

regards,

Signature · 7 lines
bvk.chaitanya


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
#18 lore raw
In reply to Robert Millan
Quoted 7 lines · Robert Millan
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Seth proposed a hinting technique:
search --fs_uuid ... -s root --hint hd0,1
then hd0,1 will be checked first and only on failure it will revert to scanning

Sounds good.

Thinking a bit more, in the vast majority of times, $root variable is initially defined to the drive that contains the filesystem we want. Partition might be wrong, but then again partition numbers are persistent.

Maybe our problem can be solved by making grub-mkconfig a bit smarter, so that UUIDs are only used when /boot partition is in a different drive that the one we embed core.img to.

Signature · 3 lines
Robert Millan

  "Be the change you want to see in the world" -- Gandhi