overdue-scratch

Author Topic: Please give more details on the boot process  (Read 3779 times)

0 Members and 1 Guest are viewing this topic.

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Please give more details on the boot process
« on: June 13, 2009, 05:47:09 PM »
Hi, I'm rather new to hackintoshing, but I've been a Mac software developer for about 15 years.

I have some understanding of low level things, e.g. I've written a x-platform GUI disk editor to analyse various file systems and fix classic iPods with iPodLinux on them ("iBored"), but I have little to no understand of the OS X boot process so far.

As I am trying to get OSX running on a Asus 1008HA, for which there is no complete solution yet, I like to ask a few questions that may help me understand and debug a few things:

First, where exactly is defined where the boot loader looks for the Extras folder? Does it always look automatically for an EFI partition and looks inside for a HFS+ partition and the Extras folder therein, and if it doesn't find it there, does it keep looking on all other HFS+ partitions until it finds one?

Or is the locatition hard-coded into the boot loader (probably boot0 and boot1h, right?) at the time it gets copied into MBR or GUID book block?

Furthermore, if the disk uses classic MBR partitioning, where does the boot0 end up? Does it really fit into the ~220 bytes of block 0 on the disk? Or where's the rest of it, exactly? (I like to find it on the disk)

And I assume that this boot0 code then uses the PC BIOS calls to load more code and finally the EFI emulator, is that right? Where is this EFI emulator? Is that in the "boot" file? That would mean that the boot0 code already has to be able to read HFS+, because the boot file is in a HFS+ partition, right?

I like to understand all this because I might want to make a tool that install all this into a vanilla Asus Eee PC 1008HA, which comes with one Windows XP partition (no Linux option so far) and one more large and free partition. It even seems to have an EFI partition at the end, apparently for performing BIOS updates. I like to make it so that the EFI bootload files get installed on the PC and then allow the second, free, partition to be used to install OS X into. Hence I need to know where what goes, and how it might interfere with the present stuff.

Next, after searching many hours, I still have not found an explanation on how the Extra's kexts are actually getting loaded...

Until then, I thought OS X would boot like this:
1. kernel gets loaded. It has already code to read HFS+ built-in
2. kernel sets up its data structures, then finds the Extensions folder and parses the kexts, using some passive and active matching algos to load the kexts and run them to take over parts of the hardware.
3. From there on it's easy.

However, all the talk here suggests that the Chameleon bootloader is loading the kexts itself. How could that work? I mean, doesn't the bootload come before the kernel gets run? How can the bootloader then load kexts into the kernel before the kernel is ready to accept them?

I suspect that the information given here before was not precise.

Other bits I found suggest that at some point in the boot process a "device tree" is created, which reflects the actual installment of hardware during startup.

Is it right that this device tree gets created before the kernel gets loaded and run, and then the kernel reads this device tree information to device which kexts to load?

If that is so, I assume that the device tree also contains the full paths to the kexts, so that the code that creates the tree can specify to load kexts from our Extras folder. Is that correct?

I hope I'm on the right track here.

Now, on a normal Mac, I've learned that some EFI code is run which is probably what creates the device tree and then invokes the kernel.

How does that compare to a Hackintosh with an EFI emulator? Does Apple's EFI code get run there as well? Or is Chameleon the replacement for Apple's EFI code, creating the device tree and launching the kernel? If the latter, I guess that the EFI emulator is only needed to provide the kernel with basic access functions, such as for reading from disk, doing keyboard input, writing to the screen, etc?

Finally, what does the dsdt.aml file do? I get the impression it is a copy of the device tree. So is that what Chameleon prefers to use to tell the kernel about the device tree - and only if this file is not present, Chameleon needs to create the dev tree from scratch, which not only takes longer but may cause wrong guesses, leading to troubles booting the OS?

OK, if that all can be answered well, I think I can write an article on this so that others won't have to inquire this all again. And then get this darn 1008HA boot without "-f -x" eventually, and provide an easy installer for others.


rocksteady

  • Global Moderator
  • Posts: 233
  • Root Down
Please give more details on the boot process
« Reply #1 on: June 14, 2009, 10:50:23 PM »
Hi tempolo,
Nice to see devs here,

OK, if that all can be answered well,

Correct, we're trying to answer 1 question @ a time till we come up with finished documentation + faq guides

I think I can write an article on this so that others won't have to inquire this all again. And then get this darn 1008HA boot without "-f -x" eventually, and provide an easy installer for others.

Please do, if you can come up with Chameleon-specific tips/guide, post 'em here. Lend a hand anywhere you can :)
« Last Edit: June 14, 2009, 10:55:27 PM by rocksteady »
Stop bitching, start coding or documenting or both..

P5Q-EM : Q6600 : 8GB RAM : 8800GT : SATA Drives

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Re: Please give more details on the boot process
« Reply #2 on: June 14, 2009, 11:04:16 PM »
@rocksteady. If you cannot answer my questions, who could? Would I better be asking these questions at the hungarian website where chameleon comes from?

Whoops - wait. This _is_ that site. I got a bit confused. Too many hackintosh related pages I'm browsing and commenting on these days...

OK, so how do I get answers to some implementation details on the boot loader then? I've downloaded the 1.0.11 source, but I still have a few questions as reading x86 asm isn't _that_ easy, and since the comments aren't very verbose, either, when it comes to explaining some procedures.

« Last Edit: June 14, 2009, 11:10:28 PM by tempolo »

rocksteady

  • Global Moderator
  • Posts: 233
  • Root Down
Re: Please give more details on the boot process
« Reply #3 on: June 14, 2009, 11:13:11 PM »
No, no need to go to the .hu site. These are the official forums anyway. Just bare with us for a while, I have a few newbie-friendly faqs in the pipeline and the devs are working on the next release + docs.
Stop bitching, start coding or documenting or both..

P5Q-EM : Q6600 : 8GB RAM : 8800GT : SATA Drives

Lord Anubis

  • Member
  • Posts: 74
Re: Please give more details on the boot process
« Reply #4 on: June 15, 2009, 12:19:50 AM »
Hi tempolo,

The current problem is that the older code which is available, is 'old' and far from the current situation.
Not that I want to say it isn't working, but the devs are bysu with things that isn't public yet.
Last two weeks I was busy witht he older code, of course things changed with what Cham 2 installs. The behaviour is changed. I did stop because I was walking far behind the current situation.
Its realy pitty that the dev are not answering our questions. But on the bright side, they are busy with other important things. We have to wait. Somewhere a dev wrote about 'soon'! I also hope they show us the promissed updated source code.

For the moment, nobody wthout inside info, can answer the questions, only figure out what we see, but it is sometimes different then what people tells us in the to many different forums. Some can setup FAQs with comments what is figured out, but I believe they are a subject to change. @Rocksteady, if you have inside info from the devs, yes please continue, otherwise please wait till the next RC or GM. I am afraid, if the FAQ is not about common things, it will more confuse the people.

HTH
Quicksilver 2002 Case - GB EP45-DS3P - 8Gb Kingston mem. - Q6600 - Asus 7300GT Silent 512Mb - 6 SATA drives - 1 IDE drives ( using F12/Chameleon for booting, not visible in OSX ) - 1 external Sata Samsung DVD - OSX 10.6.8 server retail - Chameleon 2.0RC1 + Cartri Bios

rocksteady

  • Global Moderator
  • Posts: 233
  • Root Down
Re: Please give more details on the boot process
« Reply #5 on: June 15, 2009, 01:33:05 PM »
Hi Anubis  :)

@Rocksteady, if you have inside info from the devs, yes please continue, otherwise please wait till the next RC or GM. I am afraid, if the FAQ is not about common things, it will more confuse the people.

My thoughts exactly. 

For the record, I was referring to common vfaqs like installing, booting etc. Nothing to do with the source code. This will be released only by the official dev team.

By the way, since tempolo's thoughts (including yours, mine and a few others) are more or less Dev Talk, I wouldn't hurry until the source is ready.

Also, given the latest "trend" of lots of smart-asses (who follow guides left + right, high + low) selling "serious hackintosh-ready" bullshit to ignorant people, I'd prefer to talk about something when it's ready.

Tempolo: I see you splitted this one self-contained post into multiple questions. Good to see that you're following up to them, If you get everything pretty much SOLVED, let me know so I can merge it into this single thread.


For the shake of Dev. guidelines: How to submit code for VoodooLabs projects
« Last Edit: June 15, 2009, 01:35:48 PM by rocksteady »
Stop bitching, start coding or documenting or both..

P5Q-EM : Q6600 : 8GB RAM : 8800GT : SATA Drives