[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH v2 4/5] Patch the CHRP boot script



Hi Mathieu,

On 11/18/2017 06:32 PM, Mathieu Malaterre wrote:
Well that's surprising. Thanks for the detailed explanation. I've
filled #882076 and forwarded upstream.

Sorry for not being specific enough, but grub-ofpathname is currently not shipped in any GRUB package for powerpc or ppc64. I only tested a manually compiled version after installing Debian Sid on my PowerMac11,2.

As I recognized that ofpathname is called from GRUB code:

```
## E.g. result for `grub-install [...]` on a PowerMac7,3 from just now:

root@powermac-g5-2:~# grub-install -v --macppc-directory=/boot/grub
[...]
grub-install: info: copying `/boot/grub/powerpc-ieee1275/core.elf' -> `/boot/grub/grub'. grub-install: info: copying `/usr/lib/grub/powerpc-ieee1275/grub.chrp' -> `/boot/grub/System/Library/CoreServices/BootX'. grub-install: info: copying `/boot/grub/powerpc-ieee1275/core.elf' -> `/boot/grub/System/Library/CoreServices/grub.elf'.
grub-install: info: rendering label debian 2.02-2.
grub-install: info: label rendered.
grub-install: info: drive = 0.
grub-install: info: the size of hostdisk//dev/sda is 1953525168.
grub-install: info: blessing /boot/grub/System/Library/CoreServices.
grub-install: info: blessed.
grub-install: info: Looking for /dev/sda2.
grub-install: info: executing ofpathname --version </dev/null >/dev/null.
/usr/sbin/ofpathname: line 812: warning: command substitution: ignored null byte in input grub-install: info: executing nvsetenv boot-device /ht@0,f2000000/pci@7/k2-sata-root@c/scsi@0/sd@0,0:2,\\BootX.
Installation finished. No error reported.

## The above warning output is not from the `ofpathname --version [...]`
## call, as this call gives no output at all, not even on stderr
root@powermac-g5-2:~# ofpathname --version </dev/null >/dev/null
root@powermac-g5-2:~#
```

...to set the OF path for the boot-device NVRAM variable but fails to give a working OF path:

```
## Trying to boot from this path in OF gives:

0 > boot can't OPEN: /ht@0,f2000000/pci@7/k2-sata-root@c/scsi@0/sd@0,0:2,\\BootX
Can't open device or file
0 > _
```

...I searched for alternatives and recognized that there is code for a grub-ofpathname tool in an ieee1275 subdirectory of the GRUB repo (see [1]). I compiled that tool and tried to see if maybe this tool translates device nodes correctly to OF paths, but it didn't. Hence I fell back to the available ofpath tool, which worked correctly.

[1]: http://git.savannah.gnu.org/cgit/grub.git/tree/util/ieee1275/grub-ofpathname.c

I originally assumed that grub-install would also use the output of ofpathname to set "&device;" and "&partition;" in the CHRP boot script ("BootX", see [2] for the template), but this doesn't seem the case, as it looks like the file gets installed as is, as I just found out.

[2]: http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/boot/powerpc/grub.chrp.in

 I fail to understand how people
would install grub on ppc64 if grub-ofpathname does not return the
correct path.

With the current d-i/grub-installer code (v1.146 without my patches) GRUB cannot be installed on powerpc/newworld or ppc64/newworld target machines.

It only works for ppc64el machines and ppc64/chrp and related machines thanks to patches from Adrian. And as ofpathname is from powerpc-ibm-utils it might just work for these machines, so no complains from users.

Cheers,
Frank


Reply to: