Jump to content

macosxbootloader (Hackintosh version).

macosxbootloader hackintosh boot.efi Apple boot

  • Please log in to reply
36 replies to this topic

#21
exenatt

exenatt

    InsanelyMac Protégé

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Thailand
  • Interests:Opensource, Scripting, Graphics Design

How to install ?



#22
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

I noticed that you use ARCHCFLAGS -target x86_64-pc-win32-macho for the 64-bit version of boot.efi but there is no target set for the 32-bit variants. What about using i386-pc-win32-macho?



#23
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,884 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

I noticed that you use ARCHCFLAGS -target x86_64-pc-win32-macho for the 64-bit version of boot.efi but there is no target set for the 32-bit variants. What about using i386-pc-win32-macho?

It doesn't work, try it...

I tested and noticed it didn't want to use it.



#24
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

It doesn't work, try it...

I tested and noticed it didn't want to use it.

Oops. That should have read: x86-pc-win32-macho

 

Anyway. I guess that you will still get the backend triplet error. I know that x86-pc-darwin-macho compiles, but that is probably also wrong. You better ask on the EDKII mailing list what to use for 32-bit EFI applications. I would have asked it myself, but I can't (work related limitation). Or file a clang bug report perhaps (since x86_64-pc-win32-macho works)?



#25
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,884 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Oops. That should have read: x86-pc-win32-macho

 

Anyway. I guess that you will still get the backend triplet error. I know that x86-pc-darwin-macho compiles, but that is probably also wrong. You better ask on the EDKII mailing list what to use for 32-bit EFI applications. I would have asked it myself, but I can't (work related limitation). Or file a clang bug report perhaps (since x86_64-pc-win32-macho works)?

Tried all of those...

Found nothing with stock clang for 32 bit win target...

So I implemented it the way it is now



#26
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

Tried all of those...

Found nothing with stock clang for 32 bit win target...

So I implemented it the way it is now

Yeah but now you end up with darwin files instead of win32 files.

 

Edit: the clang default without -target results in: -triple i386-apple-macosx10.10.0

 

Seems like clang can't handle it. Any other toolsets that work?

 

See also: http://clang.llvm.or...ompilation.html (target triple ).

 

P.s. The offset is also different. It is 0x400 in the MS Windows boot.efi and 0x1000 in the Apple one.



#27
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,884 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Yeah but now you end up with darwin files instead of win32 files.

 

Edit: the clang default without -target results in: -triple i386-apple-macosx10.10.0

 

Seems like clang can't handle it. Any other toolsets that work?

 

See also: http://clang.llvm.or...ompilation.html (target triple ).

 

P.s. The offset is also different. It is 0x400 in the MS Windows boot.efi and 0x1000 in the Apple one.

Should be possible to use i386 / x86_64 MinGW32 cross toolchain then.

That should work.

Not tested yet (but will do so).

Other option is to mod Apple clang sources.

Then we could use clang for x86 build...



#28
Slice

Slice

    InsanelyMac V.I.P.

  • Local Moderators
  • 6,456 posts
  • Gender:Male
  • Location:Moscow

Guys,

what about you? There is Clover that can be compiled to EFI32 application by well known toolsets.



#29
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

Should be possible to use i386 / x86_64 MinGW32 cross toolchain then.

That should work.

Not tested yet (but will do so).

Other option is to mod Apple clang sources.

Then we could use clang for x86 build...

Andy, thanks. Let me know how thing go.

 

Guys,

what about you? There is Clover that can be compiled to EFI32 application by well known toolsets.

 

Slice,

 

Thanks. We know that. What I want is Clang to work. It worked before, as you may remember (I said this some time ago) but with all the  changes that went in... someone did something that it no longer works.



#30
Slice

Slice

    InsanelyMac V.I.P.

  • Local Moderators
  • 6,456 posts
  • Gender:Male
  • Location:Moscow

I can compile ShellPkg with Clang. Also CloverX64.efi compiled by Clang is working.

Not tested 32bit compilation but it was working previously.

 

The big problem is BOOT file. Clang can't compile it because of absolute addressing not supported by the clang.



#31
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

I can compile ShellPkg with Clang. Also CloverX64.efi compiled by Clang is working.

Not tested 32bit compilation but it was working previously.

 

The big problem is BOOT file. Clang can't compile it because of absolute addressing not supported by the clang.

No problem with 64 bit. And what do you mean with absolute addressing? Pic mode versus non-pic mode?



#32
Slice

Slice

    InsanelyMac V.I.P.

  • Local Moderators
  • 6,456 posts
  • Gender:Male
  • Location:Moscow

No problem with 64 bit. And what do you mean with absolute addressing? Pic mode versus non-pic mode?

No, I mean binaries must be movable. Absolute addressing is prohibited.
For example

+;lea     rax, [GDT_BASE]             ; RAX=PHYSICAL address of gdt
+;mov     qword  [gdtr + 2], rax   ; Put address of gdt into the gdtr
+;lgdt     [gdtr]

+        lea     rax, [REL gdtr]  ; use relative addressing
+        lgdt       [rax]

All such mistakes were corrected in EDK2 and in Clover sources (for example commit 2865).
But BOOT file is still can't be compiled with message about relocation is impossible. I still don't know exact reason of this.
 
Anyway 32-bit compilation doesn't depend on this. Clover is compilable by Clang... but not fully working. 

Build environment: Darwin-11.4.2-i386-64bit
Build start time: 14:02:36, Feb.13 2015

WORKSPACE        = /Users/slice/src/edk2
ECP_SOURCE       = /Users/slice/src/edk2/EdkCompatibilityPkg
EDK_SOURCE       = /Users/slice/src/edk2/EdkCompatibilityPkg
EFI_SOURCE       = /Users/slice/src/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH   = /Users/slice/src/edk2/BaseTools


Architecture(s)  = IA32
Build target     = RELEASE
Toolchain        = XCLANG
.....

- Done -
Build end time: 14:05:17, Feb.13 2015
Build total time: 00:00:37

Attached Files



#33
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,884 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

I built a version of the bootloader with the new tools.

I had to modify cctools to fix conversion using mtoc and I had to change clang with the patch above…
My github repo contains the necessary patches for building the bootloader properly now…
You can check the result if you like, it’s pushed to my github repo including build results…
Some other source mods were required to make this possible but now it works…
I was also able to now use the assembly version of the Rijndael algorithms… should be a lot faster and smaller…
So finally a nice update :D



#34
Slice

Slice

    InsanelyMac V.I.P.

  • Local Moderators
  • 6,456 posts
  • Gender:Male
  • Location:Moscow

Tested version from topic boot.clover..bla-bla....

20:913  0:002  Loading boot.efi  status=Unsupported


#35
Pike R. Alpha

Pike R. Alpha

    InsanelyMac Legend

  • Developers
  • 525 posts
  • Gender:Male

 

Tested version from topic boot.clover..bla-bla....

20:913  0:002  Loading boot.efi  status=Unsupported

Hmm. It still doesn't work for you?

 

@Andy,

 

What could be causing this?

 

Edit:

 

I see that you extended NASMFLAGS but what is the purpose of ARCH64/ARCH32? I mean looking at the Makefiles I would say that the x86 directory is only used for macho32/i386 so why would you add this without a need for it? Or am I reading it wrong?

 

Edit-2:

 

Clang does not support  __cdecl – the parser just ignores it – but it is used by MSVC for EFIAPI and BOOTAPI so what about using extern "C" for calls where it is used?

 

I made the changes in my local tree for EFIAPI and now I can use -u _EfiMain -e _EfiMain (no more name mangling) in the Makefile. What do you think?

 

See also: https://github.com/P.../EfiBind.h#L233



#36
Andy Vandijck

Andy Vandijck

    InsanelyMac Deity

  • Coders
  • 1,884 posts
  • Gender:Male
  • Location:Tienen
  • Interests:Programming stuff for Mac OS X...
    Hacking...
    Hard rock (also really big Metallica...

Hmm. It still doesn't work for you?

 

@Andy,

 

What could be causing this?

 

Edit:

 

I see that you extended NASMFLAGS but what is the purpose of ARCH64/ARCH32? I mean looking at the Makefiles I would say that the x86 directory is only used for macho32/i386 so why would you add this without a need for it? Or am I reading it wrong?

 

Edit-2:

 

Clang does not support  __cdecl – the parser just ignores it – but it is used by MSVC for EFIAPI and BOOTAPI so what about using extern "C" for calls where it is used?

 

I made the changes in my local tree for EFIAPI and now I can use -u _EfiMain -e _EfiMain (no more name mangling) in the Makefile. What do you think?

 

See also: https://github.com/P.../EfiBind.h#L233

Great plan.

I hate those C++ mangled pieces of code.

Also we could port the code to EDK2 now...

Should be better that way and minimize code :D


No problem with 64 bit. And what do you mean with absolute addressing? Pic mode versus non-pic mode?

PIC = Position Independepent Code...

 

Info:

http://en.wikipedia....ndependent_code



#37
oswaldini

oswaldini

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
  • Location:Cracow, Poland

Can someone reupload boot.efi.zip and boot.clovertools.efi.zip - I can't download attachments.







Also tagged with one or more of these keywords: macosxbootloader, hackintosh, boot.efi, Apple, boot


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy