Start your K64

(K64 is short for Kernel-64bits.)

Last week end, I added some RAM stick into my laptop and so I wanted to make it run in 64bits to enjoy all the benefits from the added memory.

But, dear Apple had decided that my Macbook was not Pro enough to run a 64Bits kernel... I don't agree with that.

After a quick search through my dear friend Google, I found that I had to hack the boot.efi file of my MacBook. So without further addue, here is how to make your Macbook5,1 boot a kernel in 64 Bits. It might work with other Mac type, try it at your own risk and please report if it works for you !.

Requirements

You will need to know :

  • The model of your product
  • If your EFI is 64bits capable

To know the model of your product, follow this simple steps :

  • Click the "Apple" menu in the top right corner of your computer screen.
  • Select "About This Mac."
  • Click the "More Info" button to open the System Profiler. Alternatively, you can also access the System Profiler through the "Utilities" folder in your "Applications" folder.
  • Select "Hardware" from the column on the left. Your model name and identifier will appear in the right column with other important information about your Mac, such as the processor name and speed, memory and serial number. An example of a model name is "MacBook Pro," with an example model identifier "MacBook Pro 3.1." The serial number is a unique series of letters and numbers.

You must also check that your EFI is 64bit capable, to do so, invoke :

ioreg -l -p IODeviceTree | grep firmware-abi
It will return either "EFI32" or "EFI64".

Now either you do it the hard way, using 0xED or you just download this file and move on to the Installation section.

Hacking

Here is the raw patch : (don't use this, its just to show you what we are gonna do)

diff --git a/boot.txt b/boot64.txt
index b2115ac..36ec29a 100644
--- a/boot.txt
+++ b/boot64.txt
@@ -10350,11 +10350,11 @@
 00286d0: 5842 0200 0000 0000 0400 0000 0100 0000  XB..............
 00286e0: 0200 0000 0000 0000 0000 0000 0000 0000  ................
 00286f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
-0028700: 6042 0200 0000 0000 0000 0000 0000 0000  `B..............
-0028710: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0028700: 6042 0200 0000 0000 0400 0000 0100 0000  `B..............
+0028710: 0200 0000 0000 0000 0000 0000 0000 0000  ................
 0028720: 0000 0000 0000 0000 0000 0000 0000 0000  ................
-0028730: 6842 0200 0000 0000 0000 0000 0000 0000  hB..............
-0028740: 0000 0000 0000 0000 0000 0000 0000 0000  ................
+0028730: 6842 0200 0000 0000 0400 0000 0100 0000  hB..............
+0028740: 0200 0000 0000 0000 0000 0000 0000 0000  ................
 0028750: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 0028760: 7342 0200 0000 0000 0400 0000 0100 0000  sB..............
 0028770: 0100 0000 0000 0000 0000 0000 0000 0000  ................

Now to do it manually, here is a little screenshot of 0xED with the final result open. 0xED

To get there, follow theses simple steps :

  • Open boot.efi
  • Put 0xED in Overwrite mode (see the red arrow)
  • 1 - Type the offset you want to go to
  • 2 - Modify the hexadecimal value (don't insert)

You need to modify the following : (The old value are always 00)

Offsets - New Value
028708  -   04
02870c  -   01
028710  -   02
028738  -   04
02873c  -   01
028740  -   02

When you have done all the above modification. Save your file to your desktop with an alternate name, like boot64.efi

Installation

Once you downloaded the 64bit EFI or your hacked version, you need to do a few things for your Mac to boot with it.

$ sudo cp boot64.efi /System/Library/CoreServices/
$ cd /System/Library/CoreServices/
$ sudo chown root:wheel boot64.efi
$ sudo chflags uchg boot64.efi
$ sudo bless --folder /System/Library/CoreServices \ 
             --file /System/Library/CoreServices/boot64.efi

Edit /Library/Preferences/SystemConfiguration/com.apple.Boot.plist and add arch=x86_64 to the value of the Kernel Flags key. By default, this value is an empty string.

$ cat /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
...
<dict>
    <key>Kernel</key>
    <string>mach_kernel</string>
    <key>Kernel Flags</key>
    <string>arch=x86_64</string>
</dict>
...

If you do render your system unbootable, you can simply run bless again to restore volume bootability as it was before. That is, you can tell bless to use the original boot.efi. Of course, to do that, you'll need to either boot from a different volume (a system install disc would be fine), or be able to access and write to the unbootable volume from another computer.

$ sudo bless --folder /Volumes/Cerise/System/Library/CoreServices \
             --file /Volumes/Cerise/System/Library/CoreServices/boot.efi
Note :Replace Cerise by the name of your Mac's Hard Drive

How do I Tell ?

Open up System Profiler, click Software and you should see:

64-bit Kernel and Extensions: Yes

Enjoy !

feed ton aggrégateur !

/var/www/flickr

Lezardons !Port de BarfleurLumiere du PhareChemin du PhareMurakami Versailles #3Porte Doree VersaillesMurakami Versailles #1Panorama Phare de GatevilleJulia