Jump to content
  • Donate

    OSX86.NET lives on your donations!  Please contribute what you can so we can get rid of those pesky ads !

Sign in to follow this  
mongole

What's happening at boot time....

Recommended Posts

Hi,

I have played around allready some time trying to install SL on my system. Again and I have problems getting boot loaders to work. Hence I decided to write down what's happening on boot time to check, whether I got it right. If I get corrections on my misunderstandings, I will correct them in my first post. I hope this helps newcomers as well. Thanks for every note about failures, misunderstandings and errors. Except typos ;-)

So let's start. This should describe a boot process with Chameleon 2 RC3 on a GUID formatted disc/USB stick:

  • After startup BIOS loads the boot0 MBR from disk (/dev/diskX) set up in the BIOS (Wiki Article)
  • This chains to boot1h which is written to the beginning of the chosen partition/slice (/dev/diskXs2 2 as it is a GUID slice). (Wiki Article) The boot1h supports HFS+. Hence it's capable to load the boot file from Chameleon in the /dev/diskXs2 partition.
  • Now Chameleon takes over and initalses itself
  • loads com.apple.Boot.plist (AsereBLN Blog, AsereBLN Blog) and reads out the configuration
  • scan's for bootable disks/partitions
  • shows the boot screen/text menu
  • after selection of the hard disk it scan's the hardware and checks the processor (amd/intel)
  • tries to resume after a hibernation. if no hibernation it continues with:
  • the kernel is looked for and decoded
  • kexts are loaded
  • fake EFI is set up.
  • dsdt.aml (AsereBLN Blog Entry) is loaded (if it exists under /Exta) to replace the original one.
  • the kernel is started and control is handed over to Mac OS X to continue booting from the choosen partition. (Apple Developer Dokumenation )

This should be it more or less. Very impressing, what's going on under the hood. Was happy to still be able to read some C, but coding....

I hope this helps somebody as well to understand what's going on and why things might not work as expected.

Share this post


Link to post
Share on other sites
* After startup BIOS loads the boot0 MBR from disk (/dev/diskX) set up in the BIOS (Wiki Article)

yes

*This chains to boot1h which is written to the beginning of the chosen partition/slice (/dev/diskXs2 2 as it is a GUID slice). (Wiki Article)

yes

Then it goes further this way. boot1h has HFS+ support. It starts parsing the partition which contains the boot1h and searches the file boot, which is actually the Chameleon bootloader. If boot1h finds boot, then boot1h loads boot into memory and starts it.

Chamleon does a lot of things. If you are curious about what it does, look into the source code. i386/boot2/boot.c. The entrypoint from boot1h is the function void boot(int biosdev)...

Share this post


Link to post
Share on other sites

Thanks for the hint. I will have a look at the source. I am afraid my C skills got really rusty...

Regarding the boot process. Is it correct, the reason the MBR is used to boot, is because of BIOS can't handle the GUID boot process. So the saved space for the MBR (normally reserved for the dummy MBR) is used for a real one which then loads boot1h and so on?

This means the benefits of the second GPT on the end of the disk is not valid in the case of the Hackintosh boot process? The MBR can't handle ist, it just points to the boot1h if I am correct. What happen's later is still a miracle for me *gg* But maybe in some hours....

What's the benefit then to use the GUID partition shema? Only to be closer to a real mac except the boot process?

greets

Share this post


Link to post
Share on other sites

Great work. As you can see there is much more to do, than only the efi stuff, to boot up OS X. So writing an own efi implementation, even from scratch, isn't enough at all ;)

Hehe... and the source is always the best doc available.

So, I have updated the first post with my findings from the source analysis of the Chameleon 2 RC 3.

I hope others will find it useful.

Share this post


Link to post
Share on other sites
Hehe... and the source is always the best doc available.

:D That's garanteed for sure! Sometimes even easier to understand then "real" documentation...

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×