ProjectOSX

Welcome Guest!

Returning User? Login here.

Want membership privileges? Register here.

 
Start a new topic Add Reply
> Creating a Chameleon preboot usb stick, with Ubuntu 9.04
Hagar
post May 17 2009, 03:17 PM
Post #1
You will need:
  • Ubuntu (live CD may work, haven't tested) I used 9.04 and assume you do too
  • a blank usb stick, a small one is fine
  • an internet connection
First:install hfsplus and hfsprogs with apt-get or synaptic

insert your usb stick
open a terminal, sudo -s then type df to check where it is & where it's mounted, note the position & unmount the stick.

(I will use /dev/sdb as the example device and LinOSX as the volume label & mount point for the usb stick, substitute your own values)

Use
CODE
fdisk /dev/sdb

to remove whatever partitions you have and create a new primary partition, type AF, active.

Use mkfs.hfsplus to make a new hfs+ filesystem on your new partition. I used:
CODE
mkfs.hfsplus -v LinOSX -U 0 -G 0 /dev/sdb1

which sets the volume name to LinOSX and the user & group to 0:0

Next we install the chameleon bootloader:
download & unpack the latest chameleon binary package, in this case Chameleon2.0RC1-r431
cd to the i386 directory inside, and, making sure that /dev/sdb1 is unmounted, do:
CODE
dd if=boot0 of=/dev/sdb bs=440 count=1
  dd if=boot1h of=/dev/sdb1


next we mount the stick, I used:
CODE
mkdir /media/LinOSX
  mount -t hfsplus -w /dev/sdb1 /media/LinOSX

then, true to a long tradition, I typed:
CODE
touch /media/LinOSX/arse

to check for writeability.

All being well you should now be able to write to this drive *but only as root* so,
CODE
cp boot /media/LinOSX
  mkdir /media/LinOSX/Extra

and now cp the contents of "Optional Extras" into the Extra folder you just created

The stick needs a decryptor, I chose Appledecrypt, google for it, download, and drop Appledecrypt.kext into Extra/Extensions with cp -R, kexts are folders in linux.
a Disabler.kext might be useful, same procedure.
when you have all the kexts you think you'll need to boot, check the ownerships are root:root on all the kexts (they should be) and if necessary
CODE
chmod -R 755 Extra/Extensions


You're done!
sometimes the stick refuses to mount readwrite, after being mounted on OS X, try fsck'ing it
This Time We're Doing it RIGHT


Kabyl
post May 18 2009, 04:35 AM
Post #2
QUOTE (Hagar @ May 17 2009, 04:17 PM) *
...
when you have all the kexts you think you'll need to boot, check the ownerships are root:root on all the kexts (they should be) and if necessary
CODE
chmod -R 755 Extra/Extensions

...


The booter doesn't care about the owner, group and mode of the files and directories, it's probably only needed if you plan to pack them in an Extensions.mkext.

Nice guide!
Hagar
post May 18 2009, 11:58 AM
Post #3
QUOTE (Kabyl @ May 18 2009, 04:35 AM) *
The booter doesn't care about the owner, group and mode of the files and directories, it's probably only needed if you plan to pack them in an Extensions.mkext.

Nice guide!


That's really interesting, as the inability to set permissions is the main reason I gave up on the windows method, I may try it again.
This Time We're Doing it RIGHT


zhell
post Jun 3 2009, 06:26 AM
Post #4
QUOTE (Hagar @ May 17 2009, 05:17 PM) *
The stick needs a decryptor, I chose Appledecrypt, google for it, download, and drop Appledecrypt.kext into Extra/Extensions with cp -R, kexts are folders in linux.
a Disabler.kext might be useful, same procedure.
when you have all the kexts you think you'll need to boot, check the ownerships are root:root on all the kexts (they should be) and if necessary
CODE
chmod -R 755 Extra/Extensions

sometimes the stick refuses to mount readwrite, after being mounted on OS X, try fsck'ing it

Cool guide, Hagar, it's always nice to know you can bootstrap OS X from Linux.

While It's good to know from Kabyl that the booter does not care about permissions, I think it's never too early to teach n00bs, how to deal with KEXTs.
If you download KEXTs from a reliable source, hopes are high that they have proper permissions set, and Linux is going to preserve those if you ask it to.
Therefore, I prefer to use "cp -a" over "cp -R" because the former maintains all permissions and other metadata of the files. The "-a" flag does not work under OS X though, where you need to use "cp -pR" to achieve the same.
To set proper permissions on the KEXTs, the commands I use are
CODE
chown -R root:wheel Extra/Extensions
chmod -R go=u-w Extra/Extensions

The above chmod command (with "go=u-w" instead of "755") sets the permissions of group and others to be the same as those of the user (=owner) but minus write permissions. This has the advantage of only leaving the executable bit set on items that already have it, avoiding to make all files executable. Having the wrong files executable is a security risk. And since it's no extra typing effort, we might as well teach the n00bs to use this from the beginning :-)

Also, for the record, if anyone wants to prepare the USB stick under OS X, be sure to enable ownership and permissions after formatting it, as otherwise, none of the chown and chmod commands have any effect. From Terminal, you issue
CODE
vsdbutil -a /Volumes/<name of your USB stick>

Or go to Finder, do a right click on the volume and choose "Get Info"; then disable "Ignore ownership on this volume"; it's at the very bottom and you may need to click the padlock and enter your admin password first.

This post has been edited by zhell: Jun 3 2009, 07:28 AM
GA-Z68MX-UD2H-B3-U1c | Core i7 2600 | 16GB DDR3-1600
Intel SSD 520 240GB + WDC WD-20EARX 2TB Fusion drive
Sapphire Radeon HD 6850 1024MB PEG | Atheros AR9380 Mini PCIe | Intel 82574L PCIe
OS X 10.8.2 | Chameleon 2.1svn | Clover EFI r897

Add Reply Start a new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: