Body Background

Archive for the ‘Bootloaders’ Category

Chameleon v2.0-RC4 AsereBLN myHack v1.0.1-r116

Wednesday, April 14th, 2010

This is a minor revision and important bugfix to my previous Chameleon release.

Read the full “Chameleon v2.0-RC4 AsereBLN myHack” bootloader release notes here.

Changelog:

v1.0.1 r116:

  • - Bugfix: Fix for “Memory allocation error! Addr=0xdeadbeef, Size=0×0″ – if no VESA resolution defined in com.apple.Boot.plist.
  • - Minor cosmetic changes.
  • - Improved “myHack” boot theme.

You may download Chameleon_v2.0-RC4_AsereBLN_myHack_v1.0.1-r116.tar.bz2 [binary only] here.
You may download Chameleon_v2.0-RC4_AsereBLN_myHack_v1.0.1-r116.src.tar.bz2 [source code] here.

Chameleon v2.0-RC4 AsereBLN myHack v1.0-r111

Thursday, March 4th, 2010

This version is now depreciated, consult the Downloads Page for a link to the latest version.

I have taken a snapshot from aserebln’s github (with all the changes he made up till 2010/02/12) and modified it with some additional alterations both cosmetic and functional, the most important of which was removing the pciroot detection he included from PCEFI 10.5 – it causes an unrecoverable memory fault on systems with integrated graphics cards (making it impossible to boot the system) and uses a different definition for PciRoot in com.apple.Boot.plist than myHack installer has been configured to define. It has been compiled without an integrated theme reducing it’s size and improving boot performance. This bootloader includes all of the features of Chameleon RC4 & PC EFI 10.5 + many bugfixes, syntax corrections, optimizations, and new features including but not limited to the following:

Note: Items which have been crossed out are a part of the memory detection code aserebln has been working on, however aserebln has not yet publicly released the source code for this memory detection. They will be included in any future release of this branch as soon as he releases the source code. Don’t worry though, this is purely cosmetic stuff – and if you really want your memory to be detected properly by OS X you can simply put the correct values into an smbios.plist in /Extra

AsereBLN changes:

  1. FACP RestartFix is enabled by default if you have an Intel CPU
  2. Memory Manufactor Code Lookup for some common Vendors (OCZ, G.Skill, GeIL, Crossair, Kingston)
  3. Fixed a bug with Memory Manufactor Code Lookup (DDR3: ManufactorID, Parity-Bit)
  4. Added Patriot, Crucial, A-DATA Memory Manufactor
  5. Support for 945 northbridge and ICH8, ICH7 southbridges
  6. SMBus Device Enable for systems there the controller is disabled (Tip from iNDi)
  7. printout a message if theme fails to load due to a missing file
  8. removed a print in non verbose mode to keep the Booter quiet
  9. You can supply a system-id with system-id= in com.apple.Boot.plist
  10. You can prevent the system-id injection with system-id=No in com.apple.Boot.plist
  11. system-type is now supported. Default is 1 (Desktop). Use system-type=2 in com.apple.Boot.plist if you have laptop.
  12. Removed the setVideoMode(TEXT) in resume.c to make Hibernation work.
  13. Support for 946GZ/PZ, Q963/Q965a and P965 northbridge memory controllers.
  14. Fixed a bug with system-type injection
  15. The system-type which gets injected is printed in verbose mode
  16. Added more memory manufactors.
  17. Support for 965GM and 965GME northbridge memory controllers (still untesteted).
  18. Improved system-type injection. ACPI V2 FACP PM_Profile is patched to match system-type.
  19. Fixed a bug with system-id injection (com.apple.Boot.plist).
  20. Supported memory manufactors: Micron, Samsung, Transcend, Apacer, Kingston, PNY, MDT, Corsair, GeIL, takeMS, Buffalo, Mushkin, OCZ, A-DATA, G.SKILL, TeamElite, Patriot and Crucial.
  21. Supported memory controllers: Core i5/i7 IMC, 945G/P, 955X, 945GM/PM, 945GME, 946GZ/PZ, Q963/Q965, P965, P35, X38/X48, 965GM, 965GME and P45.
  22. Supported SMBus controllers: P55, ICH10, ICH9, ICH8 and ICH7.
  23. To set system-type put a system-type= into com.apple.Boot.plist (1=Desktop, 2=Laptop enables Battery, 3=Workstation). Default system-type is 1 (Desktop).
  24. Fixed the font swapping bug (small & console font).
  25. Fixed a problem with disabled MCH MMIO on some mainboards (needed to detect dram frequency).
  26. Fixed the font swapping bug (small & console font) for the Booter with an embedded theme.
  27. Fixed an issue with memory detection for some mainboard (2 slot only mainboards).
  28. Added support for PM45 northbridge memory controller.
  29. Added memory manufactor lookup for: Hynix, Nanya, KingMax, Qimonda and SuperTalent.
  30. Added nVidia GT240 device lookup.
  31. You can now hide HFS partitions too using “Hide Partition” in com.apple.Boot.plist.
  32. Made the verbose output when using nVidia/ATI ROM’s more useful.
  33. Fixed a bug with sprintf (rek).
  34. Merged hibernation fix from Chameleon repo (46).
  35. Made verbosity at early bootstage useable.
  36. Added nVidia ION device lookup.
  37. Added a feature to set/override the nVidia NVCAP value using NVCAP_ key in com.apple.Boot.plist.

If you want to override the NVCAP value, you must determine the PCI DeviceID of your graphic card. For instance: my new GTX260 has the DeviceID 0×05e2. Knowing the DeviceID add this to your com.apple.Boot.plist:

<key>NVCAP_05e2</key>
<string>0000000000000000000000000000000000000000</string>

The NVCAP value is exactly 20 bytes long. You have to specify it in binary form using ASCII-HEX (0-9,a-f). For instance like this:

0400000000000300040000000000000700000000

It’s the NVCAP value of my nVidia 9400GT taken directly from NVCap Maker. Do not use a Base64 encoded NVCAP value like this one: BAAAAAAAAwAEAAAAAAAABwAAAAA=. To decode Base64 use the following command:

echo “BAAAAAAAAwAMAAAAAAAABwAAAAA=” | openssl enc -d -base64 | xxd -p

myHack changes:

  1. Removed pciroot uid detection code and reverted all references to it back to standard chameleon rc4 method
  2. Cleaned up cosmetic features such as version info output generation
  3. Added additional information to non-gui boot prompt

In conclusion, this is the best thing out there for retail installs on the systems which the myHack Installer has been designed and optimized for!

A big thanks to AsereBLN, netkas, rekursor, and everyone else who has worked on this!

You may download Chameleon_v2.0-RC4_AsereBLN_myHack_v1.0-r111.zip [binary only] here.

You may download Chameleon_v2.0-RC4_AsereBLN_myHack_v1.0-r111.src.zip [source code only] here.

Dual Booting Demystified

Monday, December 7th, 2009

I have had this question asked to me numerous times and some have suggested that a simple guide would be helpful to them. So here it is, a simple guide to creating a dual boot with OS X 10.6.x & Windows 7 on a single hard drive using the Chameleon bootloader. This is not the only way to achieve this goal but I am going to outline the methods I personally use which are among the simplest and easiest to duplicate.

Disclaimer: Repartitioning your hard drive can and will erase all data contained on it, resizing partitions with a utility like GParted may alter the partition table without destroying data but there is still a significant risk of failure and data loss. I strongly advise you to ensure you have backed up all important data before attempting ANY alteration of your existing partition structure. I am not liable for any data loss due to the (mis)use of this guide, I have warned you of the risks and advised you to make a backup of your data, I am not responsible for your data, you are!

Important Note: There are a lot of people who use GUID partition types for their hackintosh drive. While this arguably has some advantages when using OS X exclusively I personally advise against the use of GUID partition types, particularly when dual/multi-booting. It will only complicate matters and offers NO advantages over a standard MBR partition scheme in my opinion. This guide assumes you are using an MBR partition scheme – if you are using a GUID partition scheme I encourage you to switch it back to MBR or the instructions here may fail. (The instructions here should actually work for a GUID partitioned disk – but I have not tested them so if you choose to attempt it don’t be upset with me if it fails. If you happen to be one of those people who have their heart set on using a GUID partition scheme and you do test this method – please let me know your success/failure so I can include the information in this guide, be sure to include any additional instructions that you used (if any) so I can present the information as accurately and completely as possible.) **Important note: Older operating systems (Windows XP, older versions of linux, etc) will not function on a GUID partitioned device.

Section 1 : Basic Instructions

Step 1) Allocate space. Personally I plan in advance if I have the intention of dual-booting. So when I booted my trusty myHack USB Installer to install OS X on my system I used disk utility to create two partitions, the first being an HFS+ partition for OS X, the second being a FAT32 (MS-DOS) partition which I will later prepare for Windows 7 Installation. Since my drive is 1TB in size I just created two 500GB partitions for simplicity sake but adjust this to meet your individual needs. If you did not plan in advance you have three options, make a backup of your files and reinstall, make an image of your partition(s) and restore it after repartitioning the drive, or use a utility like GParted to resize the partition(s). Resizing partitions can take a very long time depending on how large they are so personally I’d just backup my files and reinstall but you decide what option works best for you.

Step 2) Install OS X. ( Please tell me you know how to do this by now ;p ). Yes, you can also install Windows 7 first but the methodology will be slightly different – I install OS X first so for the sake of this guide you should too. Ensure to boot to OS X and complete the post installation configuration and installation of myHack (Chameleon, pc efi, kexts, etc) to the installation drive and verify that it is booting without the USB drive attached and functioning properly before moving on to step 3.

Step 3) Install Windows 7. This should be fairly self explanatory but I will explain a few of the important details so you don’t get stuck. Boot the Windows 7 Installation DVD, begin the installation as normal. When you get to the “Which type of installation do you want” section choose “Custom (Advanced)” it will then ask you “Where do you want to install Windows” – choose the FAT32 (MS-DOS) partition we created in step 1 and click on “Drive options (advanced)”. Click format. Click OK. Click Next and proceed with the installation as normal. You have to format it with the Windows 7 installer before it will allow you to install Windows 7 on it because Windows 7 requires an NTFS formatted partition which is flagged as active. It will reboot a couple of times during the installation process, you will notice that the system will now boot directly to Windows 7 and you will no longer see the Chameleon boot prompt. After you have Windows 7 setup to your liking and are ready to fix the dual boot move on to step 4.

Step 4) Repair MBR. Windows 7 has infected your MBR… In the past you could simply set the active partition on the drive and it would boot to it but if you were to change the active partition now your system will hang at boot.We have to repair the damage Windows has done… Insert your handy dandy myHack USB Installer and use it to boot your OS X Installation (Boot to the USB Installer but at the Chameleon boot prompt select the OS X installation on the internal hard drive instead of booting to the Installer itself). Actually it doesn’t really matter if you boot the installer or the installed OS as we are only going to be using the terminal to repair the MBR but the internal hard drive boots more quickly and is more responsive in general so I choose it to save time. Once you have booted open a terminal and run the following commands (which I will guide you through step by step).

First lets get a list of the disks in your system so we target the correct one by running the “diskutil list” command.

myHack-Pro:~ Conti$ diskutil list
/dev/disk0
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:     FDisk_partition_scheme                        *1.0 TB     disk0
1:                  Apple_HFS myHack                  500.2 GB   disk0s1
2:               Windows_NTFS                         500.0 GB   disk0s2
/dev/disk1
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:     FDisk_partition_scheme                        *8.0 GB     disk1
1:                  Apple_HFS Mac OS X Install DVD    8.0 GB     disk1s1

As you can see I have two disks in my system, /dev/disk0 is the 1TB with two 500GB partitions on it, one Identified as Apple_HFS type and has the name I assigned it (myHack), the other is identified as Windows_NTFS type (This is Windows 7). /dev/disk1 as you can see is the 8GB USB Installer which I used to boot the system. You’re results will be different but the important thing to identify here is the /dev/disk# that contains your OS X & Windows 7 installations and the partition number of each of them, in my case OS X being on /dev/disk0 partition #1 and Windows 7 being on /dev/disk0 partition #2.

Next we are going to write a new MBR to /dev/disk0 by running the “sudo fdisk -u /dev/disk0″ command. (Replacing /dev/disk0 with the /dev/disk# your dual boot is installed on if different). If this is your first time using sudo on this system it will give you a warning message, ignore it… You will be prompted for your password, enter it and continue.

myHack-Pro:~ Conti$ sudo fdisk -u /dev/disk0

—————————————————–
—— ATTENTION – UPDATING MASTER BOOT RECORD ——
—————————————————–

Do you wish to write new MBR? [n] y

As you can see it displays a warning that it will update the MBR and it prompts you for confirmation. Enter “y” and hit enter to confirm as I have in the example above.

Now we are going to change the active partition to the one OS X (and Chameleon) is installed on. Run the “sudo fdisk -e /dev/disk0″ to open the disk in edit mode.

myHack-Pro:~ Conti$ sudo fdisk -e /dev/disk0
Enter ‘help’ for information
fdisk: 1>

You are now in edit mode, be careful here one wrong move and you’ll wipe the drive blank and be back to step1! Lets type “print” to view a list of the partitions on this drive and confirm that we are editing the correct drive and set the correct partition to active.

fdisk: 1> print
Disk: /dev/disk0    geometry: 121601/255/63 [1953523055 sectors]
Offset: 0    Signature: 0xAA55
Starting       Ending
#: id  cyl  hd sec -  cyl  hd sec [     start -       size]
————————————————————————
1: AF    0   1   1 – 1023 254  63 [        63 -  977027392] HFS+
*2: 07 1023 254  63 – 1023 254  63 [ 977027499 -  976495527] NTFS
3: 00    0   0   0 -    0   0   0 [         0 -          0] unused
4: 00    0   0   0 -    0   0   0 [         0 -          0] unused
fdisk: 1>

Ok so as we can see here partition 1 is HFS+, partition 2 is NTFS and that little asterisk before the 2 (*2: 07 1023 254  63 – 1023 254  63 [ 977027499 -  976495527] NTFS) means that this partition is flagged as active, if we were to reboot right now Windows 7 would boot as a result. We want that active flag to be on partition #1 so OS X / Chameleon loads and lets us then choose which of the partitions to boot from a nice graphical menu. Now that we have properly identified all the partitions lets type “flag 1″ to flag partition 1 as active. (Change the “flag #” partition number if your configuration is different!)

fdisk: 1> flag 1
Partition 1 marked active.

Done, now all we have to do is write the changes to the disk and reboot the computer. Type the “quit” command to write the current MBR to disk and exit fdisk.

fdisk:*1> quit
Writing current MBR to disk.
Device could not be accessed exclusively.
A reboot will be needed for changes to take

Step 5) Finish. Thats it, you’ve done it! Un-mount and remove the myHack USB disk and reboot the system with the internal disk. If all has gone well you will be greeted by the Chameleon boot prompt and you can easily select between OS X (which will be the default option) and Windows 7. Congratulations! Continue onto section 2 to learn more.

Section 2 : Troubleshooting & Multi-Boots

Section 2:a – Time synchronization

This is the most common problem that will be encountered when dual booting or multi booting with OS X on a PC. OS X sets your hardware clock to UTC (Coordinated Universal Time), windows and many Linux distributions on the other hand typically default to setting your hardware clock to “Local Time”. The “time zone” you are located in is considered local time – for example I am personally located in the UTC+9 time zone so when I set my clock in OS X it sets the hardware clock to UTC time (which will be 9 hours earlier than my local time). When I reboot into Windows or Linux they will assume my hardware clock is local time thus the clock will now be displaying UTC time which is 9 hours off from my local time. Fortunately this is very easy to resolve.

Part 1) Windows

To correct this problem in Windows 7/Vista we will need to edit the registry. Note: These instructions will not work for Windows XP.

At the windows desktop do the following:

If you would rather not edit the registry manually simply download and run this utcfix.reg file I created [download link] to import the data directly into your windows registry.

  • Exit all Windows-based programs.
  • Click Start, type regedit in the Start Search box, and then press ENTER.
  • If you receive the User Account Control dialog box, click Continue.
  • Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation
  • In the right pane, right click anywhere on the empty space and create a new DWORD (32-bit) Value. [NOTE: On 32-bit versions of Windows 7/Vista , you will only see D-WORD]
  • Name it RealTimeIsUniversal [NOTE: This is CaSe Sensitive so make sure it is exactly as shown here.]
  • In the right pane, right-click RealTimeIsUniversal in the Name column, and then click Modify.
  • In the Value data box, type 1, and then click OK.
  • On the File menu, click Exit to close Registry Editor.

This tells windows that your hardware clock is set to UTC and it will adjust for your time zone accordingly (the same way OS X does).

Next simply reboot into OS X and make sure your time is set correctly. The next time you reboot into Windows you should see the correct time – if not ensure that you have properly configured your time zone via the regional and language options in the control panel.

Part 2) Linux

To correct this problem in Linux requires a different process. Not all Linux distributions will be configured to set your hardware clock to a local time zone, some actually do use UTC by default but if you notice a time discrepancy do the following.

First we are going to open /etc/conf.d/clock in a text editor. In this example I will be using nano but if you do not have nano you could also use vi, pico, gedit, kate, or whatever text editor you like.

Open a terminal and type the following to open the file:

sudo nano /etc/conf.d/clock

(type your password)

Find the CLOCK= value.

It will likely appear as follows:

CLOCK=”local”

Change it to:

CLOCK=”UTC”

Save your changes and exit your text editor… (In nano it is ctrl+o to save changes and ctrl+x to exit.)

Now before we reboot we should make sure that we have set the correct local time zone. You may do this with a GUI tool… I do the following in my own flavor of Linux, it should apply to many but not all Linux distributions – consult your own distributions documentation if the following does not apply to you. I will be using my own time zone in the following example, you will have to adjust the commands to apply to your own location.

First you will want to locate your own time zone file in /usr/share/zoneinfo. I am in UTC+9 (Korean Standard Time) so my time zone file is located in /usr/share/zoneinfo/Asia/Seoul

Copy your time zone file to /etc/localtime by running the following command in a terminal.

sudo ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

Now open the /etc/conf.d/clock file back up and locate the TIMEZONE= value and set it to your own local timezone, for example mine looks like this:

TIMEZONE=”Asia/Seoul”

Save changes and exit your text editor. Now you should be all set to reboot.

Section 2:b – Windows BSOD when AHCI mode enabled

This issue typically arises on windows installations that existed before enabling AHCI mode in the bios. The cause of this issue is the AHCI driver (Msahci.sys) in Windows 7/Vista being disabled. This driver must be enabled before you change the SATA mode of the boot drive.

Why would the Msahci.sys driver be disabled?

During the Windows 7 or Windows Vista installation process, any unused storage drivers are disabled. This behavior speeds up the operating system’s startup process. When you change the boot drive to a driver that has been disabled, you must enable the new driver before you change the hardware configuration.

How can I enable the Msahci.sys driver?

Well first you will have to disable AHCI mode in your bios temporarily to be able to get back into Windows… Go ahead and boot windows normally (it may prompt you to load recovery console because it will have detected that there was a BSOD the last time you attempted to boot the OS, you do not need to enter the recovery console so select boot windows normally and continue). After you get to the windows desktop do the following:

If you would rather not edit the registry manually simply download and run this ahci.reg file I created [download link] to import the data directly into your windows registry.

  • Exit all Windows-based programs.
  • Click Start, type regedit in the Start Search box, and then press ENTER.
  • If you receive the User Account Control dialog box, click Continue.
  • Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
  • In the right pane, right-click Start in the Name column, and then click Modify.
  • In the Value data box, type 0, and then click OK.
  • On the File menu, click Exit to close Registry Editor.

After you have edited the registry (or imported the ahci.reg file I provided above) you will need to restart your computer, go back into your BIOS setup and re-enable AHCI. When you login to Windows again, you’ll notice the installation of drivers for AHCI. Another restart will be required to finish the driver installation.

Section 2:c – Multi-Boot Configuration

This section will eventually focus on configurations that involve more than just OS X 10.6 and Windows7. I intend to add a linux example to this section as soon as I have some more time to work on it.

Conclusion

It is my hope that this tutorial will help you to easily setup your own dual boot and that it will also help you to understand the underlying principals involved.

Cheers

- Conti

How to repair your REAL Mac if you broke it with the chameleon bootloader.

Sunday, October 18th, 2009

This post is intended only for actual Apple (Mac) computer systems that are not booting due to accidental installation of the chameleon bootloader to the Apple computer system’s hard drive.

If you are one of the unlucky ones who ignored my numerous warnings or just accidentally pressed the wrong button while running the myHack installer from a real MAC here is an example of how to repair the partition scheme on a real MAC so that it will boot again – after accidentally installing the chameleon bootloader to the MAC’s internal hdd.

Note: I have not tested this myself – I’m not that adventurous when it comes to my real MAC, however these commands should work. Ultimately if nothing posted here works you will likely have to wipe the drive out completely and re-install OS X.

WARNING: Do not perform any of the following actions without backing up your critical data first. Fiddling with partition tables is dangerous. A simple typo could lead to complete data loss. You have been warned! [ You can backup critical data even if you can not access the system, if absolutely necessary, by removing the internal hdd and plugging it into another computer, the use of data recovery software may be required depending on circumstances. ]

GUID SOLUTION:

1) Boot your mac with an OS X Install DVD (doesn’t matter which version, whatever is installed on your system would be best).
2) Start Disk Utility
3) Select the OS X HDD/SSD that you screwed up (not specific partition)
4) Go to the Partition tab
5) Grab the lower right corner of your key partition and resize it a little bit (no matter how much/little you resize it as long as you change the partition size)
6) Click Apply. Relax, this will NOT erase your HDD/SSD, it only rewrites your GUID partition data that will fix your HDD/SSD.
7) Quit the Disk Utility and reboot.
8) Enjoy your restored Mac that should now boot normally!

MBR SOLUTION:

Boot your mac with an OS X Install DVD (doesn’t matter which version, whatever is installed on your system would be best) and use Terminal on it to run the following commands.

Once booted into the GUI, open a terminal and type

diskutil list

to get a list of all disks on your system. Assuming /dev/disk2 is your problematic disk with the MBR partition scheme, type

sudo fdisk /dev/disk2

to verify the current partitions on it (should list partitions on the disk, if not don’t worry it’s likely because of the chameleon bootloader). This command will not apply any changes. The drive with an “*” next to it is the active partition (if any). Now type

sudo fdisk -u /dev/disk2

which writes a new MBR (master boot record) while keeping current partition information.

In order to be able to boot from a partition, it must be flagged active. Type

sudo fdisk -e /dev/disk2

to open the drive in fdisk’s editing mode. It will possibly complain “could not open MBR file /usr/standalone/i386/boot0: No such file or directory”, this should be safe to ignore. The following transcript shows what to do next:

fdisk: 1> flag 2
Partition 2 marked active.
fdisk:*1> quit
Writing current MBR to disk.

You’re done! Cross your fingers and reboot your MAC…

If any of this is confusing to you please read the OS X fdisk man page for more information.