retitle 611588 powerpc-ibm-utils: ofpathname cannot find information for disks affects 611588 grub-ieee1275 thanks
I'm seeing the same issue as http://bugs.debian.org/611588 on a PowerPC G4 machine with an IDE (parallel ATA) disk: 0 root@colddeadhands:~# ofpathname /dev/sda ofpathname: Could not find sysfs information for logical device "/dev/sda". 1 root@colddeadhands:~# by contrast, ofpath from the yaboot package has no trouble: 0 root@colddeadhands:~# ofpath /dev/sda /pci@f2000000/mac-io@17/ata-4@1f000/@0 0 root@colddeadhands:~# I'm marking this ticket as affecting grub-ieee1275, since it causes grub-install to fail with this error message: 0 root@colddeadhands:~# grub-install Couldn't find Open Firmware device tree path for sda. You will have to set boot-device manually. 1 root@colddeadhands:~# Talking to phcoder on irc.freenode.org#grub, he suggested using the attached patch against grub development head to avoid ofpathname entirely (he didn't seem to think it would install against the debian packaged 1.99-14, but i haven't tested it yet). So once a new grub version makes it into debian that doesn't rely on ofpathname, the "affects" could probably be removed. --dkg
=== modified file 'util/grub-install.in'
--- util/grub-install.in 2012-02-10 17:16:27 +0000
+++ util/grub-install.in 2012-02-13 00:31:30 +0000
@@ -616,15 +616,7 @@
--device-map="${device_map}" "${install_device}" || exit 1
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
if [ x"$update_nvram" = xyes ]; then
- ofpathname="`which ofpathname`"
nvsetenv="`which nvsetenv`"
- set "$ofpathname" dummy
- if test -f "$1"; then
- :
- else
- echo "$1: Not found." 1>&2
- exit 1
- fi
set "$nvsetenv" dummy
if test -f "$1"; then
:
@@ -633,15 +625,14 @@
exit 1
fi
# Get the Open Firmware device tree path translation.
- dev="`echo $grub_device | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`"
- partno="`echo $grub_device | sed -e 's/.*[^0-9]\([0-9]\+\)$/\1/'`"
- ofpath="`$ofpathname $dev`" || {
- gettext_printf "Couldn't find IEEE1275 device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$dev" 1>&2
+ ofpath="`echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=ieee1275_path --device `"
+ if [ x"$ofpath" = x ]; then
+ gettext_printf "Couldn't find IEEE1275 device tree path for %s.\nYou will have to set \`boot-device' variable manually.\n" "$grub_device" 1>&2
exit 1
- }
+ fi
# Point boot-device at the new grub install
- boot_device="$ofpath:$partno,"`"$grub_mkrelpath" "${grubdir}/${target_cpu}-$platform/core.${imgext}" | sed 's,/,\\\\,g'`
+ boot_device="$ofpath,"`"$grub_mkrelpath" "${grubdir}/${target_cpu}-$platform/core.${imgext}" | sed 's,/,\\\\,g'`
# If a install device is defined, copy the core.elf to PReP partition.
if [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] \
=== modified file 'util/grub-probe.c'
--- util/grub-probe.c 2012-02-11 10:57:47 +0000
+++ util/grub-probe.c 2012-02-13 00:25:50 +0000
@@ -67,6 +67,7 @@
PRINT_ARC_HINT,
PRINT_COMPATIBILITY_HINT,
PRINT_MSDOS_PARTTYPE,
+ PRINT_IEEE1275_PATH,
PRINT_DISK
};
@@ -556,6 +557,21 @@
grub_device_close (dev);
continue;
}
+ if (print == PRINT_IEEE1275_PATH)
+ {
+ const char *osdev = grub_util_biosdisk_get_osdev (dev->disk);
+ const char *ofpath = grub_util_devname_to_ofpath (osdev);
+ if (ofpath)
+ {
+ if (dev->disk->partition)
+ printf ("%s:%d", ofpath, dev->disk->partition->number + 1);
+ else
+ printf ("%s:0", ofpath);
+ putchar (delim);
+ }
+ grub_device_close (dev);
+ continue;
+ }
if (print == PRINT_IEEE1275_HINT)
{
const char *osdev = grub_util_biosdisk_get_osdev (dev->disk);
@@ -772,6 +788,8 @@
print = PRINT_COMPATIBILITY_HINT;
else if (!strcmp (arg, "disk"))
print = PRINT_DISK;
+ else if (!strcmp (arg, "ieee1275_path"))
+ print = PRINT_IEEE1275_PATH;
else
argp_usage (state);
break;
pgpuBBwLRqQni.pgp
Description: PGP signature

