Jump to content

Dedicated BootLoader - Hackintosh

Guest

Just wondering, why do people need a dedicated bootloader for hackintoshes? Aren't you able to do the exact same thing using bootcamp or using the recovery keys? Is the bootloader like a different thing aside of BIOS? I don't understand

Link to comment
Share on other sites

Link to post
Share on other sites

Just wondering, why do people need a dedicated bootloader for hackintoshes? Aren't you able to do the exact same thing using bootcamp or using the recovery keys? Is the bootloader like a different thing aside of BIOS? I don't understand

First the easy questions: you use bootcamp on a mac to boot Windows, not to boot OS X.

I don't fully understand you last question, I'll answer to what I've understood: the bootloader is a different thing aside of BIOS. If you have a PC that uses BIOS, then as you switch on your system the first thing that is read (probably it's not true, there may be other things to load before the BIOS, but l'll stick to what I know and simple things) to boot it up is the content of your bios chip. The BIOS is a simple program that initializes the devices on your motherboard and has the bare minimum required to be able to read the boot sectors off the hdd you selected for boot (so at least it has to setup your CPU, RAM, disk controllers and graphics adapter). For example, if you had an MBR partition table on your hdd, the first 512 bytes are loaded by the BIOS in RAM and then executed to begin to load a boot loader. These 512 bytes contains the minimum to redirect loading to the partition marked as active (or bootable). Then the first sector (I think) of the active partitions contains the actual boot loader (not entirely true, usually this first sector contains what is required to load a stage 2 boot loader, for example microsoft's bootmgr or GRUB). I think these wikipedia links contain pretty much all the info you may want to have about this matter:

https://en.wikipedia.org/wiki/BIOS#Operation

https://en.wikipedia.org/wiki/Booting#Personal_computers_.28PC.29

https://en.wikipedia.org/wiki/Booting#Modern_boot_loaders

 

Now, to the main question:

To run Mac OS X (or well, now just OS X) on an x86 PC, you need a version of it compiled for this architecture. Apple switched to x86 in 2006, and if I well remember the first version with x86 support was Mac OS X  10.4. Every x86 computer Apple made uses EFI, not BIOS (at least to my knowledge). This means that Apple computers run EFI since 2006, while on the PC market we got EFI to replace BIOS a few years later on. So the first reason why hackintoshes require a specific bootloader (it is actually a lot more), is because you need something to look like EFI to boot OS X, you can't boot OS X with a BIOS directly. Also, Mac devices have an SMC onboard, which among various things is also checked by OS X at boot time to see if it is booting on real Apple hardware. This special bootloaders must emulate an SMC device to boot OS X. Then what you also do with this bootloaders is to inject into the OS some information about your hardware, the way apple expects it to be provided by its hardware, for example one way to enable 3d acceleration with your GPU is to inject via EFI strings the correct hardware ID of your GPU, then OS X would load the right driver for it (you actually need a GPU supported by OS X, no driver = no party). This can also be used to inject an audio card (usually the one you have on your motherboard) or an ethernet adapter, or to inject some very specific bits of information about them (for example, I had to inject some value about my ethernet card so that OS X could correctly go to standby). There are other ways to inject information about your devices, what I spent the most time with was with ACPI tables (these tables are contained in your BIOS, you can search for what they contain. Hint: a ton of things). What you would usually do is get the ACPI tables from your BIOS, decompile them, fix all the errors you get (usually trivial ones, that's one way to see how much you OEM's bios sucks, sometimes you had to do this also to better support linux on your hardware), add whatever you needed, compile back and then use the special bootloader to override the tables provided by your BIOS (I think GRUB is also capable of this, also on linux if I well remember there's a setting in the kernel to enable overriding ACPI tables at runtime, not sure about this though). This is a good way to make your hardware look more like Apple hardware, and helps with standby/resume, audio enablement, if you want also 3d acceleration, and was required to be able to get intel speedstep working in OS X.

Now, you could say that modern PCs do not have BIOS anymore, they all have UEFI. True, but there is a catch: apple's EFI implementation (EFI is only a standard) is different from the UEFI. Now, UEFI/EFI is completely different from BIOS, so all that I described before about booting no longer applies. UEFI first is much more complex and bigger than BIOS (try to fit an UEFI firmware on a floppy, you tell me how many you will need). One of the things UEFI does is to actually support file systems (BIOS does not know about file systems), for example UEFI has a module to enable FAT support. This means that you do not need any more magic boot sectors, active partitions or MBR partitions tables (EFI/UEFI enables support for GPT, which removes all the previous limitations you had with MBR). In a UEFI system, you store in a FAT partition efi binaries that are actually applications that load your OS. The catch is, Macs use HFS partitions, not FAT, so you need an EFI implementation able to read HFS natively, and that's the first reason why you still use a specific "bootloader" (in a UEFI environment, it's just an efi binary). Then at this point you still need all the capabilities (and more) I described above.

Had a lot of fun playing with this things, but it's really time consuming.

If you want to dig into this a little instead of just having a really really really high level inaccurate description of how these "special bootloaders" work, try to check their documentation, you'll surely find a lot more (it'll require some good reading and learning, so definitely well spent time  :) ):

http://www.insanelymac.com/forum/files/file/347-clover-efi-bootloader/

http://chameleon.osx86.hu/ (looks like it's not used anymore, check maybe here for info: http://forum.voodooprojects.org/index.php/board,1.0.html )

More general good info:

http://wiki.osx86project.org/wiki/index.php/Dictionary

http://wiki.osx86project.org/wiki/index.php/Knowledge_Base

http://wiki.osx86project.org/wiki/index.php/EFI

 

Have fun. Even if you don't try any of these, it's anyway good information about hardware, ACPI, BIOS/UEFI. There's a lot more to learn about these things if you are interested, but I think just these will keep you busy for a while (I mean, even for the BIOS initialization part, which is "easy", you could write a book to explain what actually happens). Sorry for the long answer, I got a little carried away..

Link to comment
Share on other sites

Link to post
Share on other sites

-snip

I think you missed my point on what I said about entering the recovery state, Using the recovery keys you can get into recovery mode and just use which selected OS that you want to boot into - So I don't understand the point of having a bootloader when there already is one for the default Hackintosh OS, is it required to have a bootloader? 

Link to comment
Share on other sites

Link to post
Share on other sites

I think I still do not fully understand your question. What is recovery state/mode, and what do you mean by "recovery keys"?

If we are talking about booting OS X on a standard PC, you must have a boot environment (which is what I previously called bootloader to simplify things) that looks similar to the one you find on an Apple device. That boot environment usually is also able to boot whatever OS you want.

 

Generally speaking, on a BIOS system, you need a bootloader, on a UEFI system you don't.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×