Voodooprojects

Chameleon => General Discussion => Topic started by: tempolo on July 03, 2009, 09:30:15 PM

Title: TIP: Having problems with bad boot (boot0) loader? Here's a new solution
Post by: tempolo on July 03, 2009, 09:30:15 PM
Note: This is for boot loaders on PCs only, it won't fix your Mac boot loader in case you have accidentally installed Chameleon on its disk!

Most boot loaders for PC BIOS systems are looking in the partition table for a bootable partition.

E.g, the default boot loader looks in the MBR for an active partition. Chameleon's first boot stage (boot0) looks for a OS X EFI partition in order to continue loading its next stage (boot1h) before it can show a boot menu.

Now, if something got corrupted, e.g. if you accidentally reformat the OS X partition after having installed Chameleon, its second stage is gone and you're screwed because now you can not even boot your other partitions on that disk any more.

I've created a new solution for this:

Get my hex block editor iBored (http://apps.tempel.org/iBored/), v1.1.1 or later.
It runs on Mac OS X, Windows and (hopefully) Linux. It's a GUI app, so no dealing with command lines!

Simply launch it (on OS X you may have to go into the File menu and use Run as Root... in order to get access to all disks, and on Linux you also may have to run it with the sudo command).

Then you get a list of available disks. Select the disk your broken boot loader is on, then choose View Partitions from the Disk menu. In the ensuing window you can see the partitions of the disk.

Now choose Install "fixed" boot loader... from the Disk menu ("fixed" means unmovable here, not repaired. Could you propose a better term?).

You will get a dialog in which you can now choose the partition you want to boot from. Choose a partition such as the one with a working Windows or Linux system. Click Install.

Now you have a boot loader in block 0 (i.e. the MBR) that unconditionally loads the system from the location where the partition starts, because its block location is hard-coded into the loader (at offset 6, behind the text "LBA:"). As long as this partition doesn't get destroyed, you can boot into it this way. To change it to load a different partition, use iBored again the same way.

Note that this boot loader is only working with disks that use LBA addressing. Floppy disks are not working with this loader.

Source code for this boot loader (I called it "bootfix0") can be found at the bottom of my Asus 1008HA page: http://www.tempel.org/Hackintosh/Asus1008HA

Hope this helps.
Enjoy.

(Note: I will be away for two weeks starting tomorrow, July 4 09, so either ask your questions today or be patient.)


[Moderator Edit: Cheers tempolo, pure quality post ]