Bug 215143 - FreeBSD 11 install cd does not boot on macpro1,1 (32-bit efi)
Summary: FreeBSD 11 install cd does not boot on macpro1,1 (32-bit efi)
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 11.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch, regression
Depends on:
Blocks:
 
Reported: 2016-12-08 10:48 UTC by holindho
Modified: 2019-05-22 00:06 UTC (History)
4 users (show)

See Also:


Attachments
remove EFI boot from release ISO images (1.15 KB, patch)
2018-07-17 18:23 UTC, holindho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description holindho 2016-12-08 10:48:13 UTC
None of the install cd images (amd64) boot on a macpro1,1, which has, unsupported, 32-bit EFI. 10.3 non-uefi images can be booted on the same system. The problem is that FreeBSD does not support 32-bit EFI and the new mixed EFI / BIOS image confuses the Apple boot process and it ends up offering a choice between the boot types, but the chooser feature appears to be incomplete in Apple's implementation (a screen with "Choose boot type.. and choices 1. and 2., neither which can be selected).

I built a new release CD without the EFI parts by basically commenting out the EFI creation bits in amd64/mkisoimages.sh script and following the example release build process from man release 7. The resulting bios-only amd64 boot image can be booted on the macpro, but it gets stuck at "Trying to mount root from cd9660...". Again, the 10.3 images work. 

Apparently, something has changed in FreeBSD 11 that causes it not to find the root fs from the CD.

Possibly related issue at #214582.
Comment 1 holindho 2016-12-23 18:28:57 UTC
Some additional observations:

The FreeBSD 11.0-REL i386 CD boots ok.

The self-built 11.0-REL amd64 non-uefi image boots in VirtualBox.

I installed FreeBSD 10.3 on the macpro1,1 machine on the first internal SATA HDD with ZFS root (MBR), whole disk install. (GPT partitioned disk couldn't boot.) Then upgraded the 10.3 install into 11.0-RELEASE using freebsd-update. After the update and the requested reboot, it hits the same problem of not being able to mount root. It says: "Root mount waiting for: usbus4".
Comment 2 holindho 2016-12-24 07:32:13 UTC
(In reply to holindho from comment #1)

Scrap the last bit. Those "Root mount waiting.." messages come and go in 10.3, too, before or after "Trying to mount root.." which is the one where it seems to get stuck.
Comment 3 Trev 2017-03-11 05:15:12 UTC
Not sure this helps, but regarding: "Choose boot type.." and choices 1. and 2., neither which can be selected.

Same issue on a late 2009 Mac Mini (hardware version 3,1) with FreeBSD 11-Stable CD snapshot (r314493) except that holding down the ALT/Option key when booting shows the two partitions (Windows and EFI) and you can choose EFI for it to boot. This Mac Mini has 64 bit EFI.
Comment 4 holindho 2017-03-14 07:31:14 UTC
No, option booting doesn't help on this machine. It will only show a Windows CD Icon and then comes the numeric choice where you cannot choose.

The further booting problem of RELEASE-11.0.0 where it gets stuck at mounting root or thereabouts, is solved in CURRENT and STABLE-11 at head @r314132 and stable/11 @r314217, respectively. I didn't "bisect" for the actual commits, but these are the ones I happened to try and which worked, whereas RELEASE-11.0.0 and CURRENT from a maybe some three-four months ago did not work.
Comment 5 Jason W. Bacon freebsd_committer 2018-07-14 15:01:35 UTC
Same issue on my 2007 iMac.  11.1 DVD boots fine on a newer MacBook Pro, but I get the empty 1. 2. menu on older Macs.

OK, one could argue it's time to upgrade my hardware since I could probably find a newer Mac on the curb at this point, but this machine is perfectly functional and rather pleasant to use (quiet, nice display), so I'd like to keep it going past 10.x EOL if it's not too much trouble.
Comment 6 holindho 2018-07-14 15:11:20 UTC
For the record, short of building your own ISO using a FreeBSD install, the following link has a tool (a bit over halfway down the page) to alter existing images to boot on an older Mac:

https://mattgadient.com/2016/07/11/linux-dvd-images-and-how-to-for-32-bit-efi-macs-late-2006-models/
Comment 7 Trev 2018-07-15 05:18:48 UTC
(In reply to Jason W. Bacon from comment #5)

I did extensive testing with a 2007 Mac Mini - results which may/not be useful at: https://forums.freebsd.org/threads/need-help-installing-on-mid-2007-mac-mini.64977/#post-382120
Comment 8 Jason W. Bacon freebsd_committer 2018-07-17 14:59:57 UTC
I confirmed that 11.1 i386 boots fine.  This is a decent fallback option, although support for 32-bit systems is fading.

Does anyone know how to go about rolling a modified ISO?  The documentation for rolling a standard ISO is fine, but what modifications need to be made to support 32-bit firmware?  I'd be willing to develop and document the process if it's not crazy complicated and someone can point me in the right direction.
Comment 9 holindho 2018-07-17 18:23:48 UTC
Created attachment 195206 [details]
remove EFI boot from release ISO images
Comment 10 holindho 2018-07-17 18:27:18 UTC
(In reply to Jason W. Bacon from comment #8)

Added a patch for removing the EFI booter image from the produced ISOs.

You would be looking at "man release" example #1 and after "cd src" just apply the patch with "patch -p0 < freebsd-remove-efi-from-iso.patch" and then continue according to the man page.

The patch is against stable/11, but I suppose it will work on later versions.
Comment 11 Kyle Evans freebsd_committer 2018-08-08 22:01:34 UTC
Can you guys try booting 11.2 on these systems, please, to confirm that whatever fixed it didn't get MFC'd?
Comment 12 Jason W. Bacon freebsd_committer 2018-08-09 12:55:53 UTC
The patch works like a charm, thanks.  I commented out these lines and followed the instructions in the release man page. I few hours later, I had a 

   FreeBSD-11.1-RELEASE-p11-amd64-disc1.iso

that boots on my old iMac.

Next question:

Is there any chance freebsd-update will break a system installed from the modified ISO by "restoring" the missing EFI files?
Comment 13 Jason W. Bacon freebsd_committer 2018-09-04 14:42:15 UTC
Finally got around to fully testing this.  I did a full install with my custom ISO on a MacBook Pro 2,2.  I'm using it right now to send this update.

I then did a

    freebsd-update fetch install

which updated the kernel and it did not cause any problems.

Clearly from previous posts, "freebsd-update upgrade" can render the system unbootable, but I'm not sure what other conditions could cause problems.  I don't understand the details of the boot process well enough.

Might it be possible to patch the generic ISO to prevent the EFI boot path from being used on 32-bit EFI systems?

Is there an easy way to fix an installation following "freebsd-update upgrade"?  I'm not so concerned about this one as I prefer to do fresh installs when I upgrade.  ( A little OCD about bit rot and keeping my installations pristine. )
Comment 14 Jason W. Bacon freebsd_committer 2018-10-17 19:23:48 UTC
Followup:

My iMac and MacBook are both running 11.2-RELEASE amd64 now.

The iMac was a fresh install from an ISO with EFI disabled using holindho's patch.

holindho's patch does not apply cleanly to the 11.2 src, but it's
simple enough to just review visually and edit in by hand.

On the MacBook, I upgraded from 11.1-RELEASE using

freebsd-update upgrade -r 11.2-RELEASE

This did not break the boot process, so it appears that installing from the EFI-disabled ISO is fairly safe through future updates.

Both systems are dual-booted using rEFIt, BTW.  I have not been able to boot FreeBSD using the whole disk on my old Macs.  I'm not sure it's even possible.  ( I assume it is possible on a newer Mac with 64-bit EFI and a recent release, but I have no such hardware to test it on. )
Comment 15 Jason W. Bacon freebsd_committer 2019-05-21 20:03:18 UTC
FYI, a reference regarding "newer" Macs (I think around 2008 and later):

https://forums.freebsd.org/threads/booting-freebsd-12-on-an-imac.69177/
Comment 16 Trev 2019-05-22 00:06:58 UTC
FreeBSD booting on a MacPro 1,1 with 32 bit EFI and 64 bit processor:

https://forums.freebsd.org/threads/booting-macpro1-1-with-32bit-efi-not-bios-legacy.70665/

How-To still to come.