loader.efi freezes loading kernel

Keve

Member

Reaction score: 4
Messages: 28

Hello forum-readers,
I have a 2006 iMac 4,1 with an Intel Core Solo processor and 32-bit EFI 1.1, and I am trying to run FreeBSD 11.2R/i386 on it.

It looks to me that FreeBSD's 32-bit EFI loader is found, loaded, started, which in turn DOES find my freebsd-ufs partition, finds the kernel at /boot/kernel/kernel, but the world stops moving the moment it starts to load that kernel.
Here is the screen output:

Code:
>> FreeBSD EFI boot block
   Loader path: /boot/loader.efi

   Initializing modules: ZFS UFS
   BootCurrent: 0000
   BootOrder: 0080
   Probing 8 block devices.......*... done
    ZFS found no pools
    UFS found 1 partition
Consoles: EFI console
Commandline arguments: l
Image base: 0x7cb92000
EFI version: 1.10
EFI Firmware: Apple (rev 8192.01)

FreeBSD/i386 EFI loader, Revision 1.1
(Fri Jun 22 03:56:59 UTC 2018 root@releng2.nyi.freebsd.org)
   BootCurrent: 0000
   BootOrder: 0080
Setting currdev to disk0p4:
Loading /boot/defaults/loader.conf
/boot/kernel/kernel text=0x12826cb data=0xe8428+0x2830ec syms=[0x4+0xe8ae0+0x4+0x177330]
/boot/entropy size=0x1000

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
|
After the vertical bar is printed, nothing happens. I tried multiple times and I did wait a very-very long time to see if maybe something else happens.
Nothing.

I can boot FreeBSD off of an MBR memstick, I can mount the freebsd-ufs volume on ada0, I can verify the files are there and not corrupt, so I see no reason why the system stops loading from the hdd.

Unfortunately, the 1GB pendrive built from memstick.img does not boot on this iMac (I can start it from rEFInd, but only a black screen is shown with no output at all). I used my HP 8000 desktop to boot this FreeBSD installer memstick, partitioned another memstick (2GB, single slice, using MBR) and installed a minimal FreeBSD on this 2GB stick. Back on the iMac using rEFInd, this 2GB memstick nicely boots a fully functional FreeBSD 11.2R base system.
The computer is in perfect condition. To verify that the hardware is all OK I installed and used Mac OS X 10.6.8 Snow Leopard on it, everything worked fine. I also installed and used Windows 7 Professional 32-bit on it, everything worked fine.
I used dump to make a level 0 backup of the UFS2 volume into a file. Wiped ada0 in the iMac and repartitioned it using MBR instead of GPT, restored the UFS2 backup from the file, wrote /boot/boot to the beginning of the MBR slice, and now rEFInd can start the volume and FreeBSD 11.2R boots fine and the system is fully functional. With very little tweaking, Xorg with radeon works using the displays native 1680x1050 resolution, sound works, coretemp shows the processor temperature, smartmontools shows the hdd temperature, this is a very functional FreeBSD desktop system.

But loads only when MBR is used via /boot/boot.
And stops at the kernel when I use a GPT schema and loader.efi.
If I add kernel modules to pre-load from /boot/loader.conf (for example, coretemp_load=yes, radeonkms_load=yes, fuse_load=yes) then loader.efi does load those modules and their dependencies fine, but again stops when it starts loading the kernel. I can also get to a loader prompt and issue commands, but once I start loading the kernel, everything stops.

I have no prior experience with FreeBSD EFI booting, my other computers all boot using BIOS boot. I have experience with EFI booting Mac OS X on Apple desktops, hence I knew how to play around with bless, and I also read uefi() on FreeBSD. This is how far I got.

I would prefer to have a GPT schema on the iMac's internal disk, so I hope to get loader.efi load the kernel and finish booting properly. I am out of ideas, and I do not know how I could get any details on why loading the kernel stops at this point, I know no means to debug this. Any suggestion from the community is appreciated!
 

olli@

Well-Known Member
Developer

Reaction score: 274
Messages: 315

If EFI booting doesn't work but you still want GPT, that should be possible. You'll have to create a partition of type “freebsd-boot” (I think it must be the first partition on the disk) and install a PMBR (protective MBR; that's /boot/pmbr) on top of it. See the gptboot(8) manual page for detailed instructions.

Disclaimer: I have done the above only on standard PCs, not on iMac, so no guarantee …
 
OP
OP
Keve

Keve

Member

Reaction score: 4
Messages: 28

The gptboot way relies on the fact that the start-up process of the computer loads machine code from the first block of the first hard disk (the first 512 bytes is home for this machine code and the MBR). That machine code knows to jump to the first freebsd-boot type partition and load machine code from there.
Mac computers use a different kind of firmware (in this old iMac's case it is Apple's 32-bit EFI 1.1), it does not load machine code from the beginning of the first hard disk, instead it looks for an EFI-code loader with a particular name on HFS+ or FAT32 volumes and executes that. So I can indeed set up the partitions olli@ recommended, but it will not work because the code from the freebsd-boot partiton would never get loaded (the machine code from the PMBR would load that, but this system never loads that code from the PMBR).
 
Top