Difference between revisions of "Enable USB Storage on 2.x"

From AwkwardTV
Jump to: navigation, search
(Automatic loading at boot)
(Kernel)
Line 16: Line 16:
 
Enabling USB requires to modify <code>/mach_kernel.prelink</code> on the AppleTV.
 
Enabling USB requires to modify <code>/mach_kernel.prelink</code> on the AppleTV.
 
If this file isn't there yet, this means the system partition hasn't been forced to be mounted read/write yet.
 
If this file isn't there yet, this means the system partition hasn't been forced to be mounted read/write yet.
Force it read/write:
+
Force it read/write with:
 
  ssh frontrow@AppleTV.local
 
  ssh frontrow@AppleTV.local
 
  sudo -s
 
  sudo -s

Revision as of 10:02, 27 March 2008

Note

This how-to is a compilation of bits and pieces of other how-to's in this wiki, mainly

Prerequisites

In order to enable mounting external USB devices, you will need

  • SSH access to the AppleTV, or its harddisk directly connected to your computer
  • Turbo's .kext enabler
  • Ben Mackin's kernel patcher.
  • Mac OS X Tiger - Intel: extensions for USB mass storage I/O

Installation

Kernel

Enabling USB requires to modify /mach_kernel.prelink on the AppleTV. If this file isn't there yet, this means the system partition hasn't been forced to be mounted read/write yet. Force it read/write with:

ssh frontrow@AppleTV.local
sudo -s
touch /.readwrite
reboot

Kext enabler

Turbo's Kext enabler allows to load .kext system extensions into the system.

  • Copy it to the AppleTV in folder /sbin/ and check for the file's attributes:
ssh frontrow@AppleTV.local
sudo -s
cd /sbin/
ls -l turbo_kext_enabler.bin
  • You might want to change them to:
chown root:wheel turbo_kext_enabler.bin
chmod 555 turbo_kext_enabler.bin

Turbo's USB patch doesn't work for AppleTV 2.0 yet.

Kernel patch

Ben Mackin has written a kernel patcher for enabling USB.

Note: the Take 2 Full Update page seems to indicate that the kernel patcher only works on Intel Macs, and has to be recompiled from source for the PPC machines.

To patch the kernel:

  • Extract the kernelpatch folder from it (double-click).
  • Copy /mach_kernel.prelink to your Mac inside that folder.
  • Inside the Terminal, cd to that folder. Once there:
./do_usb_patch.sh
mv mach_kernel.prelink mach_kernel_original.prelink
mv mach_kernel_patched.prelink mach_kernel.prelink
  • Copy the new /mach_kernel.prelink back to the AppleTV.

Extensions for USB drives

The following extensions are needed fo mounting USB drives:

/System/Library/Extensions/IOSCSIArchitectureModelFamily.kext/
/System/Library/Extensions/IOStorageFamily.kext/
/System/Library/Extensions/IOUSBMassStorageClass.kext/

I got mine from a Mac OS X Tiger install on an Intel machine.

The ones from the Darwin x86 iso won't work: with these, I get the message:

kextload: loaded version 1.5.1 of module com.apple.iokit.IOStorageFamily differs from requested version com.apple.iokit.IOStorageFamily

It seems one can retrieve files from a downloadable combo update. I didn't try that...

Once the files are copied, you can try if they work. Reboot the AppleTV and:

ssh frontrow@AppleTV.local
sudo -s
/sbin/turbo_kext_enabler.bin
/sbin/kextload -v /System/Library/Extensions/IOUSBMassStorageClass.kext

If the loading works fine, plug an USB drive to the AppleTV and check if it is seen:

diskutil list

You should see

/dev/disk0
   #:                   type name               size      identifier
   0:  GUID_partition_scheme                    *37.3 GB  disk0
   1:                    EFI                    34.0 MB   disk0s1
   2:         Apple_Recovery                    400.0 MB  disk0s2
   3:              Apple_HFS OSBoot             900.0 MB  disk0s3
   4:              Apple_HFS Media              35.8 GB   disk0s4
/dev/disk1
   #:                   type name               size      identifier
   ...

Automatic loading at boot

Automatically loading the USB mass storage extension at boot can be done with the help of /etc/rc.local. Create or edit the file and add the commands from the following listing:

# rc.local

# enable USB
/sbin/turbo_kext_enabler.bin
/sbin/kextload -v /System/Library/Extensions/IOUSBMassStorageClass.kext

Restart the AppleTV and try pluging and unplugging an USB drive.