Saturday 20 December 2014

Add Mac OS X Installers (e.g. Yosemite) to your E2B multiboot USB drive

Mitch recently asked me if he could add an OS X Installer ISO to his E2B USB drive. After two nights of work by Mitch (mostly!) and myself (I don't have an x86 Mac - or indeed any Mac to test it on), we got something working!

You will need a spare 8GB+ USB drive, a Mac (or Virtual Machine with OS X) and the UniBeast download...

Note: New E2B feature! If your .dmg file contains a .img file which is an HFS+ single partition and is x86-bootable - you can now just copy the .dmg file to your Easy2Boot v1.62+ USB drive and boot from it on any x86 Hackintosh PC - no need to use a OS X system or UniBeast!


Summary

1. Make 8GB bootable OS X Installer single MBR partition HFS+ Flash drive using UniBeast on a Mac
2. Take an image of the HFS+ (Type AF) partition that is on the Flash drive
3. Add the image file to your E2B USB drive

Note: The latest version of E2B (v1.62) has support for .dmg image files and .HFSptn files - just copy the file to your E2B USB drive, e.g. Hackintosh Yosemite-Zone.dmg will 'just boot' straight from an E2B drive! The details below are now out-dated as we don't need a .mnu file or need to prepare a .HFSptn file!

So here are the instructions in detail:

1. Use a spare USB drive and follow the instructions on tonymacx86's site:


In Step 2 - set the single partition size to slightly more than the size of the source file. You may have to guess at this but we will make an image file from this which will be as large as the partition, so try to keep the size down as much as possible - Mitch used a size of 7GB, as UniBeast declared that 6GB was too small for Yosemite 10.10.

It is important to create an MBR-based partition of type AF  (HFS).

At Step 2 - 16/17, Mitch did not select either Laptop Support or Legacy USB Support.

If you only have a Windows system, you can prepare a USB Flash drive by using RMPrepUSB - File->Drive and specifying the Yosemite.dmg file as the source. Then check that the USB drive now contains a Type AF partition by using RMPrepUSB - Drive Info - 0  to list the partitions - e.g.

Partition 1   SIZE=5235.382MiB   Type: AF   *ACTIVE*
START POS   = CYL:1023 HD:254 SEC:63       END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 1 (00000001) SIZE (LBA) = 10,722,062 (00A39B0E) [End=10,722,062]

Partition 2   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 3   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 4   SIZE=0MiB   Type: 00        
START POS   = CYL:0 HD:0 SEC:0       END POS = CYL:0 HD:0 SEC:0
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

P1   Start=1 (512 bytes) End=10,722,062 (5,489,695,744 bytes)

2. Now we turn to our Windows system and take an image of the HFS partition using RMPrepUSB - Drive -> File - filename=OSX_Installer.HFSPTN, USB Start=P1 and press Enter for the defaults for the rest of the questions.

3. Copy the OSX_Installer.HFSPTN file to the \_ISO\MAINMENU\MNU folder.

4. Copy the OSX_Installer_HFS_Boot.mnu sample menu file to the same folder. The file is available from the Alternate Downloads area on the E2B Downloads page - Note: for E2B v1.62+ this .mnu file is not required! Just copy the OSX_Installer.HFSPTN file to \_ISO\MAINMENU.

That's it! Follow tonymacx86's STEP 3 and beyond and use the new E2B menu entry to install OS X.

Note: The file will need to be contiguous (as do most files on an E2B USB drive). So use RMPrepUSB Ctrl+F2 or WinContig or double-click on the E2B USB file \MAKE_THIS_DRIVE_CONTIGUOUS.cmd file.

Tip: If you see some messages about EBIOS read error 0x31 - see here.

Optional: Add the lines below to your \_ISO\MyE2B.cfg file and it will always wipe the HFS+ partition entry when E2B boots - thus avoiding any E2B warning messages about a partition being already in use.
# wipe ptn 4  
partnew (hd0,3) 0 0 0 
# wipe ptn 3  (not usually required for E2B)
partnew (hd0,2) 0 0 0

How it works

It seems that an HFS volume is very easy to boot to. We just need to use the grub4dos partnew command to insert a partition entry #3 into our MBR on the E2B USB drive and then use chainloader (hd0,2)+1 to boot to that partition. It does not seem to matter that we have changed the position of the partition and that it is on a different drive! So in theory, any HFS partition could be booted from in this way.

The menu  and text below is obsolete now and is just for informational purposes because E2B v1.62 supports xxx.HFSptn files now and no .mnu file is required! Also, only partition 4 is used by E2B (partition 3 is not needed).

As partition 3 must be set to Type AF = HFS, we have to permanently insert the entry into the MBR. The .mnu file will ask you if it can delete an existing Type AF partition before it overwrites it. If it is not Type AF, then it will not proceed. So your E2B USB drive needs to have partitions 3 and 4 empty/unused.
If you use any linux+persistence .mnu files, you will need to erase partition 3 if it contains a previous OS X HFS image. So you may find it useful to also add the ClearUSBPartition3.mnu file to the MNU folder also, so that you can clear partition 3 first. Alternatively, you can add a partnew command to the \_ISO\MyE2B.cfg file which will always clear the partition before the menu is loaded - see the \_ISO\Sample_MyE2B.cfg file for details.

The OSX_Installer_HFS_Boot.mnu is shown below:

Note OSX_Installer_HFS_Boot_v2.mnu uses partition 4, the example below uses partition 3.

# Use this menu to boot from an HFS partition image - e.g. OS X Installer
# 1 Make a single partition MBR HFS USB Flash drive for OS X Installer using UniBeast under a Mac OS - the partition should be JUST big enough for the files to fit
# See http://www.tonymacx86.com/445-unibeast-install-os-x-yosemite-any-supported-intel-based-pc.html
# 2 Use RMPrepUSB - Drive -> File  (start=P1) to make an image of the HFS partition - e.g. filename OSX_Installer.HFSPTN
# 3 Copy this .mnu file and the OSX_Installer.HFSPTN file to the E2B \_ISO\MAINMENU\MNU drive (or other 3rd level folder - e.g. \_ISO\BACKUP\OSX)
# 4 You can change the name of the .HFSPTN file and edit this menu to use a different filename for HFS

iftitle [if exist $HOME$/OSX_Installer.HFSPTN] OS X Installer\n Boot from a partition image\n This uses partition 3 which should be cleared afterwards

set HFS=$HOME$/OSX_Installer.HFSPTN

if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (md)0xa000+0x50
if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
#enable parttype output
debug 1
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
# make empty table entry in 3rd position in ptn table
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
echo
if /i "%check%"=="0xAF" echo WARNING: MBR PARTITION 3 IS IN USE (Type AF = HFS partition)
set ask=
if /i "%check%"=="0xAF" echo && set /p ask=OK to delete the HFS partition 3 IN MBR? (Y/[N]) : 
echo
echo
# if answer Y, make empty table entry in 3rd position in ptn table
if /i "%ask%"=="Y" partnew (%E2BDEV%,2) 0 0 0
debug 1
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
if not "%check%"=="0x00" echo ERROR: MBR PARTITION 3 (%check%) IS ALREADY IN USE - cannot continue! && pause && configfile (md)0xa000+0x50
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0xAF %HFS% || echo && echo -e ERROR: %HFS% is not contiguous or is BAD!\nPlease fix using RMPrepUSB-CTRL+F2. && pause Press a key... && configfile (md)0xa000+0x50
rootnoverify (%E2BDEV%,2) > nul
chainloader (%E2BDEV%,2)+1 > nul
boot

Please add a comment to let me know if you have tried this and want E2B to support the .HFSPTN file extension in future.
Please tick funny, interesting or cool to show you are interested in this type of Mac USB feature in E2B and leave a comment.

No comments:

Post a Comment