Hi, i started a project to bring the task of creating bootable usb on Linux, in a script form.
It's similar to Pandora, but i wrote it from scratch. As of now it lacks a GUI, and i lack GUI coding skills .
It can be usefuel for:
-People without access to a real MAC.
-People without Virtualization support in CPU for VM
-People with their OS X installation unbootable (you can avoid installing in VM to create Installer, you can create create Installer directly and faster).
-People needing to restore their original MAC (not possible yet, in TODO list, i'd need a tester and i'd probably need work with GUID partitioning. I don't know if real MACs can boot MBR USB).
-People who want to do it with Linux because they just want to .
The script is currently in testing, if you want to try it out please understand i'll take no responsibility for wiped hard drives or data loss, but i'll help you as i can if you experience any problem.
However, i made several tests on both Virtual Machines and real Hardware (and different PCs) with no problem at all, using 10.6/10.7/10.8/10.9 dmg files.
- Creates a bootable installation usb drive, starting from dmg files (InstallESD.dmg or Mac OS X Install DVD.dmg). CD to USB is implemented, but not tested.
- Creates osx86 installation HDD images starting from dmg file, those are suitable for VMs. (SEE NOTES BELOW)
- Extracts a pkg or mpkg file (using "xar", which is self-compiled by the script)
- Converts dmg files to img (using "dmg2img", which is self-compiled by the script)
- After the media is ready, you can re-run the tool to access the management menu. It allows:
- Kext Management
- Chameleon Modules Management
- Kernel Management
- Chameleon repair/update
- (Re)apply MBR patch
- (Re)install Smbios
- (Re)install DSDT
- Erase Setup (to wipe ALL the usb data and restore the drive to normal use)
- Logging to html, with ansi2html utility by running "install_osx_log.sh" with same parameters you'd use with normal one
NOTE: all the commands below must be used without  charachers.  indicate you have to change the content according to your needs and specific case!!
NOTE: use ./install_osx_quiet.sh to avoid really verbose output.
How to setup files:
You need obtain the following chameleon core files.
Place them in "chameleon" directory. You can either get those files from "i386" archives, or download the pkg and unpack it
sudo ./install_osx.sh <package.pkg> <destdir>
Where outputdir is a temporary location (not the "chameleon" folder!).
You'll find core files in <destdir>/Core.pkg/usr/standalone/i386. Move the required files in "chameleon" directory.
Nolw you can delete <destdir> as we don't need it anymore
Chameleon dylib modules go to "chameleon/Modules" (example Sata.dylib, Resolution.dylib, etc...).
You can manage them with "Manage chameleon Modules" menu option, in case you need to add/remove them later.
Chameleon Themes go to "chameleon/Themes" (chameleon will use the theme in folder named "Default" at boot, "chameleon/Themes/Default")
Place any kext (they are seen as directories on Linux) in "extra_kexts" directory.
You can manage them with "Manage kexts" menu option, in case you need to add/remove them later.
Place the following files in "osinstall_mbr" directory
They NEED to match the version on DMG, and the script will check that before copying. I plan to add a way to allow multiple filesets for each installer version.
Place them in "kernels" directory. They are not automatically installed, you need to invoke the management menu to swap mach_kernel or add a new kernel to root.
As of now kernels are copied as is. To replace main kernel you need to rename the desired kernel to "mach_kernel".
This allows multiple kernels on the same installation media.
If you leave the filenames as is and, let's say you have a file named "cust_kernel", you'll have to boot with: "cust_kernel" <parameters> at chameleon prompt.
Single tweaks, stored in "tweaks" folder, that can extend the script (i plan to convert some internal function to tweak to make it more light-weight)
Example of tweak:
"Remove Graphic Kexts"
"Restore Graphic Kexts"
A tweak is like a plugin. If you want to add a tweak (if you are a developer), you must add the string
So that it will appear in the menu as "My Tweak" in the above example.
A tweak can use functions and variables exported from the main script (with "export")
How to extract a pkg/mpkg:
sudo ./install_osx.sh [pkgfile] [destdir]
How to prepare OSX86 usb
To obtain info about your USB Drive (you need the id, Example /dev/sde)
sudo ./install_osx.sh [dmg path] [/dev/sdX]
where X is the letter you gathered above
How to prepare OSX86 image
sudo ./install_osx.sh [dmg path] [dest.img]
How to manage images and usb drives (management menu)
For USB drives:
sudo ./install_osx.sh [/dev/sdX]
sudo ./install_osx.sh [imagefile]
DOWNLOAD and PREPARATION:
You can get the script from https://github.com/smx-smx/osx86_linux, using git
LATEST VERSION: r23
git clone https://github.com/smx-smx/osx86_linux.git
OR: You can use the github "Download ZIP" button
To check for script updates, just do
In script directory.
INSTALL THE FOLLOWING DEPENDENCIES: (post if i forgot a dep)
sudo apt-get install cpio hfsprogs tput wget parted udisks qemu-utils build-essential zlib1g-dev sudo apt-get build-dep dmg2img
I tested it on Arch Linux aswell, but i don't remember the complete set of dependencies i installed. if i recall correctly:
udisks - tput - hfsprogs(AUR) - wget - parted - cpio - qemu - base-devel - zlib
If you encounter a regression in my script, you can downgrade with
git reset --hard HEAD~[number]
Where [number] is the number of updates to rollback, e.g 1 to return to previous version, 2 to roll-back 2 updates and so on. (please post any regression or bug)
WARNING: during my tests i found out the best deal is "img" raw format. If you specify VHD/VMDK/VDI your system may freeze or crash. This is due to software limitations on Linux. To work around this problem, i strongly recommend using "img" output if you need Installation Hard Disk images. The script will ask you if you want to convert to VDI/VMDK/VHD at the end of the process, after all the data has been flushed (Virtualbox required, as it contains the "vboxmanage" command, needed to convert img -> something_else).
Looks like the main cause of this problem is combining the FUSE NTFS driver with VDI/VMDK/VHD. You can try VDI/VHD/VMDK and post your result. I'll edit these warnings accordingly.
Using the Management Menu with an already created VHD/VDI/VMDK should be fine, as the data to be written is a lot smaller (as osx files are already there)
WARNING: When outputting the img, it's better to choose a drive with ext filesystem. AVOID NTFS DRIVES, they may perform very very slow or the script may hang. This is due to the ntfs-3g fuse driver. You can choose an ext4 drive, and move the resulting image at the end of the process.
WARNING: Some distributions may spit out errors during cp with "cp preserving permissions not supported". I have that problem on ArchLinux, but not on Mint. I suspect there's a regression in linux hfs+ driver. Anyway it should still work fine.
NOTICE: You need a lot of disk space for this script.
Example for USB:
InstallESD.dmg(5.3G) + InstallESD.img(5.4G) + BaseSystem.img(1.3G) = approx 12GB (only for setup data)
Example for VDI:
InstallESD.dmg(5.3G) + InstallESD.img(5.4G) + BaseSystem.img(1.3G) + mavericks.img(10G) + mavericks.vdi(6G) = approx 28GB (only for setup data)(18 after removing mavericks.img after conversion)
The img files are temporary! The script doesn't delete them so it can create USB pendrives faster the next time you run it. If you plan to use it once, or if you need to free some disk space, you CAN DELETE *.img and leave only the dmg file you started with.
Here's a look at the finished product, maverick with img converted to vdi option
vm_chameleon.png 1.07MB 20 downloads
Real HW, Snow Leopard 10.6
netbook.jpg 107.2KB 20 downloads
Installers prepared from scratch with Linux and this script only.