Search this blog ...

Saturday, August 21, 2010

XBMC CrystalHD Updated Instructions using 2.01 driver – August 2010

There are plenty of simpler ways to install/verify Crystal HD on the Apple TV.   Below steps should work if you like to get your hands dirty :-

(note – cut/paste blocks of colored text as a whole)

# Step 1: SSH in to the apple tv as the user frontrow using your favourite ssh client

# having successfully logged in, switch to the root user
sudo -s

# Note! - you will need to manually supply the ROOT password for the ABOVE command before proceeding ...

# Step 2: Obtain the crystalhd kext, driver, and firmware and install in to the appropriate location

(Note, see the following post for a replacement ‘Step 2’ http://todayguesswhat.blogspot.com/2010/08/xbmc-crystalhd-update-2-august-2010.html if you want to run a newer build based on r156 http://code.google.com/p/crystalhd-for-osx/updates/list)

cd /tmp

rm -rf crystalhd-for-osx-2.0.1*

wget http://crystalhd-for-osx.googlecode.com/files/crystalhd-for-osx-2.0.1.zip

unzip crystalhd-for-osx-2.0.1.zip crystalhd-for-osx-2.0.1/*

rm -rf /System/Library/Extensions/BroadcomCrystalHD.kext

mv crystalhd-for-osx-2.0.1/BroadcomCrystalHD.kext /System/Library/Extensions

chown -R root:wheel /System/Library/Extensions/BroadcomCrystalHD.kext

chmod -R 755 /System/Library/Extensions/BroadcomCrystalHD.kext

rm -rf /usr/lib/libcrystalhd.dylib

mv crystalhd-for-osx-2.0.1/libcrystalhd.dylib /usr/lib/

chmod 755 /usr/lib/libcrystalhd.dylib
chown root:wheel /usr/lib/libcrystalhd.dylib

rm -rf /usr/lib/bcm7001*fw.bin

mv crystalhd-for-osx-2.0.1/bcm7001*fw.bin /usr/lib/

chmod 644 /usr/lib/bcm7001*fw.bin
chown root:wheel /usr/lib/bcm7001*fw.bin

rm -rf /tmp/crystalhd-for-osx-2.0.1
rm -rf /tmp/crystalhd-for-osx-2.0.1.zip

# Step 3: to load kexts, we require Turbo's ATV or Kext enabler ...

# check for presence of /sbin/turbo_atv_enabler.bin or /sbin/turbo_kext_enabler.bin
if [ ! -f /sbin/turbo_kext_enabler.bin ] && [ ! -f /sbin/turbo_atv_enabler.bin ]; then
  wget
http://crystalhd-for-osx.googlecode.com/files/turbo_atv_enabler.bin
  mv turbo_atv_enabler.bin /sbin
  chown root:wheel /sbin/turbo_atv_enabler.bin
  chmod 755 /sbin/turbo_atv_enabler.bin
fi

# Notes crystal_atv_enabler.bin is just a copy of turbo_atv_enabler.bin (they are MD5 equivalent 6a8ec66d5174a4cefacbe12be4b1e079 - 17780 bytes)

# Step 4: Ensure that the crystalhd kext is activated at boot time !!EITHER!! by adding a new startup item under /System/Library/StartupItems or adding an entry to /etc/rc.local ; If you have installed the Crystal HD driver in the past, it is worthwhile having a quick look on disk to see which mechanism is currently being used to load the driver and continue leveraging that approach.

# Use either method 1 or method 2  below ...

# Step 4 - Method 1:
# Rather than put the kextload entry in /etc/rc.local (as in method 2) - below we make use of /System/Library/StartupItems

mkdir -p /System/Library/StartupItems/LoadCrystalHD

# create StartupParameters.plist file
cat > /System/Library/StartupItems/LoadCrystalHD/StartupParameters.plist <<EOF
{
  Description     = "CrystalHD Driver Loader";
  Provides        = ("CrystalHD Driver");
  Uses            = ("Disks");
}
EOF

# create LoadCrystalHD file
cat > /System/Library/StartupItems/LoadCrystalHD/LoadCrystalHD <<EOF
#!/bin/sh
. /etc/rc.common
 
StartService() {
  if [ -f /sbin/turbo_atv_enabler.bin ]; then
    /sbin/turbo_atv_enabler.bin
  else
    /sbin/turbo_kext_enabler.bin
  fi
  /sbin/kextload -v /System/Library/Extensions/BroadcomCrystalHD.kext
}

StopService() {
  return 0
}

RestartService() {
  return 0
}

RunService "\$1"
EOF

# update permissions/ownership
chown -R root:wheel /System/Library/StartupItems/LoadCrystalHD
chmod -R 755 /System/Library/StartupItems/LoadCrystalHD/LoadCrystalHD
chmod -R 644 /System/Library/StartupItems/LoadCrystalHD/StartupParameters.plist

# one can attempt to confirm startupitem script works by typing
# SystemStarter start LoadCrystalHD


# Step 4 - Method 2:
# Rather than add a new startup item to /System/Library/StartupItems (as in method 1) - below we ensure that the crystalhd kext is activated at boot time by adding an entry to /etc/rc.local

# begin rc.local changes ...
touch /etc/rc.local
cp /etc/rc.local /etc/rc.local.original

# check if kext enabler entry missing from rc.local
if [ `grep --count -G '^/sbin/turbo_\(atv\|kext\)_enabler.bin' /etc/rc.local` -eq 0 ]; then
  if [ -f /sbin/turbo_atv_enabler.bin ]; then
    echo "/sbin/turbo_atv_enabler.bin" > /tmp/rc.top
  else
    echo "/sbin/turbo_kext_enabler.bin" > /tmp/rc.top
  fi

  cat /tmp/rc.top /etc/rc.local.original > /etc/rc.local
  rm -rf /tmp/rc.top
fi

# add kexload entry to end of rc.local file if missing
if [ `grep --count -G '^/sbin/kextload -v /System/Library/Extensions/BroadcomCrystalHD.kext' /etc/rc.local` -eq 0 ]; then
  echo "/sbin/kextload -v /System/Library/Extensions/BroadcomCrystalHD.kext" >> /etc/rc.local
fi

# ensure rc.local permissions are correct
chown root:wheel /etc/rc.local
chmod 644 /etc/rc.local

 

# Step 5: Next, we want to add support from laucher for downloading XBMC nightly builds

# exit as user root, and return as user frontrow ...
exit

# Note! You should now be the user frontrow.

# add xbmc nightly download location entry for launcher if not present ...
defaults read com.teamxbmc.xbmclauncher XBMCAdditionalDownloadPlistURLs 2>/dev/null | grep --silent mirrors.xbmc.org/nightlies/osx/update_urls.plist
if [ $? -eq 1 ]; then
  defaults write com.teamxbmc.xbmclauncher XBMCAdditionalDownloadPlistURLs -array
http://mirrors.xbmc.org/nightlies/osx/update_urls.plist
fi


# Step 6: From the Apple TV User Interface, Go to the launcher menu, then choose "Settings", then choose "Downloads"
# - Obtain the latest xbmc download build available


# Step 7: Reboot the Apple TV ...
sudo -s
reboot

# Step 8: After the Apple TV has rebooted, fire up XBMC from the launcher
# check that XBMC has detected the Crystal HD ...

# Check under "System -> Video -> Playback -> there is an option selected "Allow hardware acceleration (CrystalHD)"

# If no /usr/lib/libcrystalhd.dylib or no BroadcomCrystalHD.kext loaded, then CrystalHD will NOT show up above..

# Optional - Basic debugging can be done in the event the Cyrstal HD was not detected:

# switch to root
sudo -s

# check that crystal hd hardware was detected
dmesg

Output :-
...
BroadcomCrystalHD::start
crystalhd_hw_open: setting up functions, device = Link
Starting Crystal HD Device
Opening HW. hw:0x1f28e04, hw->adp:0x200e300
Stopping Crystal HD Device
BroadcomCrystalHD: Found HW and started driver SW.

# check that crystalhd driver is loaded :-
kextstat | grep crystalhd

Output :-
   74    0 0x30157000 0x18000    0x17000    com.broadcom.crystalhd.driver (3.5.0) <5 4 3 2>


# Check the xbmc.log when playing an appropriate movie ..
grep -i crystal /Users/frontrow/Library/Logs/xbmc.log

10:52:16 T:2684407808 M: 18456576    INFO: CrystalHD(new API): device opened

3 comments:

  1. Can I just tell you that I love you? I've been waiting for a Launcher script update to go past R26 because no one had spelled out how exactly to update it manually. Now you did. I thank you sir.

    ReplyDelete
  2. Ditto Trevor ; lotsa love going your way ...

    keep up the good work

    ReplyDelete
  3. Very helpful indeed! Two thumbs up!

    ReplyDelete