[1] https://cdimage.debian.org/cdimage/ports/tests/
[2] https://people.debian.org/~glaubitz/grub-installer.20210414
[3] http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/boot/powerpc/grub.chrp.in
The latest image is in the folder "hfstest-20210411-8" which I created this morning. This image is not tested yet, but it should actually work when looking
at the script code itself [2] but it doesn't which is most likely attributed to a
race condition.
The problem is that setting the correct file properties with the hattrib tool fails at the first attempt of installing the bootloader but succeeds when just
reattempting to install the bootloader from the installer menu. So far, I have
not been able to find out why, that will require more debugging.
On 14/04/2021 08:54, John Paul Adrian Glaubitz wrote:
Hello!
I have been working on getting the GRUB installation on PowerMacs fixed the >> past days which turned out to be far more tricky than I expected. As can be >> seen from the number of test images I have created so far [1], I have already
been through quite a number of image rebuilds to get the grub-installer work >> correctly on PowerMac (ignore the timestamps in the folder names, the correct
timestamps of the images can be seen from the creation date in the folder view).
Great work Adrian!
The latest image is in the folder "hfstest-20210411-8" which I created this >> morning. This image is not tested yet, but it should actually work when looking
at the script code itself [2] but it doesn't which is most likely attributed to a
race condition.
The problem is that setting the correct file properties with the hattrib tool
fails at the first attempt of installing the bootloader but succeeds when just
reattempting to install the bootloader from the installer menu. So far, I have
not been able to find out why, that will require more debugging.
If anyone wants to give it a try themselves, please fetch the image from [1] >> (so far I created a 32-bit image only) and see if it works for you.
Note: After selecting the partition layout, the partioning tool will present >> an empty question dialog which should be answered with <NO>. It's a known issue
I will fix later, so just ignore it for now.
FWIW, I also found a number of bugs in GRUB on PowerMac itself while working >> on the problem. It turns out that GRUB does not set the proper openfirmware >> path in NVRAM pointing to the BootX script that it just installed. The script
gets installed into :System:Library:CoreServices:BootX but grub-install (the >> upstream GRUB installation tool) just sets the path to :BootX.
I would expect this to work since BootX is simply the filename and so it is a relative path reference, presumably to the blessed CoreServices directory. Otherwise you'd end up using an absolute path in the form \path\to\BootX.
Also, while GRUB's grub-install blesses the "CoreServices" folder, it does >> not set the "tbxi" attribute which means it's not possible to boot the disk >> with "boot hd:N,:\\tbxi" (N being the partition).
That should be an easy fix now that you've got hattrib working:
hattrib -t tbxi -c chrp path/to/BootX
I'm curious as to how grub-install currently handles the blessing of the CoreServices
directory for different filesystems - does it only attempt to bless the folder if it
detects a HFS/HFS+ filesystem?
Finally it may be worth noting that if you omit the partition number then the firmware
will locate the first bootable partition itself which is the default value that OpenBIOS
uses, e.g.
boot hd:,\\:tbxi
on some old Fedora ISOs I have lying around, these files are all CHRP boot scriptsAnd, finally, GRUB's grub-install never substitutes the variable names "device"
and "partition" in the boot script [3] it installs. They just remain as is on
the disk which naturally means that grub-install currently cannot itself properly
install GRUB on a PowerMac which is obviously a bug.
This shouldn't be needed. Having a look at grub.chrp.in from your link and ofboot.b
i.e. XML surrounded by <CHRP-BOOT>...</CHRP-BOOT> tags.
IIRC it is part of the CHRP boot specification that the firmware substitutes the values
for "&device;" and "&partition;" in <BOOT-SCRIPT>...</BOOT-SCRIPT> when reading the CHRP
boot script into memory, and that's certainly what OpenBIOS does.
I guess the real question is does Apple's OF do the right thing here? My feeling is that it
does, since grub.chrp.in uses the hard-coded path \System\Library\CoreServices\grub.elf
which is a directory that only exists if grub is installed on a MacOS computer.
Hello!
I have been working on getting the GRUB installation on PowerMacs fixed the past days which turned out to be far more tricky than I expected. As can be seen from the number of test images I have created so far [1], I have already been through quite a number of image rebuilds to get the grub-installer work correctly on PowerMac (ignore the timestamps in the folder names, the correct timestamps of the images can be seen from the creation date in the folder view).
The latest image is in the folder "hfstest-20210411-8" which I created this morning. This image is not tested yet, but it should actually work when looking
at the script code itself [2] but it doesn't which is most likely attributed to a
race condition.
The problem is that setting the correct file properties with the hattrib tool fails at the first attempt of installing the bootloader but succeeds when just
reattempting to install the bootloader from the installer menu. So far, I have
not been able to find out why, that will require more debugging.
If anyone wants to give it a try themselves, please fetch the image from [1] (so far I created a 32-bit image only) and see if it works for you.
Note: After selecting the partition layout, the partioning tool will present an empty question dialog which should be answered with <NO>. It's a known issue
I will fix later, so just ignore it for now.
FWIW, I also found a number of bugs in GRUB on PowerMac itself while working on the problem. It turns out that GRUB does not set the proper openfirmware path in NVRAM pointing to the BootX script that it just installed. The script gets installed into :System:Library:CoreServices:BootX but grub-install (the upstream GRUB installation tool) just sets the path to :BootX.
Also, while GRUB's grub-install blesses the "CoreServices" folder, it does not set the "tbxi" attribute which means it's not possible to boot the disk with "boot hd:N,:\\tbxi" (N being the partition).
And, finally, GRUB's grub-install never substitutes the variable names "device"
and "partition" in the boot script [3] it installs. They just remain as is on the disk which naturally means that grub-install currently cannot itself properly
install GRUB on a PowerMac which is obviously a bug.
FWIW, I also found a number of bugs in GRUB on PowerMac itself while working
on the problem. It turns out that GRUB does not set the proper openfirmware >>> path in NVRAM pointing to the BootX script that it just installed. The script
gets installed into :System:Library:CoreServices:BootX but grub-install (the
upstream GRUB installation tool) just sets the path to :BootX.
I would expect this to work since BootX is simply the filename and so it is a
relative path reference, presumably to the blessed CoreServices directory. >> Otherwise you'd end up using an absolute path in the form \path\to\BootX.
The problem was simply that the HFS filesystem had to be unmounted before accessing
with hfsutils. It works now. Currently performing the final test.
Also, while GRUB's grub-install blesses the "CoreServices" folder, it does >>> not set the "tbxi" attribute which means it's not possible to boot the disk >>> with "boot hd:N,:\\tbxi" (N being the partition).
That should be an easy fix now that you've got hattrib working:
hattrib -t tbxi -c chrp path/to/BootX
Not sure why to pass "-c chrp" here as all the instructions I have seen for PowerMac pass "-c UNIX".
I'm curious as to how grub-install currently handles the blessing of the CoreServices
directory for different filesystems - does it only attempt to bless the folder if it
detects a HFS/HFS+ filesystem?
Seems so. See the grub-install source code.
Finally it may be worth noting that if you omit the partition number then the firmware
will locate the first bootable partition itself which is the default value that OpenBIOS
uses, e.g.
boot hd:,\\:tbxi
I'm just using the path provided by "opathname" as this way we can install onto any type
of media instead of just hard disks.
on some old Fedora ISOs I have lying around, these files are all CHRP boot scriptsAnd, finally, GRUB's grub-install never substitutes the variable names "device"
and "partition" in the boot script [3] it installs. They just remain as is on
the disk which naturally means that grub-install currently cannot itself properly
install GRUB on a PowerMac which is obviously a bug.
This shouldn't be needed. Having a look at grub.chrp.in from your link and ofboot.b
i.e. XML surrounded by <CHRP-BOOT>...</CHRP-BOOT> tags.
IIRC it is part of the CHRP boot specification that the firmware substitutes the values
for "&device;" and "&partition;" in <BOOT-SCRIPT>...</BOOT-SCRIPT> when reading the CHRP
boot script into memory, and that's certainly what OpenBIOS does.
Ah, I wasn't aware of that.
I guess the real question is does Apple's OF do the right thing here? My feeling is that it
does, since grub.chrp.in uses the hard-coded path \System\Library\CoreServices\grub.elf
which is a directory that only exists if grub is installed on a MacOS computer.
I can try removing the sed command from grub-installer again and see if that still works.
Currently, I have:
sed -i 's!&device;:&partition;!'"$ofpath"'!g' $ROOT/boot/grub/System/Library/CoreServices/BootX
Not sure why to pass "-c chrp" here as all the instructions I have seen for >> PowerMac pass "-c UNIX".
(goes and looks)
From what I can see there is a mixture of creator types: chrp is mentioned for
FreeBSD and BootX, whilst most of the grub references suggest using UNIX. Having a look around the OpenBIOS code I think the creator type is only used in the absence of a blessed directory, so either will do fine.
sed -i 's!&device;:&partition;!'"$ofpath"'!g' $ROOT/boot/grub/System/Library/CoreServices/BootX
Out of curiosity did it still work when you removed this?
[1] https://salsa.debian.org/installer-team/grub-installer/-/commit/a234f349ef13ddf3d756c4418716f2e6adeba3dc
[2] https://wiki.gentoo.org/wiki/GRUB_on_Open_Firmware_(PowerPC)
[3] https://salsa.debian.org/images-team/debian-cd/-/blob/master/tools/boot/bullseye/boot-powerpc#L23
OK, I was already wondering about that. grub-install contains a bless utility and function only, but not something for the UNIX filetype.
Question: If the blessing is sufficient and the setting of the filetype not necessary,
why does grub-install --macppc-directory=/boot/grub (with that being an HFS
filesystem) not create a working boot partition?
Yeah. From what I can see from links [1] and [2] I'd expect this to be working now.(...)
Let me run an install of the latest ISO here, since then I can then use a debugger
on QEMU/OpenBIOS to find out what the problem may be.
The main problem I found was that starting from a blank drive image in QEMU the
/boot/grub HFS partition wasn't being created - see the attached PNGs where part-original.png
is the layout from the default guided installation and part-modified.png is after I had
manually removed the / partition, added the /boot/grub HFS partition (I guess a 32MB size?)
and then assigned the remaining space to the / partition once again.
(...)
# grub-install --macppc-directory=/boot/grub/
(this installed /boot/grub/System/Library/CoreServices/BootX which was missing before?)
# umount /boot/grub/
# hmount /dev/sda3
Volume name is "untitled"
Volume was created on Thu Apr 15 20:51:52 2021
Volume was last modified on Thu Apr 15 21:48:40 2021
Volume has 22705664 bytes free
root@debian:/boot# hls
fonts grub.cfg locale powerpc-ieee1275
grub grubenv mach_kernel System
# hattrib -b :System:Library:CoreServices
# hattrib -c chrp -t tbxi :System:Library:CoreServices:BootX
# hls -l :System:Library:CoreServices:BootX
f tbxi/chrp 0 16632 Apr 15 22:53 :System:Library:CoreServices:BootX
# humount
# shutdown -h now
After that I was able to reboot successfully by switching qemu-system-ppc to boot from the HD using -boot c instead:
./qemu-system-ppc -hda deb10.qcow2 -cdrom debian-10.0.0-powerpc-NETINST-1.iso -boot c -m 512 -nographic
On 15/04/2021 20:54, Mark Cave-Ayland wrote:
OK, I was already wondering about that. grub-install contains a
bless utility
and function only, but not something for the UNIX filetype.
Question: If the blessing is sufficient and the setting of the
filetype not necessary,
why does grub-install --macppc-directory=/boot/grub (with
that being an HFS
filesystem) not create a working boot partition?
Yeah. From what I can see from links [1] and [2] I'd expect this to
be working now. Let me run an install of the latest ISO here, since
then I can then use a debugger on QEMU/OpenBIOS to find out what the
problem may be.
After a bit of fiddling I was eventually able to get a bootable HD
install under qemu-system-ppc using your snapshot image. The command
line I used was:
./qemu-system-ppc -hda deb10.qcow2 -cdrom
debian-10.0.0-powerpc-NETINST-1.iso -boot d -m 512 -nographic
The main problem I found was that starting from a blank drive image in
QEMU the /boot/grub HFS partition wasn't being created - see the
attached PNGs where part-original.png is the layout from the default
guided installation and part-modified.png is after I had manually
removed the / partition, added the /boot/grub HFS partition (I guess a
32MB size?) and then assigned the remaining space to the / partition
once again.
Once this was done, I let the base install run all the way up until
the point where the installer prompted me for the mirror information.
At this point I didn't want to install any extra packages to help save
time, so instead went back to the installer menu and then went
directly to the grub installation step. That appeared to succeed
without any error messages, so then finished the installer and rebooted.
Unfortunately the resulting HD image would not boot. I could see the
contents of the /boot/grub partition in OpenBIOS with "dir hd:,\" and
after a few tests realised I was able to boot the grub ELF directly
using "boot hd:3,\grub".
Once in the installed image I noticed that the /boot/grub/System/Library/CoreServices/ directory didn't exist,
possibly because I skipped the installer between the mirror selection
and the grub installation? However at this point I was able to install hfsutils by hand using "apt-get install hfsutils" which then allowed
me to do the following:
# grub-install --macppc-directory=/boot/grub/
(this installed /boot/grub/System/Library/CoreServices/BootX which was missing before?)
# umount /boot/grub/
# hmount /dev/sda3
Volume name is "untitled"
Volume was created on Thu Apr 15 20:51:52 2021
Volume was last modified on Thu Apr 15 21:48:40 2021
Volume has 22705664 bytes free
root@debian:/boot# hls
fonts grub.cfg locale powerpc-ieee1275
grub grubenv mach_kernel System
# hattrib -b :System:Library:CoreServices
# hattrib -c chrp -t tbxi :System:Library:CoreServices:BootX
# hls -l :System:Library:CoreServices:BootX
f tbxi/chrp 0 16632 Apr 15 22:53 :System:Library:CoreServices:BootX
# humount
# shutdown -h now
After that I was able to reboot successfully by switching
qemu-system-ppc to boot from the HD using -boot c instead:
./qemu-system-ppc -hda deb10.qcow2 -cdrom
debian-10.0.0-powerpc-NETINST-1.iso -boot c -m 512 -nographic
ATB,
Mark.
Inded, I don't have the HFS partition too.
https://salsa.debian.org/installer-team/libdebian-installer/-/blob/master/src/system/subarch-powerpc-linux.c
On 4/16/21 1:27 AM, Mark Cave-Ayland wrote:
Yeah. From what I can see from links [1] and [2] I'd expect this to be working now.(...)
Let me run an install of the latest ISO here, since then I can then use a debugger
on QEMU/OpenBIOS to find out what the problem may be.
The main problem I found was that starting from a blank drive image in QEMU the
/boot/grub HFS partition wasn't being created - see the attached PNGs where part-original.png
is the layout from the default guided installation and part-modified.png is after I had
manually removed the / partition, added the /boot/grub HFS partition (I guess a 32MB size?)
and then assigned the remaining space to the / partition once again.
(...)
# grub-install --macppc-directory=/boot/grub/
(this installed /boot/grub/System/Library/CoreServices/BootX which was missing before?)
Your machine is obviously not detected as a New World PowerMac and thus, none of the mechanisms for
New World PowerMacs are applied. If archdetect doesn't show you're on a "powerpc/powermac_newworld",
neither the automatic partioning nor the installation of GRUB for PowerMacs is triggered correctly.
# umount /boot/grub/
# hmount /dev/sda3
Volume name is "untitled"
Volume was created on Thu Apr 15 20:51:52 2021
Volume was last modified on Thu Apr 15 21:48:40 2021
Volume has 22705664 bytes free
root@debian:/boot# hls
fonts grub.cfg locale powerpc-ieee1275
grub grubenv mach_kernel System
# hattrib -b :System:Library:CoreServices
# hattrib -c chrp -t tbxi :System:Library:CoreServices:BootX
So, I thought setting the filetype isn't necessary?
On 4/16/21 7:56 AM, David VANTYGHEM wrote:
Inded, I don't have the HFS partition too.Then the emulation is not behaving as a real machine.
QEMU needs display the right information below /proc/cpuinfo:
https://salsa.debian.org/installer-team/libdebian-installer/-/blob/master/src/system/subarch-powerpc-linux.cAdrian
https://salsa.debian.org/installer-team/libdebian-installer/-/blob/master/src/system/subarch-powerpc-linux.c
Here's what I get for the QEMU machines:
Under QEMU, my machine is :
https://cryptpad.fr/file/#/2/file/YT77NWCuXe-1Zei6sAam49SS/
(pcmacgeneration : NewWorld)
On 4/16/21 8:39 AM, Mark Cave-Ayland wrote:
The interesting part will be to see what arch-detect prints out in the installer. You can just run it from a second terminal. If it doesn'tHere's what I get for the QEMU machines:https://salsa.debian.org/installer-team/libdebian-installer/-/blob/master/src/system/subarch-powerpc-linux.c
detect a newworld machine, GRUB installation won't work.
Adrian
On 4/16/21 8:39 AM, Mark Cave-Ayland wrote:
https://salsa.debian.org/installer-team/libdebian-installer/-/blob/master/src/system/subarch-powerpc-linux.c
Here's what I get for the QEMU machines:
The interesting part will be to see what arch-detect prints out in the installer. You can just run it from a second terminal. If it doesn't
detect a newworld machine, GRUB installation won't work.
On 4/16/21 8:36 AM, Mark Cave-Ayland wrote:
Your machine is obviously not detected as a New World PowerMac and thus, none of the mechanisms for
New World PowerMacs are applied. If archdetect doesn't show you're on a "powerpc/powermac_newworld",
neither the automatic partioning nor the installation of GRUB for PowerMacs is triggered correctly.
I see, thanks - my confusion was that the old installer used to always set up the partitioning regardless
of the machine type and so it was possible to boot on both an Old World and a New World machine.
That's not quite true. The installer has always been differentiating the different machine types on
PowerPC. For Yaboot, there was a package called "partman-newworld" before that was only enabled on
machines detected as */powermac_newworld. If your machine did not match that pattern, it would not
have created the HFS bootstrap.
Are Old World Macs no longer supported?
I am currently concerned with New World Macs only as I haven't had the time yet to dig out an OW
Mac for testing. I have such a machine currently in storage but no plans at the moment to work
on it as kernel support for these old machines as mine (PowerBook 3400) is not working anyway
at the moment.
So, I thought setting the filetype isn't necessary?
I think it shouldn't be - I can test later but mostly I just wanted to use something that was
known to work so I could debug the boot process.
My question still is: Why does "grub-install --macppc-directory=/boot/grub" not already set up
a completely working bootstrap partition. There is obviously a bug in grub-install.
I don't have arch-detect but a archdetect command :
# archdetect
powerpc/powermac_newworld
The interesting part will be to see what arch-detect prints out in the
installer. You can just run it from a second terminal. If it doesn't
detect a newworld machine, GRUB installation won't work.
Here's what I see with -M mac99:
~ # /bin/archdetect
powerpc/powermac_newworld
I guess that should work? If so, I can kick off another installation in the background later.
On 4/16/21 8:59 AM, Mark Cave-Ayland wrote:
The interesting part will be to see what arch-detect prints out in the
installer. You can just run it from a second terminal. If it doesn't
detect a newworld machine, GRUB installation won't work.
Here's what I see with -M mac99:
~ # /bin/archdetect
powerpc/powermac_newworld
I guess that should work? If so, I can kick off another installation in the background later.
So, which image did you use and was QEMU already configured like that when you were trying it in the first place.
Because I am starting to question my sanity. If you're showing me that arch-detect
is detecting the machine correctly and you used the latest image which I tested
myself on real hardware, then it's not possible that the partioner will use the wrong layout.
Because I am starting to question my sanity. If you're showing me that arch-detect
is detecting the machine correctly and you used the latest image which I tested
myself on real hardware, then it's not possible that the partioner will use >> the wrong layout.
Well bear in mind that last night's install would have been running under an Old World (-M g3beige)
machine as that was before I realised from your comments this morning that the new functionality
was restricted to New World machines.
On 4/16/21 9:29 AM, Mark Cave-Ayland wrote:
Because I am starting to question my sanity. If you're showing me that arch-detect
is detecting the machine correctly and you used the latest image which I tested
myself on real hardware, then it's not possible that the partioner will use >>> the wrong layout.
Well bear in mind that last night's install would have been running under an Old World (-M g3beige)
machine as that was before I realised from your comments this morning that the new functionality
was restricted to New World machines.
Well, that was an important missing piece of information.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 37:24:46 |
Calls: | 6,648 |
Files: | 12,193 |
Messages: | 5,329,132 |