Jump to content

[Guide] Boot from EFI partition, zero modification installs on Intel SSE2 or better...


munky
 Share

1,404 posts in this topic

Recommended Posts

can somebody tell me the difference between /dev/disk0/ and /dev/rdisk0/ I read that it is the difference between "block device" and "character/raw device" and a block device double buffers "h/w+s/w" the file whereas the raw only hardware buffers.. but can someone try and come up with some kind of analogy as to what happens differently between writing the boot and booth files to /dev/disk0 and /dev/rdisk0

 

thanks

Link to comment
Share on other sites

Hi munky,

 

Thank you very much for the guide. I'm using MACinized's Boot-132 usb to boot retail Mac OS X 10.5.6 DVD. I create two partition on external hard disk; Boot-132 usb restored to first partition & Mac OS X 10.5.6 DVD restored to second partition. Using that external hard disk to install retail leopard to internal hard disk (GUID) on my Acer Aspire 3680. After installation, I use v6.1 package to create EFI boot partition.

 

Thank you again for the guide & tools. I really appreciate it. :(

 

kizwan

Link to comment
Share on other sites

Edit:

Removed links to my script as that post got deleted by some moderator. Sorry about that. I'll post the script here, hope it will not be removed.

 

can somebody tell me the difference between /dev/disk0/ and /dev/rdisk0/ I read that it is the difference between "block device" and "character/raw device" and a block device double buffers "h/w+s/w" the file whereas the raw only hardware buffers.. but can someone try and come up with some kind of analogy as to what happens differently between writing the boot and booth files to /dev/disk0 and /dev/rdisk0

As you say, "rdisk" is the block device. It is never "locked", meaning that you can screw it up even while you have mounted it somewhere. with "disk" that would typically result in a warning "Permission denied".

 

Also, as you said correctly, "rdisk" only supports blockwise reading and writing.

 

For example, if you want to backup the MBR (first 446 bytes) with dd, it would be great to use the raw device, but this does not work: The block device can only read blocks of fixed size (usually 512 bytes with hard disks) at once. Hence, either you need to use the "disk" device or first use dd to get the first 512 bytes into a file and then use dd on the file again to extract the first 446 bytes from that file.

 

Now to restore the MBR but not overwrite the partition table (which comes after the MBR, separated by two NULL bytes and is 64 bytes long), you need to use the character device OR again take a two step approach as outlined above.

 

It's best to use fdisk to operate on the MBR I think.

 

what do I have to consider when I change from your bootloader to chameleon? is the installation procedure similar?

The main difference is that Munky's EFI boot loader reads kexts from /Extensions or /System/Booter/Extensions.mkext, plus other files from the root directory. In contrast, Chameleon expects everything to be in the /Extra directory.

 

The installation of the boot loader itself is exactly the same (fdisk the MBR, dd the partition boot sector, and copy the last stage file to the root directory).

 

The script "EFI-HFS-to-chameleon.sh" does all the work for you. And if you want to do it by hand, the script by default only shows you all the commands it would run.

 

If you would like to re-format back to FAT, Chameleon also supports booting directly from a FAT partition. I have not tried that yet, though. Maybe using the search facility, you can find reports from other users.

Link to comment
Share on other sites

As you say, "rdisk" is the block device. It is never "locked", meaning that you can screw it up even while you have mounted it somewhere. with "disk" that would typically result in a warning "Permission denied".

 

Also, as you said correctly, "rdisk" only supports blockwise reading and writing.

 

For example, if you want to backup the MBR (first 446 bytes) with dd, it would be great to use the raw device, but this does not work: The block device can only read blocks of fixed size (usually 512 bytes with hard disks) at once. Hence, either you need to use the "disk" device or first use dd to get the first 512 bytes into a file and then use dd on the file again to extract the first 446 bytes from that file.

 

Now to restore the MBR but not overwrite the partition table (which comes after the MBR, separated by two NULL bytes and is 64 bytes long), you need to use the character device OR again take a two step approach as outlined above.

 

It's best to use fdisk to operate on the MBR I think.

 

There's a script that does all the work for you and it also shows you all the commands it would run.

 

 

 

The main difference is that Munky's EFI boot loader reads kexts from /Extensions or /System/Booter/Extensions.mkext, plus other files from the root directory. In contrast, Chameleon expects everything to be in the /Extra directory.

 

The installation of the boot loader itself is exactly the same (fdisk the MBR, dd the partition boot sector, and copy the last stage file to the root directory).

 

If you would like to keep your EFI partition HFS+ formatted, you can simply use this script.

 

If you would like to re-format back to FAT, Chameleon also supports booting directly from a FAT partition. I have not tried that yet, though. Maybe using the search facility, you can find reports from other users.

 

Thank you. I have managed to install the chameleon bootloader very easily.

Link to comment
Share on other sites

I used the grub dfe bootloader posted on another forum published by Sling to install the retail 10.5.6 DVD, worked perfectly. To boot off the HD I installed Chameleon-2.0-r431.pkg. When I boot off the HD and select OSX which then launches Darwin, OSX begins to boot but seems to hang on SAM /Volumes/EFI read / write failed error x04 x3e x02. So I take it that I missed an additional step? I thought the Chameleon pkg was suppose to do all the manual stuff automcatically. Suggestions?

Link to comment
Share on other sites

LATEST UPDATES:

 

- *** CHAMELEON 2 RC1 is out and looks pretty damned *amazing* - go check it out! It does everything this bootloader does and far more ***

Thanks so much for your efforts, Munky!

My post about a script to modify the EFI partition for Chameleon 2 got deleted, so I'm reposting the main info here.

I hope you don't mind.

 

Modify EFI HFS Boot Partition for Chameleon 2

 

Note: If you do not use Munky's EFI boot method, please use the official Chameleon 2 installer.

 

This script copies the files that are distributed over your HFS+ EFI boot partition to the "Extra" directory that is used by the recently released Chameleon 2.0-RC1.

After this, the script also installs this new boot loader.

 

No Modifications by Default

By default, the script only prints what would be done.

This allow you to check if everything is set up correctly.

Once the script is set up for your configuration, the whole process is a matter of seconds.

Prerequisites

Your EFI boot partition needs to be set up according to Munky's EFI boot tutorial.

The script also supports non-vanilla kernels, simply because there is nothing the script can do to help. This is all configured in your "com.apple.Boot.plist" file; this file is copied to the "Extra" directory, where it is expected by Chameleon 2.

 

Ask yourself how you are going to fix your EFI boot partition if something goes wrong. Remember, this script and Chameleon 2.0-RC1 are not yet widely tested.

 

Usage

The script is a simple bash script that is run in the Terminal.

  1. Download "Chameleon-2.0RC1-r431-bin.tar" and make sure it is in your "Downloads" folder in your home directory, i.e. /Users/<your user name>/Downloads.
  2. Open Terminal and open a new window
  3. Download the attached ".zip" file and extract the shell script. Ensure it is called "EFI-HFS-to-chameleon.sh"
  4. Drag-and-drop the shell script into the Terminal window (do NOT press Return yet)
  5. Type the so-called "Disk Identifier" of the disk you wish to modify, i.e. "disk0" or "disk1". The command line should look like this:
    /Users/admin/Downloads/EFI-HFS-to-chameleon.sh disk0


  6. Take a deep breath and press Return

That's it. Well, at least the script will print what would be done and notify you of any issues it encounters. If there are issues, see the next section on how to adapt the script. It's really easy.

 

Preview Command Output

If you would like to see the shell commands the script would run, call the script as follows:

/Users/admin/Downloads/EFI-HFS-to-chameleon.sh disk0 2>/dev/null

This redirects the "STDERR" stream from the script to the digital nirvana and you only get to see the commands the script performs, which are output on the "STDOUT" stream.

Here's an example of what would be done on my system.

admin@blue ~$ /Users/admin/Downloads/EFI-HFS-to-chameleon.sh \
disk0 2>/dev/null
/usr/bin/sudo 'mkdir' '/Volumes/EFI/Extra'
/usr/bin/sudo 'cp' '-pR' \
   '/Volumes/EFI/Extensions' '/Volumes/EFI/Extra/'
/usr/bin/sudo 'cp' '-pR' \
   '/Volumes/EFI/System/Booter/Extensions.mkext' '/Volumes/EFI/Extra/'
/usr/bin/sudo 'cp' '-pR' \
   '/Volumes/EFI/com.apple.Boot.plist' '/Volumes/EFI/Extra/'
/usr/bin/sudo 'cp' '-pR' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/Themes' \
   '/Volumes/EFI/Extra/'
/usr/bin/sudo 'cp' '-pR' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/smbios.plist' \
   '/Volumes/EFI/Extra/'
/usr/bin/sudo 'cp' '-p' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot' '/Volumes/EFI'
/usr/bin/sudo 'sync'
/usr/bin/sudo 'fdisk' '-f' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot0' \
   '-u' '-y' '/dev/rdisk0'
/usr/bin/sudo 'dd' \
   'if=/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot1h' \
   'of=/dev/rdisk0s1'

 

Applying the Modifications

Once the script runs through without errors, you set the variable "MODIFY=1" to apply the modifications. This is accmplished by calling the script as outlined below:

MODIFY=1 /Users/admin/Downloads/EFI-HFS-to-chameleon.sh disk0

This will first set the variable and then call the script.

 

Here's an example of the script running on my system with full output.

 admin@blue ~$ time MODIFY=1 \
   /Users/admin/Downloads/EFI-HFS-to-chameleon.sh disk0

Proceeding with disk identifier disk0
Check partition type:  "EFI"

Verify that all items we need are available

Verify Chameleon boot loader items (i386 directory)...
   Check "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot0"...OK
   Check "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot1h"...OK
   Check "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot"...OK
All items are there

Verify rest of Chameleon items (Extra directory)...
   Check "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/Themes"...OK
   Check "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/smbios.plist"...OK
All items are there


Make sure EFI partition "/dev/disk0s1" is not mounted...
Mount it at "/Volumes/EFI"
Trying to mount "/dev/disk0s1" at "/Volumes/EFI"...OK.

Check contents of EFI partition

Verify items from Munky's boot loader on EFI partition...
   Check "/Volumes/EFI/Extensions"...OK
   Check "/Volumes/EFI/System/Booter/Extensions.mkext"...OK
   Check "/Volumes/EFI/com.apple.Boot.plist"...OK
All items are there



*** Setting up Chameleon 2.0-RC1 on disk disk0 ***



################## COMMITTING CHANGES #####################




*** First, we create the "Extra" directory 
and re-arrange the stuff from Munky's method

/usr/bin/sudo 'mkdir' '/Volumes/EFI/Extra'
Copying "/Volumes/EFI/Extensions" to Extra directory
/usr/bin/sudo 'cp' '-pR' '/Volumes/EFI/Extensions' '/Volumes/EFI/Extra/'
Copying "/Volumes/EFI/System/Booter/Extensions.mkext" to Extra directory
/usr/bin/sudo 'cp' '-pR' '/Volumes/EFI/System/Booter/Extensions.mkext' '/Volumes/EFI/Extra/'
Copying "/Volumes/EFI/com.apple.Boot.plist" to Extra directory
/usr/bin/sudo 'cp' '-pR' '/Volumes/EFI/com.apple.Boot.plist' '/Volumes/EFI/Extra/'

*** First step done

*** Second, we copy the remaining items 
from Chameleon to EFI partition...

Copying "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/Themes" \
   to Extra directory
/usr/bin/sudo 'cp' '-pR' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/Themes' \
   '/Volumes/EFI/Extra/'
Copying "/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/smbios.plist" \
   to Extra directory
/usr/bin/sudo 'cp' '-pR' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/Optional Extras/smbios.plist' \
   '/Volumes/EFI/Extra/'

*** Second step done

*** Third, install the last stage boot loader
(the file called "boot" at the root of the disk)

/usr/bin/sudo 'cp' '-p' \
   '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot' '/Volumes/EFI'
/usr/bin/sudo 'sync'

*** Third step done

*** Finally, we un-mount the EFI partition
and we install the MBR to "/dev/rdisk0"
and the partition boot record to "/dev/rdisk0s1

Trying to un-mount "/dev/disk0s1"...OK.
/usr/bin/sudo 'fdisk' \
   '-f' '/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot0' \
   '-u' '-y' '/dev/rdisk0'
/usr/bin/sudo 'dd' \
   'if=/Users/admin/Downloads/Chameleon-2.0RC1-r431-bin/i386/boot1h' \
   'of=/dev/rdisk0s1'

All finished successfully. Have fun with your new bootloader!


real    0m1.258s
user    0m0.207s
sys     0m0.277s

As you can see, on my system it takes less than 2 seconds from Munky's EFI boot to Chameleon 2.0-RC1.

 

 

Adapting the Script

Depending on your set up, you may need to edit the script a little bit.

In particular, you may need to edit the following part:

# Path to your Downloads folder
DOWNLOADS="$HOME/Downloads"

# Path to Chameleon-2.0RC1-r{$BUILD}-bin directory
CHAMDIR="$DOWNLOADS/Chameleon-2.0RC1-r${BUILD}-bin"

# Path to "Extra" directory in Chameleon-2.0RC1-r${BUILD}-bin directory
# Note: This path has changed in the past, so please check if it 
# is still valid for your version of Chameleon 2
CHAM_EXTRA="$CHAMDIR/Optional Extras"

# Items from the Chameleon-2.0RC1-r${BUILD}-bin "Extra" directory
# As this may change, please check if the list is still valid for your version
# of Chameleon 2 and if you really need or want all these items
# Note: If any item does not exist, the script aborts
CHAM_EXTRA_ITEMS=('Themes')
CHAM_EXTRA_ITEMS+=('smbios.plist')

# Path to "Extra" directory in Chameleon-2.0RC1-r${BUILD}-bin directory
# Note: This path has changed in the past, so please check if it 
# is still valid for your version of Chameleon 2
CHAM_BOOT="$CHAMDIR/i386"
CHAM_BOOT_ITEMS=('boot0' 'boot1h' 'boot')


# Items from Munky's EFI booter in the EFI partition root directory
# Note: Please check which of these items you need. They will be
# copied to the Chameleon-2 Extra directory
# Note: If any item does not exist, the script aborts
MUNKY_ROOT_ITEMS=('Extensions' 'System/Booter/Extensions.mkext')
# Uncomment to add com.apple.Boot.plist
MUNKY_ROOT_ITEMS+=('com.apple.Boot.plist')
# Uncomment to add DSDT.aml
#MUNKY_ROOT_ITEMS+=('DSDT.aml')

 

Newer Builds of Chameleon 2-RC1

First, check if the layout of the Chameleon distribution archive ("Chameleon-2.0RC1-r<build>-bin.tar") is still the same, or adapt the script accordingly. The layout of this archive has changed in the past, and it may change again.

For a newer build version, at the very least you need to change the BUILD variable at the top of the script.

 

 

The latest version of the script is provided as a ".zip" file below.

 

Download

EFI_HFS_to_chameleon.sh.zip

New releases will be added here.

 

Questions and Feedback

Thanks a lot for your questions and problem reports. Please do NOT ask Munky or the Chameleon team questions relating to this script. Instead, please add a post below or PM me.

 

If your system boots, then the script has probably worked. Questions about Chameleon 2.0-RC1 are best posted to this post about Chameleon 2.0-RC1, which is also read by all other users who may be more competent to help than me.

Link to comment
Share on other sites

Will the script also take into account that munkys instructions in this thread may require the mach_kernel.voodoo in the EFI directory, how will this script work with that.

 

I have seen a couple of people post that when they copy mach_kernel.voodoo into Extras it won't boot and nobody has posted a definitive answer on where exactly it must be put for the chameleon boot to work using the voodoo kernel.

 

The voodoo option is in phase 4 of munky's instructions:

4) if necessary, copy patched kernel into /Volumes/EFI/ (eg:

 

cd <directory containing the wonderful Voodoo kernel)

cp mach_kernel.voodoo /Volumes/EFI/

Link to comment
Share on other sites

Will the script also take into account that munkys instructions in this thread may require the mach_kernel.voodoo in the EFI directory, how will this script work with that.

 

I have seen a couple of people post that when they copy mach_kernel.voodoo into Extras it won't boot and nobody has posted a definitive answer on where exactly it must be put for the chameleon boot to work using the voodoo kernel.

 

The voodoo option is in phase 4 of munky's instructions:

 

Thanks a lot th3joker. Currently, the script does NOT handle non-vanilla kernels, plainly because I don't know either where to put them.

 

I have updated the post to reflect that.

Link to comment
Share on other sites

Nope chameleon actually does not support GPT/GUID/EFI partitioning schemes as well yet. It has problems. I only hope it is fixed soon because munky's method is the only one working for me here. Chameleon keeps on coming with an EBIOS error 0x01 and eventually dies while the turbo-munky boots perfectly OK. IMHO, Chameleon has still way to go, and lots of problems from what I read, so please don't give up that project so fast yet.

Link to comment
Share on other sites

boots fine for me installed to the EFI partition of a GUID partitioned disk.

 

That's the weird part, it works for some while it doesn't for others. It is most likely a disk geometry related bug that munkys turbo-boot somehow does not have and no script can fix that one, not unless it converts to MBR and/or maybe change the AHCI to IDE but I am not willing to do that.

Link to comment
Share on other sites

Works for me, I'm now using Chameleon after following the guide for Asus 6T and munkys boot.

 

dp35dp wrote a script that does all the work for you, nice boot screen :-)

 

 

When i install this latest chameleon, I only get a backslash en a blinking cursos.

Have no poblems booting witch version 1,0,12 ???

Any ideas ?

Link to comment
Share on other sites

anyone been able to use this methode in a dual boot with vista?

basically a GPT formatted drive, with GUID/MBR partition, vista, and leopard retail booting from EFI?

if so I really would like to know more..

thank's.

Link to comment
Share on other sites

So is there hope that the next release of Chameleon will do this all auto magically, what is the core issue? Is it that Chameleon R1 installer pkg is not copying in the Extra folder in correctly / at all, or that it does not copy in things it needs in the /Volumes/EFI folder, or installs on the OSX partition instead of the EFI partition, or is their some sort of SMBIOS compatibility issue. I would be just as happy to use the grub dfe Sling method since it works off cd if there was a pkg installer version of grub dfe for HD. Seems like if the munky method is the missing link, i.e. a required additional step to complete the Chameleon boot loader, the script could be modifed to detect / plug in the current disk partition identifier your running from sh from without modfication to complete the auto magic. Would like to learn and it seems the solution is so close.

Link to comment
Share on other sites

That's the weird part, it works for some while it doesn't for others. It is most likely a disk geometry related bug that munkys turbo-boot somehow does not have and no script can fix that one, not unless it converts to MBR and/or maybe change the AHCI to IDE but I am not willing to do that.

 

Works fine for me too. No problem at all. It just release candidate not full release yet so it prone to have bug. :D BTW, any problem you found with the new chameleon, it should forward to appropriate thread.

Link to comment
Share on other sites

We think it should work we are just not sure where we should put the voodoo kernel for sure.

From the 'BootHelp' from the Chameleon site:

Advanced startup options use the following syntax:

   [device]<kernel> [arguments]

Example arguments include

device: rd=<BSD device name>       (e.g. rd=disk0s2)
        rd=*<IODeviceTree path>    (e.g. rd=*/PCI0@0/CHN0@0/@0:1)

kernel: kernel name                (e.g. "mach_kernel" - must be in "/" )

Link to comment
Share on other sites

anyone been able to use this methode in a dual boot with vista?

basically a GPT formatted drive, with GUID/MBR partition, vista, and leopard retail booting from EFI?

if so I really would like to know more..

thank's.

 

Hi,

 

I have 320 Gb hd and I installed vista x64 and leo retail booting from munky EFI on GUID partition. Vista is not booting but leo is nice working. I want to work vista, too. How? I don't use patched kernel (voodoo etc..) Do i must use the voodoo kernel? and Chameleon? Pls help me. Thanks Munky.. Great tutorial and great job..

 

P.S. I tried the script of dp35dp for chameleon but it's not working now.

Link to comment
Share on other sites

Hi,

 

I have 320 Gb hd and I installed vista x64 and leo retail booting from munky EFI on GUID partition. Vista is not booting but leo is nice working. I want to work vista, too. How? I don't use patched kernel (voodoo etc..) Do i must use the voodoo kernel? and Chameleon?

Booting Vista from Chameleon has nothing to do with the kernel. If it does not work with vanilla, it won't boot with any other either. Try reading the Chameleon-related topics as your problem is very popular and does not seem to be related to Munky's EFI method.

 

Pls help me. Thanks Munky.. Great tutorial and great job..

 

P.S. I tried the script of dp35dp for chameleon but it's not working now.

Thanks for the feedback.

 

If you are interested in help, please post the full output of the script, as requested in the post. Thanks.

 

From the 'BootHelp' from the Chameleon site:

Advanced startup options use the following syntax:

   [device]<kernel> [arguments]

Example arguments include

device: rd=<BSD device name>       (e.g. rd=disk0s2)
        rd=*<IODeviceTree path>    (e.g. rd=*/PCI0@0/CHN0@0/@0:1)

kernel: kernel name                (e.g. "mach_kernel" - must be in "/" )

 

Eddie, you are right. It was me being overly optimistic when I suggested to try putting the kernel into the "Extra" folder. That would have made for a really clean install. It seems the last stage booter cannot read directories further down, only the root one.

 

So to all users of patched kernels: Leave it at the root of the EFI partition. If there is a problem, make sure to read up on the various ways how you can specify the path to the device on which the kernel lies.

 

Good luck!

Link to comment
Share on other sites

So, if I'm not mistaken, this method is not at all obsolete? Since the new Chameleon bootloader is still in development (RC1), it might be more safe to use munky's method?

 

Wrong, RC1 Chameleon is perfect and you should upgrade because munky's method uses different extension folders and that can cause issues which make it less safe (in terms of a lot of folder changing) when you eventually want to upgrade to chameleon 2.0 final.

Link to comment
Share on other sites

 Share

×
×
  • Create New...