[edk2] Creating a Mac-compatible driver

Subject: [edk2] Creating a Mac-compatible driver

From: Rod Smith <rodsmith@rodsbooks.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-06-15 07:48:04

Hi,

I've recently taken it upon myself to extend the rEFIt boot manager, 
which seems to have become abandonware. My new fork is rEFInd, 
http://www.rodsbooks.com/refind/. Since version 0.4.0, I've included 
four EFI filesystem drivers, based largely on the original rEFIt drivers 
but with extensions and additions from VirtualBox and the Clover boot 
loader. I've built the drivers with the UDK2010.SR1 toolkit, with a few 
tests with the tookit obtained via Sourceforge's git repository.

The problem I'm having is that my builds of these drivers, like the 
builds from VirtualBox and Clover, work fine on the UEFI-based PCs I've 
tried them on, but they don't work on Macs. I get an error 80000019 code 
number or, from an EFI shell, an "Incompatible Version" message. The 
original rEFIt binaries work fine on Macs or (when the "fat" binaries 
are split into separate x86 and x86-64 binaries) on UEFI-based PCs.

My suspicion is that the TianoCore toolkit, or something about the way 
it's configured, is building a driver that requires UEFI 2.x, whereas 
Macs have a heavily modified EFI 1.x implementation. I'm not positive of 
this, though; it could be there's a subtle source code difference that's 
causing the problem. The TianoCore "Hello World" program runs fine on my 
Mac, so it seems the toolkit can produce a Mac-compatible binary. I've 
Googled this to death and I've sifted through a bunch of documentation, 
but I can't find anything that addresses this point, so I'm posting here 
in the hopes that somebody can point me to the relevant documentation or 
suggest how to change things. Is there EFI version information embedded 
in binaries, and if so, where is it and how does the toolkit determine 
what values to set? Are there certain functions or library files that I 
should avoid to create an EFI 1.x-compatible binary? (I've found 
references to the EdkCompatibilityPkg library, but it's unclear to me 
how it should be used, or even if it would be necessary for my purposes.)

You can find my version of the drivers on Sourceforge 
(https://sourceforge.net/p/refind/code to browse it; see the 
"filesystems" subdirectory). Be aware that I've created a Unix-style 
Makefile to build the files out of the EDK2 directory tree, but the same 
problem occurs when building the Clover 
(https://sourceforge.net/projects/cloverefiboot/) or VirtualBox 
(https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe) 
drivers in their respective EDK2 trees, so it's not my Unix-style build 
process that's causing problems.

Thanks for any pointers!

-- 
Rod Smith
rodsmith@rodsbooks.com
http://www.rodsbooks.com

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel