Jump to content

Making USB install stick in Linux


xxd0Ma
 Share

4 posts in this topic

Recommended Posts

Greetings, everyone.

 

In my first post, let me thank all of you for contributing to and maintaining this useful forum and wiki.

 

I'm about to try my first hackintosh install. About the USB stick.. I've searched the forum (and web overall) for guides on this but all of them either require Windows or OS X. Finally, I stumbled upon this post (thanks, Memorial):]

 

1. Make on USB Drive (the non OS X install usb drive) a Linux live USB (a new one, you need the latest version of Gparted).

2. Boot off the linux, plug in your other USB drive, format it HFS+ using Gparted and make the partition bootable.

3. copy the contents of the install iso (you can access you HD from Linux) into that partition

4. Install chameleon on the install USB drive using the instruction from their site.

5. Use the UBS drive to install OS X

 

Is this (still) accurate? Even so, this is a bit too ambiguous for me.

  • Which (if any) kind of partition table should I use? Needs hybrid, MBR's good enough, or skip it altogether and go superfloppy?
  • How much empty space should I leave for Chameleon before the partition?
  • Can I use grub 2?

Link to comment
Share on other sites

I think it is possible.

 

Create a 5GB HFS+ formatted partition on a USB drive with GPT not MBR. Then you need to extract the needed files from the compressed InstallESD.dmg via 7z (this is the complicated part -- especially for Lion). Finally you need to install Chameleon to the USB so you don't need any empty space or GRUB.

 

It is more complicated to set up the USB drive from linux.

Link to comment
Share on other sites

  • 1 month later...
I think it is possible.

 

Create a 5GB HFS+ formatted partition on a USB drive with GPT not MBR. Then you need to extract the needed files from the compressed InstallESD.dmg via 7z (this is the complicated part -- especially for Lion). Finally you need to install Chameleon to the USB so you don't need any empty space or GRUB.

 

It is more complicated to set up the USB drive from linux.

Hi, thanks for the reply and sorry for coming back here after such a long delay. can you (or someone else reading this) elaborate on "installing Chameleon"? I downloaded Chameleon binaries from <removed>, but those seem to be Apple binaries:

 

michal@esprimo:/tmp/Chameleon-2.0-RC4-r684-bin/i386$ file fdisk 
 fdisk: Mach-O executable i386

 

 

I don't think that fdisk is the same as the one shipped with linux, as that one makes it clear it doesn't support GPT (it shows the partition, but displays a quite stern warning).

 

 

 

 

I'm basically at this point:

 

  1. Disk partitioned...
    (parted) u s
     (parted) print free													   
     Model: JetFlash Transcend 8GB (scsi)
     Disk /dev/sdc: 15826944s
     Sector size (logical/physical): 512B/512B
     Partition Table: gpt
    
     Number  Start  End		Size	   File system  Name		 Flags
      1	  34s	15826910s  15826877s  hfs+		 mac_install


  2. ...and formatted
    root@esprimo:~# mkfs.hfsplus /dev/sdc1
     Initialized /dev/sdc1 as a 7728 MB HFS Plus volume


  3. .dmg file extracted:
    7z x <redacted>/Install\ Mac\ OS\ X\ Lion.app/Contents/SharedSupport/InstallESD.dmg
     ....
     Extracting  Distribution
     Extracting  [TOC].xml
    
     Everything is Ok
    
     Folders: 24
     Files: 51
     Size:	   3743680906
     Compressed: 3743009943


Link to comment
Share on other sites

michal, here's my script tested in ubuntu. You still may need some kexts (fakesmc.kext) and perhaps a DSDT.aml in order to boot, though. I just copy the working ones from /Extra in my Snow installation. You don't need to run fdisk from the chameleon archive, the only 3 files you need are: boot1h, boot0, and boot.

 

#!/usr/bin/env bash

 

APP_PATH='/media/MacHD/Users/YOURNAME/Desktop/Install Mac OS X Lion.app'

ESD_PATH='Contents/SharedSupport/InstallESD.dmg'

CHM_PATH='/media/MacHD/Users/YOURNAME/build/chameleon/chameleon/sym/i386'

USB_DEV=/dev/sdf

 

mkdir A B C

time 7z e "${APP_PATH}/${ESD_PATH}" InstallMacOSX.pkg/InstallESD.dmg

time 7z e InstallESD.dmg 5.hfs

rm InstallESD.dmg

mv 5.hfs a.hfs

sudo mount -o loop,ro a.hfs A

time 7z e A/BaseSystem.dmg 5.hfs

mv 5.hfs b.hfs

sudo mount -o loop,ro b.hfs B

 

sudo umount ${USB_DEV}1 2> /dev/null

sudo parted -s ${USB_DEV} mktable gpt

sudo parted ${USB_DEV} mkpart primary hfs 1 4700

sudo mkfs.hfsplus -v LionInstall ${USB_DEV}1

sudo mount ${USB_DEV}1 C

 

time sudo rsync -Pah B/. C

sudo rm -rf C/System/Installation/Packages

time sudo rsync -Pah A/Packages C/System/Installation/Packages

sudo cp -a A/mach_kernel C

 

sudo cp -a ${CHM_PATH}/boot C

sudo dd if=${CHM_PATH}/boot0 of=${USB_DEV} bs=440 count=1

sudo dd if=${CHM_PATH}/boot1h of=${USB_DEV}1

printf '\x80' | sudo dd of=${USB_DEV} bs=1 seek=446

 

sudo umount A B C

rmdir A B C

rm a.hfs b.hfs

 

exit

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...