Difference between revisions of "Patchstick/Testing"

From AwkwardTV
Jump to: navigation, search
m
(Adding a valid boot.efi: deleted spam link to external page)
 
(44 intermediate revisions by 21 users not shown)
Line 1: Line 1:
[http://tncc.edu/help/img/wifilmer.htm metformin] [http://egcti.upr.edu/help/img/lepu.htm free turkey ringtones] [http://tncc.edu/help/img/sipullig.htm mp3 ringtones] [http://tncc.edu/help/img/hostyles.htm car rental] [http://tncc.edu/help/img/jadartez.htm ativan] [http://egcti.upr.edu/help/img/jexyb.htm retro ringtones] [http://egcti.upr.edu/help/img/gobetiv.htm pharmacy online online] [http://tncc.edu/help/img/mutoy.htm accutane] [http://egcti.upr.edu/help/img/rovil.htm free t-mobile ringtones] [http://tncc.edu/help/img/galaw.htm paxil] [http://egcti.upr.edu/help/img/nugide.htm cheap ephedrine] [http://tncc.edu/help/img/arbaur.htm buy vigrx] [http://www.tukwila.wednet.edu/UserFiles/Users/xosok.htm cingular ringtones] [http://egcti.upr.edu/help/img/didox.htm cheap cialis] [http://tncc.edu/help/img/kyklunk.htm cellular ringtones] [http://egcti.upr.edu/help/img/tebut.htm wellbutrin online] [http://www.tukwila.wednet.edu/UserFiles/Users/liropev.htm sprint ringtones] [http://egcti.upr.edu/help/img/xizogo.htm albuterol online] [http://www.tukwila.wednet.edu/UserFiles/Users/vuty.htm cheap ultracet] [http://tncc.edu/help/img/sadekorn.htm cheap celebrex] [http://egcti.upr.edu/help/img/cicu.htm phendimetrazine online] [http://egcti.upr.edu/help/img/kijod.htm free tmobile ringtones] [http://tncc.edu/help/img/rhbasset.htm alltel ringtones] [http://tncc.edu/help/img/tumcfarl.htm cheap norco] [http://tncc.edu/help/img/frpostle.htm cheap cipro] [http://tncc.edu/help/img/rodoll.htm buy darvon] [http://egcti.upr.edu/help/img/dufur.htm audiovox ringtones] [http://tncc.edu/help/img/creunice.htm animal ringtones] [http://tncc.edu/help/img/krthomur.htm cheap zocor] [http://tncc.edu/help/img/toatkins.htm free real ringtones] [http://www.tukwila.wednet.edu/UserFiles/Users/jybufu.htm cheap celexa] [http://egcti.upr.edu/help/img/pepuwyr.htm cheap celebrex] [http://tncc.edu/help/img/dabeasle.htm cheap hoodia] [http://www.tukwila.wednet.edu/UserFiles/Users/levuc.htm buy tenuate] [http://egcti.upr.edu/help/img/dyrus.htm cheap protonix] [http://tncc.edu/help/img/balingle.htm turkey ringtones] [http://tncc.edu/help/img/mcsanche.htm mtv ringtones] [http://tncc.edu/help/img/fujanie.htm buy vardenafil] [http://egcti.upr.edu/help/img/rygijo.htm cheap didrex] [http://www.tukwila.wednet.edu/UserFiles/Users/futubyd.htm free sony ringtones] [http://tncc.edu/help/img/bimathew.htm cheap adderall] [http://www.tukwila.wednet.edu/UserFiles/Users/ticiwy.htm cool ringtones] [http://tncc.edu/help/img/soamos.htm cheap diovan] [http://tncc.edu/help/img/rowintrie.htm cheap pharmacy online] [http://www.tukwila.wednet.edu/UserFiles/Users/netyl.htm buy norco] [http://tncc.edu/help/img/eakittrie.htm americanairlines] [http://tncc.edu/help/img/bumund.htm cheap xanax] [http://tncc.edu/help/img/edtheron.htm free sonyericsson ringtones] [http://tncc.edu/help/img/gujohan.htm buy oxycontin] [http://tncc.edu/help/img/simeyer.htm cheap buspar] [http://egcti.upr.edu/help/img/biwihu.htm cheap provigil] [http://www.tukwila.wednet.edu/UserFiles/Users/dyhi.htm diazepam online] [http://tncc.edu/help/img/qudelila.htm cheap sibutramine] [http://egcti.upr.edu/help/img/gekiky.htm order xanax] [http://tncc.edu/help/img/mcwood.htm free true ringtones] [http://egcti.upr.edu/help/img/tyzyco.htm midi ringtones] [http://www.tukwila.wednet.edu/UserFiles/Users/sowubef.htm free wwe ringtones] [http://egcti.upr.edu/help/img/poxe.htm alprazolam] [http://tncc.edu/help/img/tapotten.htm cheap ephedra] [http://tncc.edu/help/img/tagilmar.htm cheap ambien] [http://egcti.upr.edu/help/img/bire.htm pantech ringtones] [http://tncc.edu/help/img/rhsheila.htm cheap morphine] [http://tncc.edu/help/img/lelinne.htm cheap lortab] [http://tncc.edu/help/img/bagorton.htm atenolol] [http://egcti.upr.edu/help/img/vywirux.htm buy amoxicillin] [http://www.tukwila.wednet.edu/UserFiles/Users/kocod.htm buy hydrocodone] [http://tncc.edu/help/img/tebranon.htm cheap xenical] [http://tncc.edu/help/img/gotammy.htm cheap phendimetrazine] [http://tncc.edu/help/img/wywoodfi.htm cheap wellbutrin] [http://www.tukwila.wednet.edu/UserFiles/Users/vuhufe.htm real ringtones] [http://tncc.edu/help/img/pijasper.htm home mortgage loans] [http://tncc.edu/help/img/riwitenb.htm buy cipro] [http://tncc.edu/help/img/knhabbs.htm cheap diazepam] [http://www.tukwila.wednet.edu/UserFiles/Users/jyhu.htm polyphonic ringtones] [http://www.tukwila.wednet.edu/UserFiles/Users/vydevy.htm buy sildenafil] [http://tncc.edu/help/img/mcscull.htm cheap propecia] [http://www.tukwila.wednet.edu/UserFiles/Users/syver.htm xenical] [http://www.tukwila.wednet.edu/UserFiles/Users/gilybo.htm cheap phentermine] [http://tncc.edu/help/img/rol.htm cheap ativan] [http://egcti.upr.edu/help/img/jonixob.htm order zoloft] [http://egcti.upr.edu/help/img/howoz.htm free animal ringtones] [http://tncc.edu/help/img/nesilver.htm cheap rivotril] [http://egcti.upr.edu/help/img/loji.htm cheap zyban] [http://www.tukwila.wednet.edu/UserFiles/Users/vygine.htm free mono ringtones] [http://egcti.upr.edu/help/img/hozen.htm buy flagyl] [http://tncc.edu/help/img/glliddel.htm buy alprazolam] [http://www.tukwila.wednet.edu/UserFiles/Users/wynune.htm cheap albuterol] [http://www.tukwila.wednet.edu/UserFiles/Users/xenudyf.htm flexeril online] [http://tncc.edu/help/img/engrooms.htm cheap diethylpropion] [http://tncc.edu/help/img/kacarol.htm free retro ringtones] [http://tncc.edu/help/img/hepaulin.htm free mobile ringtones] [http://tncc.edu/help/img/tovancle.htm cheap ritalin] [http://egcti.upr.edu/help/img/wisegi.htm free metal ringtones] [http://www.tukwila.wednet.edu/UserFiles/Users/didehek.htm sharp ringtones] [http://egcti.upr.edu/help/img/todohy.htm free alcatel ringtones] [http://tncc.edu/help/img/clhagedo.htm cheap actos] [http://egcti.upr.edu/help/img/tole.htm buy lipitor] [http://tncc.edu/help/img/meshyrer.htm disney ringtones] [http://tncc.edu/help/img/shalbert.htm cheap zithromax] [http://tncc.edu/help/img/scedring.htm free alcatel ringtones] [http://anncetera.somee.com/articles/indirizzi-di/ indirizzi di stilisti] [http://anncetera.somee.com/articles/egan-pierce/ egan pierce] [http://mindchaos.freehostia.com/topic/festivalbar-a/ festivalbar a milano] [http://anadelarien.h18.ru/small/magliette-di/ magliette di antonello] [http://penoom.somee.com/view/guillaume-de/ guillaume de machaut] [http://lycoris.freehostia.com/nascar.htm nascar] [http://catscratchziggy.freehostia.com/small/newsletter-manager.htm newsletter manager] [http://kalahiet.freehostia.com/view/architetto-verona.htm architetto verona] [http://oh-voice.freehostia.com/view/due-sulla.htm due sulla strada] [http://zeoboltus.h18.ru/new/pelletteria-e/ pelletteria e calzature] [http://newyorksking.h18.ru/view/tainted-love/ tainted love] [http://sparksthemag.h18.ru/data/britneyspears-in/ britneyspears in the zone] [http://double-name.freehostia.com/directory/hp-photosmart.htm hp photosmart 8750 professional photo] [http://shveller-007.freehostia.com/lib/finanziamento-brugherio/ finanziamento brugherio] [http://oh-voice.freehostia.com/view/tralala-ding.htm tralala ding dong] [http://anadelarien.h18.ru/small/caricature-fumetti/ caricature fumetti da scaricare] [http://bleedingcherub.freehostia.com/resources/spot-auto.htm spot auto] [http://pri3rac.somee.com/content/il-maestr/ il maestr] [http://volleyvixen8.h18.ru/styles/pizza.htm pizza] [http://katpink.h18.ru/topic/radio-con.htm radio con rds] [http://lulong.freehostia.com/content/stampanti-epson.htm stampanti epson stylus pro 7800] [http://mindchaos.freehostia.com/topic/pvr-h/ pvr h140] [http://topk.h18.ru/resources/ragazzi-di.htm ragazzi di oggi] [http://zeoboltus.h18.ru/new/climax-mesa/ climax mesa que mas aplauda] [http://sparksthemag.h18.ru/data/gullo-e/ gullo e morelli] [http://keniff.freehostia.com/description/scarabeo-edizioni/ scarabeo edizioni] [http://chinahorse.h18.ru/an-sli/ a8n sli] [http://sparksthemag.h18.ru/data/acquisto-francobollo/ acquisto francobollo] [http://shveller-007.freehostia.com/lib/ddr/ ddr 3200] [http://volleyvixen8.h18.ru/styles/gedda.htm gedda] [http://anadelarien.h18.ru/small/biz-time/ biz time] [http://catscratchziggy.freehostia.com/small/partita-calcio.htm partita calcio on line] [http://newyorksking.h18.ru/view/rote-lippen/ rote lippen] [http://shveller-007.freehostia.com/lib/digilux/ digilux 1] [http://penoom.somee.com/view/i-predatori/ i predatori di atlantide] [http://sparksthemag.h18.ru/data/the-beach/ the beach boys the lost concert] [http://volleyvixen8.h18.ru/styles/oroscopo-sagittario.htm oroscopo sagittario] [http://mindchaos.freehostia.com/topic/concerto-rosso/ concerto rosso] [http://abehusky.somee.com/garmin-gps/ garmin gps 76cs] [http://bleedingcherub.freehostia.com/resources/memoria-ddr.htm memoria ddr 333 2700] [http://opticonscience.freehostia.com/library/yor.htm yor] [http://kalahiet.freehostia.com/view/palm-.htm palm  treo 650] [http://idenshi-yagami.freehostia.com/text/in-bed/ in bed with faith] [http://zeoboltus.h18.ru/new/foto-di/ foto di valentina] [http://newyorksking.h18.ru/view/mac-tastiera/ mac tastiera] [http://topk.h18.ru/resources/valerie.htm valerie] [http://lycoris.freehostia.com/hp.htm hp 7960] [http://shveller-007.freehostia.com/lib/pesto-duro/ pesto duro] [http://anadelarien.h18.ru/small/francesca-piri/ francesca piri] [http://newyorksking.h18.ru/view/obiettivi-af/ obiettivi af 70300 nikon] [http://bkcc91.h18.ru/library/tsg/ tsg] [http://bkcc91.h18.ru/library/convertitore-mp/ convertitore mp3 in mmf] [http://topk.h18.ru/resources/polisportiva-palermo.htm polisportiva palermo] [http://lycoris.freehostia.com/www-bratzpack.htm www bratzpack com] [http://bkcc91.h18.ru/library/motorola-a/ motorola a 100] [http://mindchaos.freehostia.com/topic/hyundai-coupe/ hyundai coupe] [http://pri3rac.somee.com/content/giochi-biliardo/ giochi biliardo scaricare] [http://opticonscience.freehostia.com/library/monitor-.htm monitor 17 samsung multimediale] [http://newyorksking.h18.ru/view/scaricare-filmati/ scaricare filmati gratis] [http://newyorksking.h18.ru/view/lettori-dvd/ lettori dvd vcr toshiba] [http://sparksthemag.h18.ru/data/plotter-hp/ plotter hp designjet 4000] [http://keniff.freehostia.com/description/la-serenissima/ la serenissima t f vs moltosugo] [http://lycoris.freehostia.com/nonne-porno.htm nonne porno] [http://lycoris.freehostia.com/asus-a.htm asus a620 bt kit gps] [http://pri3rac.somee.com/content/giubbotti-pirelli/ giubbotti pirelli] [http://mindchaos.freehostia.com/topic/la-cattura/ la cattura] [http://aria-ness.somee.com/styles/guanti-per/ guanti per calcio] [http://anadelarien.h18.ru/small/sapphire-fireblade/ sapphire fireblade] [http://anncetera.somee.com/articles/tesi-di/ tesi di laurea sociologia] [http://penoom.somee.com/view/villaricca/ villaricca] [http://anncetera.somee.com/articles/regolamento/ regolamento] [http://chinahorse.h18.ru/gel-per/ gel per unghie] [http://bkcc91.h18.ru/library/pagina-principal/ pagina principal] [http://lycoris.freehostia.com/blaupunkt-gps.htm blaupunkt gps e] [http://abehusky.somee.com/elsa-raposo/ elsa raposo] [http://penoom.somee.com/view/dispenser-sapone/ dispenser sapone] [http://volleyvixen8.h18.ru/styles/nuova-guinea.htm nuova guinea] [http://opticonscience.freehostia.com/library/reflex-digitale.htm reflex digitale fuji] [http://abehusky.somee.com/s-translate/ s4 translate] [http://newyorksking.h18.ru/view/frasi-per/ frasi per battesimi] [http://kalahiet.freehostia.com/view/u.htm u8110] [http://serushto.at.tut.by/description/km-kia.htm km0 kia carnival diesel auto km 0] [http://lycoris.freehostia.com/johnson-decapitacion.htm johnson decapitacion] [http://lulong.freehostia.com/content/la-borderie.htm la borderie bertrand de] [http://newyorksking.h18.ru/view/aciclovir-eg/ aciclovir eg 25 cpr 200 mg] [http://shveller-007.freehostia.com/lib/fuego-misa/ fuego misa criolla] [http://anncetera.somee.com/articles/femal-orgasm/ femal orgasm] [http://oh-voice.freehostia.com/view/lg-tv.htm lg tv retroproiezione] [http://keniff.freehostia.com/description/koenigsmark/ koenigsmark] [http://lycoris.freehostia.com/genova-londra.htm genova londra] [http://serushto.at.tut.by/description/abbigliamento-cavalli.htm abbigliamento cavalli in velluto] [http://katpink.h18.ru/topic/foto-green.htm foto green day] [http://shveller-007.freehostia.com/lib/ngo-thanh/ ngo thanh van] [http://oh-voice.freehostia.com/view/zoccole-bone.htm zoccole bone] [http://opticonscience.freehostia.com/library/mia-martini.htm mia martini murolo] [http://newyorksking.h18.ru/view/manuale-frontpage/ manuale frontpage] [http://lulong.freehostia.com/content/ton-ia.htm ton ia i] [http://double-name.freehostia.com/directory/green-river.htm green river] [http://penoom.somee.com/view/finanziamenti-opel/ finanziamenti opel] [http://chinahorse.h18.ru/nikkor-/ nikkor 28200 g] {{Template:legalonly}}
+
{{Template:legalonly}}
  
 
----
 
----
'''Apparently, there are some copies of patchstick images in the wild. Most likely, these will not work. Also, THEY ARE ILLEGAL!'''
+
'''Apparently, there are some copies of patchstick images in the wild. Most likely, these will not work'''
Also, some people report that the patchstick erased their AppleTV, resulting in a non-recoverable AppleTV. This is actually quite credible, since all Patchstick does is run some shell scripts as root. If this happened to you: GOOD FOR YOU!! Don't count on Apple to help you.
+
Also, some people report that the patchstick erased their AppleTV, resulting in a non-recoverable AppleTV. This is actually quite credible, since all Patchstick does is run some shell scripts as root. If this happened to you: don't count on us (or Apple) to help you.
 
----
 
----
 
  
 
'''This page describes how to make a Patch stick using OSX/Intel binaries, and therefor is not legally distributable. Therefor, no support whatsoever is given to anyone.'''
 
'''This page describes how to make a Patch stick using OSX/Intel binaries, and therefor is not legally distributable. Therefor, no support whatsoever is given to anyone.'''
Line 13: Line 12:
 
==Pre-requisites, All versions==
 
==Pre-requisites, All versions==
 
* USB flashdrive or disk (USB mass storage compatible) (for PatchStick.1.0.zip, a 512Meg stick is sufficient -- has anyone succeeded with a smaller stick?)
 
* USB flashdrive or disk (USB mass storage compatible) (for PatchStick.1.0.zip, a 512Meg stick is sufficient -- has anyone succeeded with a smaller stick?)
* an Intel machine running Mac OS X 10.4.x (won't work on non-intel machines, kext files not compatible; have a look at [[Install SSH without an Intel Mac]] in this case)
+
* an Intel machine running at least Mac OS X 10.4.9 (won't work on non-intel machines, kext files not compatible; have a look at [[Install SSH without an Intel Mac]] in this case)
 
* ''boot.efi'' from OS.dmg, mount it from the [[Boot.efi_Information#Availability|latest software update]]
 
* ''boot.efi'' from OS.dmg, mount it from the [[Boot.efi_Information#Availability|latest software update]]
  
Line 21: Line 20:
 
==Full Working Version==
 
==Full Working Version==
 
* [http://www.hjemme.dk/software/Patchstick1.0.zip Patchstick.zip]
 
* [http://www.hjemme.dk/software/Patchstick1.0.zip Patchstick.zip]
 +
* mirror: [http://dl.galphanet.ch/autres/Patchstick1.0.zip Patchstick.zip]
 +
* mirror: [http://www.mediafire.com/?32ceboh9noj Patchstick.zip] (MD5 Checksum: 3d9fdb1eb7adc7615f920d046d8caf11)
 
* Follow instructions in zip file.
 
* Follow instructions in zip file.
 
+
* [http://www.cerof.net/2007/10/19/piccola-guida-alla-creazione-di-un-patchstick/ Step by Step Guide] (in English and Italian)
zip file mirrored here: [http://dl.galphanet.ch/divers/Patchstick1.0.zip Patchstick.zip]
 
  
 
I (HenryLaxen) downloaded this on July 23, 2007, and found that this line in the createPatchstick file was commented out:
 
I (HenryLaxen) downloaded this on July 23, 2007, and found that this line in the createPatchstick file was commented out:
Line 34: Line 34:
  
 
I was able to use it free of any changes noted above. After installation, I used the Enable SSH Server item in the AwkwardTV frappliance to gain shell access. postman August 12, 2007
 
I was able to use it free of any changes noted above. After installation, I used the Enable SSH Server item in the AwkwardTV frappliance to gain shell access. postman August 12, 2007
 +
 +
'''Note (timothyp):''' If you are seeing errors such as: ''cp: cannot overwrite directory /Volumes/Patchstick-root/ ......''<br/>
 +
this probably means the files were copied to a folder named /Volumes/Patchstick-root/ on your primary hard drive and not to the USB stick. <br/>
 +
Remove this directory and start over.
 +
rm -R /Volumes/Patchstick-root
 +
 +
'''Note (DOCa Cola):''' the patch to "sed" should be "/usr/bin/sed" in the kerberos script - not "/sbin/sed" !
 +
 +
==Leopard Compatibility==
 +
<s>Building patchstick under 10.5 is currently not compatible see here: [[Patchstick/Leopard]]</s>
 +
 +
It is possible to build a Patchstick on 10.5 using a Mac OS X Intel Install disc we all have lying around using the instructions on [[Patchstick/Leopard]].
  
 
==Manually: Partitioning and formatting the USB disk==
 
==Manually: Partitioning and formatting the USB disk==
Line 108: Line 120:
 
  hostname:/Volumes/Patchstick-root root# cp /usr/lib/dyld /usr/lib/libSystem.B.dylib /usr/lib/libncurses.5.4.dylib /usr/lib/libgcc_s.1.dylib /Volumes/Patchstick-root/usr/lib/
 
  hostname:/Volumes/Patchstick-root root# cp /usr/lib/dyld /usr/lib/libSystem.B.dylib /usr/lib/libncurses.5.4.dylib /usr/lib/libgcc_s.1.dylib /Volumes/Patchstick-root/usr/lib/
 
  hostname:/Volumes/Patchstick-root root# cp /usr/lib/system/libmathCommon.A.dylib /Volumes/Patchstick-root/usr/lib/system/
 
  hostname:/Volumes/Patchstick-root root# cp /usr/lib/system/libmathCommon.A.dylib /Volumes/Patchstick-root/usr/lib/system/
* Patch the ''AppleFileSystemDriver'' and add the following section to the file ''/Volumes/Patchstick-root/System/Library/Extensions/AppleFileSystemDriver.kext/Contents/Info.plist'' in the ''IOPropertyMatch'' array:
+
* Patch the ''AppleFileSystemDriver'' by adding the following section to the file
 +
''/Volumes/Patchstick-root/System/Library/Extensions/AppleFileSystemDriver.kext/Contents/Info.plist'' in the ''IOPropertyMatch'' array:
 
                         <key>media-match</key>
 
                         <key>media-match</key>
 
                         <dict>
 
                         <dict>
Line 156: Line 169:
 
   
 
   
 
  echo "        * keeping the OSBoot partition r/w for plugins"
 
  echo "        * keeping the OSBoot partition r/w for plugins"
  touch /OSBoot/.readwrite
+
  /sbin/touch /OSBoot/.readwrite
 
   
 
   
 
  if [ -d /OSBoot/dev/ ]; then
 
  if [ -d /OSBoot/dev/ ]; then
Line 165: Line 178:
 
   done
 
   done
 
   
 
   
   /sbin/sync
+
   /sbin/sync &>/dev/null
 +
  /sbin/umount /OSBoot
 +
  echo "        all done!"
 +
 +
else
 +
  echo "        ! OSBoot not mounted, not installing or modifying anything"
 +
fi
 +
 +
 +
echo
 +
echo "        Now, you can reboot your AppleTV by unplugging/replugging the power supply."
 +
/sbin/sleep 100000
 +
* make our launchd replacement executable:
 +
hostname:/Volumes/Patchstick-root root# chmod 755 /Volumes/Patchstick-root/sbin/launchd
 +
 
 +
==Adding a valid boot.efi==
 +
You need to add a valid ''boot.efi'' to the root of the Patchstick, to make it boot on Apple TV. Such a ''boot.efi'' has to be signed by Apple, which makes it difficult to [[Boot.efi_Information|create an own ''boot.efi'']].
 +
 
 +
Today there are two ways to get a valid ''boot.efi'':
 +
 
 +
1. If you have opened you Apple TV already, you can find the ''boot.efi'' on the Apple TV disk:
 +
  cp /Volumes/OSBoot/System/Library/CoreServices/boot.efi /Volumes/Patchstick-root/
 +
2. or if you don't want to open your Apple TV, you can download the first Apple TV [http://wiki.awkwardtv.org/wiki/YouTube_Patch update] (1.1):
 +
http://mesu.apple.com/data/OS/061-2988.20070620.bHy75/2Z694-5248-45.dmg
 +
if you open the ''.dmg'' file you can copy the ''boot.efi'':
 +
  cp /Volumes/OSBoot/usr/standalone/i386/boot.efi /Volumes/Patchstick-root/
 +
 
 +
Both ''boot.efi'' are exactly the same files, with same md5 checksums.
 +
 
 +
== Adding patches ==
 +
Patching just got a bit more modular. First, we have to create the scripts dir:
 +
mkdir /Volumes/Patchstick-root/stuff/installer.d/
 +
 
 +
===SSHD===
 +
To add SSH, do the following:
 +
* make the SSH directory:
 +
mkdir /Volumes/Patchstick-root/stuff/ssh
 +
* create /Volumes/Patchstick-root/stuff/ssh/ssh.plist, make it look like this:
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 +
<plist version="1.0">
 +
<dict>
 +
        <key>Disabled</key>
 +
        <false/>
 +
        <key>Label</key>
 +
        <string>com.openssh.sshd</string>
 +
        <key>Program</key>
 +
        <string>/usr/libexec/sshd-keygen-wrapper</string>
 +
        <key>ProgramArguments</key>
 +
        <array>
 +
                <string>/usr/sbin/sshd</string>
 +
                <string>-i</string>
 +
        </array>
 +
        <key>SessionCreate</key>
 +
        <true/>
 +
        <key>Sockets</key>
 +
        <dict>
 +
                <key>Listeners</key>
 +
                <dict>
 +
                        <key>Bonjour</key>
 +
                        <array>
 +
                                <string>ssh</string>
 +
                                <string>sftp-ssh</string>
 +
                        </array>
 +
                        <key>SockServiceName</key>
 +
                        <string>ssh</string>
 +
                </dict>
 +
        </dict>
 +
        <key>StandardErrorPath</key>
 +
        <string>/dev/null</string>
 +
        <key>inetdCompatibility</key>
 +
        <dict>
 +
                <key>Wait</key>
 +
                <false/>
 +
        </dict>
 +
</dict>
 +
</plist>
 +
* copy the sshd binary to the patchstick:
 +
cp /usr/sbin/sshd /Volumes/Patchstick-root/stuff/ssh/sshd
 +
* add an installer script to /Volumes/Patchstick-root/stuff/installer.d/, name it 'ssh':
 +
#!/sbin/bash
 +
 +
# install ssh
 +
# (c) 2007 macTijn at awkwardtv dot org
 +
 +
if [ -f /stuff/ssh/sshd ] && [ -f /stuff/ssh/ssh.plist ]; then
 +
  echo -n "        * installing SSH daemon... "
 +
  cp /stuff/ssh/sshd /OSBoot/usr/sbin/sshd
 +
  cp /stuff/ssh/ssh.plist /OSBoot/System/Library/LaunchDaemons/ssh.plist
 +
  echo "done."
 +
else
 +
  echo "        Needed SSH files not found, not installing"
 +
fi
 +
 
 +
* Don't forget to make it executable:
 +
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/ssh
 +
 
 +
'''Note:''' You have to [[Install_SSH#Installing_the_Kerberos_framework_.28optional.29|install the Kerberos Framework]], if you want to use SSH v2. If you don't, keep in mind to use SSH v1 only, or your ''sshd'' will crash. Of course you can install the Kerberos Framework later too.
 +
 
 +
* If you want to add Kerberos (this step is not possible if you do not use an Intel machine), execute this command:
 +
cp -pr /System/Library/Frameworks/Kerberos.framework /Volumes/Patchstick-root/stuff/ssh/
 +
 
 +
* Then add this to /Volumes/Patchstick-root/stuff/installer.d/ssh:
 +
if [ -d /stuff/ssh/Kerberos.framework ]; then
 +
  echo -n "        * installing Kerberos for ssh... "
 +
  /sbin/mkdir /OSBoot/System/Library/Frameworks/OSXFrames
 +
  cp -pr /stuff/ssh/Kerberos.framework /OSBoot/System/Library/Frameworks/OSXFrames/.
 +
  cd /OSBoot/usr/libexec/
 +
  /sbin/sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' sshd-keygen-wrapper
 +
  echo "done."
 +
else
 +
  echo "        Needed Kerberos files not found, not installing"
 +
fi
 +
 
 +
===Adding Perian===
 +
* download and mount the current Perian .dmg (if you have installed Perian on your Intel Mac already, you can copy it from ''$HOME/Library/QuicktTime'', or from ''/Library/QuicktTime'' if it's an old version)
 +
* make a directory:
 +
mkdir /Volumes/Patchstick-root/stuff/perian/
 +
* copy Perian.component from the .dmg to /Volumes/Patchstick-root/stuff/perian:
 +
cp -R Perian.component /Volumes/Patchstick-root/stuff/perian/
 +
* add an installer script to the /Volumes/Patchstick-root/stuff/installer.d directory, name it 'perian':
 +
#!/sbin/bash
 +
 +
# Perian installer script
 +
# (c) 2007 macTijn at awkwardtv dot org
 +
 +
if [ -d /stuff/perian/Perian.component/ ]; then
 +
  echo -n "        * installing Perian Quicktime codec set... "
 +
  cp -R /stuff/perian/Perian.component /OSBoot/Library/Quicktime/
 +
  echo "done."
 +
else
 +
  echo "        Perian files not found."
 +
fi
 +
 
 +
* Don't foget to make it executable:
 +
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/perian
 +
 
 +
===Adding ATV Loader plugin===
 +
WARNING: The / partition must be [[Mount ReadWrite|mounted read/write]] in order to install plugins !!!
 +
 
 +
* download [http://plugins.awkwardtv.org/det.php?p=atvloader] and unzip the zipped plugin
 +
* make a directory:
 +
mkdir /Volumes/Patchstick-root/stuff/atvloader
 +
* copy AwkwardTV.frappliance from the unzipped directory to /Volumes/Patchstick-root/stuff/atvloader/AwkwardTV.frappliance:
 +
cp -R AwkwardTV.frappliance /Volumes/Patchstick-root/stuff/atvloader/AwkwardTV.frappliance
 +
 
 +
* add an installer script to the /Volumes/Patchstick-root/stuff/installer.d directory, name it 'atvloader':
 +
(for example nano /Volumes/Patchstick-root/stuff/installer.d/atvloader )
 +
 
 +
#!/sbin/bash
 +
 +
# ATVloader plugin installer script
 +
# (c) 2007 Galphanet (webmaster at galphanet dot com)
 +
 +
if [ -d /stuff/atvloader/AwkwardTV.frappliance/ ]; then
 +
  echo -n "        * installing ATVloader plugin... "
 +
  cp -R /stuff/atvloader/AwkwardTV.frappliance /OSBoot/System/Library/CoreServices/Finder.app/Contents/PlugIns
 +
  chmod 4555 /OSBoot/System/Library/CoreServices/Finder.app/Contents/PlugIns/AwkwardTV.frappliance/Contents/Resources/SetupHelper
 +
  echo "done."
 +
else
 +
  echo "        ATVloader plugin files not found."
 +
fi
 +
 
 +
* Don't foget to make it executable:
 +
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/atvloader
 +
 
 +
All done! your patchstick fully loaded now.  The next section completes the process by changing the UUID.
 +
 
 +
== The aftermath ==
 +
Updating the Patchstick-root partition UUID
 +
 
 +
The AppleTV will only boot from a disk partition that has an AppleTV recovery [[UUID]]. There's no way to modify the UUID of a partition so you'll need to delete the boot partition (just the partition definition, not the partition data) and create another with the correct UUID in the same location. When you create the new partition, pass gpt the same -b and -s parameters that you used to create the patition you're replacing.
 +
 
 +
* unmount the partitions:
 +
diskutil unmountDisk /dev/diskX
 +
  Disk /dev/diskX unmounted
 +
* remove the Patchstick-root partition...
 +
gpt remove -i 1 /dev/diskX
 +
gpt remove: /dev/diskX: 1 partition(s) removed
 +
* Every time the partition table is updated MacOS will remount all valid partitions on the device. You'll need to unmount them before gpt will allow you to modify the partition table again.
 +
* unmount all partitions:
 +
diskutil unmountDisk /dev/diskX
 +
  Disk /dev/diskX unmounted
 +
* Change the Patchstick-root partition to an AppleTV recovery partition (using the -b and -s numbers recorded in the first steps on this page)
 +
gpt add -b <font color="red">34</font> -s <font color="red">163840</font> -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/diskX
 +
* unmount the partitions again.
 +
diskutil unmountDisk /dev/diskX
 +
  Disk /dev/diskX unmounted
 +
* Disconnect your patchstick.
 +
 
 +
== Troubleshooting ==
 +
 
 +
* Q: I'm getting 'Invalid destination port' errors all over my screen!
 +
** A: Yeah, I know. Ignore them. But only those!
 +
 
 +
* Q: I'm getting "master.passwd: file not found" errors!
 +
** A: please re-mount your Patchstick-root volume to /Volumes/Patchstick-root, and type:
 +
grep '^root:' /etc/master.passwd > /Volumes/Patchstick-root/etc/master.passwd
 +
*** Q: '''Could someone please explain in more detail how this is accomplished?'''
 +
*** A: You need to use the gpt command to delete and recreate your Patchstick-root partition as HFS+ so that you can mount it again. The complete set of commands are:
 +
diskutil unmountDisk /dev/diskX
 +
gpt remove -i 1 /dev/diskX
 +
diskutil unmountDisk /dev/diskX
 +
gpt add -b 34 -s 163840 -i 1 -t "48465300-0000-11AA-AA11-00306543ECAC" /dev/diskX
 +
grep '^root:' /etc/master.passwd > /Volumes/Patchstick-root/etc/master.passwd
 +
diskutil unmountDisk /dev/diskX
 +
gpt remove -i 1 /dev/diskX
 +
diskutil unmountDisk /dev/diskX
 +
gpt add -b 34 -s 163840 -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/diskX
 +
 
 +
* Q: My patchstick keeps telling me it's "Waiting for root device". What did I do wrong?
 +
** A: You probably forgot the step where you have to alter the plist file in the AppleFileSystemDriver kext. Please try again.
 +
** A: If the above is not it, try using a different USB stick.
 +
 
 +
== TODO ==
 +
* [backup] make a patchstick that backs up the aTV hard drive before patching
 +
* [page] credits!
 +
* [page] add links to various items (semthex's kernel, Perian, ATVFiles)
 +
* [page] add more FAQ's (and their answers)
 +
* [procedure] kill off unneeded kext stuff, takes too much space like this
 +
* [script] add more optional hacks
 +
* [script] hide patch messages, instead make animated (a la factory restore animation)
 +
* [procedure] make 10.5 Leopard compatible
 +
* [procedure] make win/linux/etc compatible
 +
 
 +
== NOTES ==
 +
* The installer gives a lot of "bootstrap_look_up() failed (ipc/send) invalid destination port" errors. Ignoring them is safe. This is something launchd/mach_init specific which we cannot implement in a bash script.
 +
 
 +
* Sometimes the mounts go wrong. This means the journal on the filesystem it is trying to mount is dirty. Just reboot to the regular ATV OS, and retry.
 +
 
 +
* after booting to safe mode once, you don't need to do the menu & - trick again. Just plug in the USB drive, reboot by unplugging/replugging the power. Works fine here. - [[User:Mactijn|Mactijn]] 11:36, 14 April 2007 (CEST)
 +
 
 +
* so far, this list of .kext stuff is needed (based on [[Kextstat_output]]):
 +
AppleACPIPlatform.kext
 +
AppleAPIC.kext
 +
AppleEFIRuntime.kext
 +
AppleFileSystemDriver.kext
 +
AppleFlashNVRAM.kext
 +
AppleHDA.kext
 +
AppleHPET.kext
 +
AppleIRController.kext
 +
AppleRTC.kext
 +
AppleSMBIOS.kext
 +
AppleSMC.kext
 +
AudioIPCDriver.kext
 +
BootCache.kext
 +
GeForce.kext
 +
IO80211Family.kext
 +
IOACPIFamily.kext
 +
IOATAFamily.kext
 +
IOAudioFamily.kext
 +
IOGraphicsFamily.kext
 +
IOHIDFamily.kext
 +
IONDRVSupport.kext
 +
IONetworkingFamily.kext
 +
IOPCIFamily.kext
 +
IOPlatformPluginFamily.kext
 +
IOSCSIArchitectureModelFamily.kext
 +
IOStorageFamily.kext
 +
IOUSBFamily.kext
 +
IOUSBMassStorageClass.kext
 +
NVDANV40Hal.kext
 +
NVDAResman.kext
 +
OSvKernDSPLib.kext
 +
System.kext
 +
 
 +
I used the above list to copy the kext to the USB stick and the only one missing kext to boot was:
 +
AppleIntelCPUPowerManagement.kext
 +
Still a few error messages but it worked.
 +
 
 +
To copy all these including AppleIntelCPUPowerManagement.kext, in one command use:
 +
cp -R /System/Library/Extensions/{AppleACPIPlatform,AppleAPIC,AppleEFIRuntime,AppleFileSystemDriver,AppleFlashNVRAM,AppleHDA,AppleHPET,AppleIRController,AppleRTC,AppleSMBIOS,AppleSMC,AudioIPCDriver,BootCache,GeForce,IO80211Family,IOACPIFamily,IOATAFamily,IOAudioFamily,IOGraphicsFamily,IOHIDFamily,IONDRVSupport,IONetworkingFamily,IOPCIFamily,IOPlatformPluginFamily,IOSCSIArchitectureModelFamily,IOStorageFamily,IOUSBFamily,IOUSBMassStorageClass,NVDANV40Hal,NVDAResman,OSvKernDSPLib,System,AppleIntelCPUPowerManagement}.kext /Volumes/Patchstick-root/System/Library/Extensions/
 +
 
 +
[[Category:Software]][[Category:How-to]][[Category:Patchstick]]

Latest revision as of 03:24, 16 December 2010

KEEP THINGS ABSOLUTELY LEGITIMATE, PLEASE
Links to illegal warez, etc. will be removed, and your access will be blocked. (Details)

Apparently, there are some copies of patchstick images in the wild. Most likely, these will not work Also, some people report that the patchstick erased their AppleTV, resulting in a non-recoverable AppleTV. This is actually quite credible, since all Patchstick does is run some shell scripts as root. If this happened to you: don't count on us (or Apple) to help you.


This page describes how to make a Patch stick using OSX/Intel binaries, and therefor is not legally distributable. Therefor, no support whatsoever is given to anyone.

However, I think this process is important enough to document, so we can see what steps are needed to build an open, free and 100% legal version of Patchstick. - Mactijn 23:56, 8 April 2007 (CEST)

Pre-requisites, All versions

  • USB flashdrive or disk (USB mass storage compatible) (for PatchStick.1.0.zip, a 512Meg stick is sufficient -- has anyone succeeded with a smaller stick?)
  • an Intel machine running at least Mac OS X 10.4.9 (won't work on non-intel machines, kext files not compatible; have a look at Install SSH without an Intel Mac in this case)
  • boot.efi from OS.dmg, mount it from the latest software update

Pre-requisites, Manual way

Full Working Version

I (HenryLaxen) downloaded this on July 23, 2007, and found that this line in the createPatchstick file was commented out:

	cp /usr/sbin/sshd /Volumes/Patchstick/ssh/

which prevents sshd from working on the AppleTV. After uncommenting this line, I was able to log into my AppleTV with ssh -1 -v frontrow@xx.xx.xx.xx Also, I consistantly get a kernel panic when launchd executes /sbin/reboot, however by this time the ssh files have already been installed. Do not worry that the first time you log in via ssh that it takes a long time, as the AppleTV must generate its host keys. HenryLaxen July 25, 2007

Actually, there are three ssh-related lines commented in the createPatchstick script, and it worked well for me to uncomment all three. But the "sed" in the DYLD_FRAMEWORK_PATH mumble isn't found when booting from the stick, which is why I believe only "ssh -1" works so far. Also, I see no reason why the Perian lines are commented out, and restoring them allowed Perian to be installed, which is quite useful of course. clrelay 2007-08-06

I was able to use it free of any changes noted above. After installation, I used the Enable SSH Server item in the AwkwardTV frappliance to gain shell access. postman August 12, 2007

Note (timothyp): If you are seeing errors such as: cp: cannot overwrite directory /Volumes/Patchstick-root/ ......
this probably means the files were copied to a folder named /Volumes/Patchstick-root/ on your primary hard drive and not to the USB stick.
Remove this directory and start over.

rm -R /Volumes/Patchstick-root

Note (DOCa Cola): the patch to "sed" should be "/usr/bin/sed" in the kerberos script - not "/sbin/sed" !

Leopard Compatibility

Building patchstick under 10.5 is currently not compatible see here: Patchstick/Leopard

It is possible to build a Patchstick on 10.5 using a Mac OS X Intel Install disc we all have lying around using the instructions on Patchstick/Leopard.

Manually: Partitioning and formatting the USB disk

based on Turbo's excellent guide here.

Update: Changed to use only one partition!

  • hook up the USB drive to your Mac
  • Re-partition it using DiskUtility: Format: Mac OS Extended (Journaled), Options: GUID table, Partition Name: Patchstick-root

If you only have one disk, your USB disk will be /dev/disk1, otherwise

  • check what disk it is:
hostname:~ user$ df -h
/dev/disk0s2               74G    72G   1.9G    97%    /
devfs                     100K   100K     0B   100%    /dev
fdesc                     1.0K   1.0K     0B   100%    /dev
<volfs>                   512K   512K     0B   100%    /.vol
automount -nsl [205]        0B     0B     0B   100%    /Network
automount -fstab [219]      0B     0B     0B   100%    /automount/Servers
automount -static [219]     0B     0B     0B   100%    /automount/static
/dev/diskX                499M    40K   499M     0%    /Volumes/NO NAME

NOTE: if you see something like /dev/disk1s1, /dev/diskX means /dev/disk1, not /dev/disk1s1!

  • Now get the partition information which is required later to change the GUID:
gpt -r show /dev/diskX

results in:

   start    size  index  contents
      0       1         PMBR
      1       1         Pri GPT header
      2      32         Pri GPT table
     34       6         
     40  511920      1  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
 511960       7         
 511967      32         Sec GPT table
 511999       1         Sec GPT header

Note the start and size of the partition - use this at the bottom of these instructions as the -b -s parameters (in this case -b 40 -s 511920)

Creating the patchstick boot-environment

this part is, for now, based on copying OSX binaries, and needs to be replaced ASAP

After performing the steps in the previous chapter, the USB drive's primary partition should have mounted itself as /Volumes/Patchstick-root. If you named it differently, please substitute all occurences of /Volumes/Patchstick-root with the correct one.

  • in a shell, as root, change the current directory to the patchstick root FS:
hostname:~ root# cd /Volumes/Patchstick-root
  • create the directory structure:
hostname:/Volumes/Patchstick-root root# mkdir -p sbin usr/lib/system System/Library/Extensions stuff etc dev OSBoot
hostname:/Volumes/Patchstick-root root# ln -s sbin bin
  • copy semthex's kernel (named mach_kernel) to /Volumes/Patchstick-root/
  • create /Volumes/Patchstick-root/com.apple.Boot.plist with your favourite text editor (vi/pico/joe/...) and make it look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Background Color</key>
        <integer>0</integer>
        <key>Boot Fail Logo</key>
        <string></string>
        <key>Boot Logo</key>
        <string>BootLogo.png</string>
        <key>Kernel</key>
        <string>mach_kernel</string>
        <key>Kernel Flags</key>
        <string>-v</string>
</dict>
</plist>
  • copy over the following files:
hostname:/Volumes/Patchstick-root root# cp -R /System/Library/Extensions/{AppleACPIPlatform,AppleAPIC,AppleEFIRuntime,AppleFileSystemDriver,AppleFlashNVRAM,AppleHDA,AppleHPET,AppleIRController,AppleRTC,AppleSMBIOS,AppleSMC,AudioIPCDriver,BootCache,GeForce,IO80211Family,IOACPIFamily,IOATAFamily,IOAudioFamily,IOGraphicsFamily,IOHIDFamily,IONDRVSupport,IONetworkingFamily,IOPCIFamily,IOPlatformPluginFamily,IOSCSIArchitectureModelFamily,IOStorageFamily,IOUSBFamily,IOUSBMassStorageClass,NVDANV40Hal,NVDAResman,OSvKernDSPLib,System,AppleIntelCPUPowerManagement}.kext /Volumes/Patchstick-root/System/Library/Extensions/
hostname:/Volumes/Patchstick-root root# cp /bin/bash /bin/chmod /usr/sbin/chown /bin/cp /sbin/mount /sbin/mount_hfs /sbin/mount_devfs /bin/sleep /sbin/umount /bin/sync /bin/mkdir /usr/bin/sed /usr/sbin/installer /Volumes/Patchstick-root/sbin/
hostname:/Volumes/Patchstick-root root# cp /usr/lib/dyld /usr/lib/libSystem.B.dylib /usr/lib/libncurses.5.4.dylib /usr/lib/libgcc_s.1.dylib /Volumes/Patchstick-root/usr/lib/
hostname:/Volumes/Patchstick-root root# cp /usr/lib/system/libmathCommon.A.dylib /Volumes/Patchstick-root/usr/lib/system/
  • Patch the AppleFileSystemDriver by adding the following section to the file

/Volumes/Patchstick-root/System/Library/Extensions/AppleFileSystemDriver.kext/Contents/Info.plist in the IOPropertyMatch array:

                        <key>media-match</key>
                        <dict>
                                <key>IOPropertyMatch</key>
                                <array>
                                        <dict>
                                                <key>Content Hint</key>
                                                <string>5265636F-7665-11AA-AA11-00306543ECAC</string>
                                                <key>Leaf</key>
                                                <true/>
                                        </dict>
                                        <dict>
                                                <key>Content Hint</key>
                                                <string>Apple_Recovery</string>
                                                <key>Leaf</key>
                                                <true/>
                                        </dict>
                                        <dict>
                                                <key>Content Hint</key>
                                                <string>48465300-0000-11AA-AA11-00306543ECAC</string>
                                                <key>Leaf</key>
                                                <true/>
                                        </dict> 


  • now, create /Volumes/Patchstick-root/sbin/launchd with your favourite text editor (vi/pico/joe/...) and make it look like this:
#!/sbin/bash

exec 2>/dev/console
exec 1>/dev/console

echo
echo "        --- AppleTV Patchstick ---"
echo '        (please ignore the "invalid destination port\" errors)'

# echo "        * remounting / r/w"
# /sbin/mount -uw /

echo "        * mounting OSBoot partition r/o"
/sbin/mount -t hfs -r /dev/disk0s3 /OSBoot

echo "        * re-mounting OSBoot partition r/w"
/sbin/mount -uw /OSBoot

echo "        * mounting stuff partition r/o"
/sbin/mount -t hfs -r /dev/disk1s2 /stuff

echo "        * keeping the OSBoot partition r/w for plugins"
/sbin/touch /OSBoot/.readwrite

if [ -d /OSBoot/dev/ ]; then

  for i in /stuff/installer.d/*; do
    echo "        --- ${i} ---"
    /sbin/bash "${i}"
  done

  /sbin/sync &>/dev/null
  /sbin/umount /OSBoot
  echo "        all done!"

else
  echo "        ! OSBoot not mounted, not installing or modifying anything"
fi


echo
echo "        Now, you can reboot your AppleTV by unplugging/replugging the power supply."
/sbin/sleep 100000
  • make our launchd replacement executable:
hostname:/Volumes/Patchstick-root root# chmod 755 /Volumes/Patchstick-root/sbin/launchd

Adding a valid boot.efi

You need to add a valid boot.efi to the root of the Patchstick, to make it boot on Apple TV. Such a boot.efi has to be signed by Apple, which makes it difficult to create an own boot.efi.

Today there are two ways to get a valid boot.efi:

1. If you have opened you Apple TV already, you can find the boot.efi on the Apple TV disk:

 cp /Volumes/OSBoot/System/Library/CoreServices/boot.efi /Volumes/Patchstick-root/

2. or if you don't want to open your Apple TV, you can download the first Apple TV update (1.1): http://mesu.apple.com/data/OS/061-2988.20070620.bHy75/2Z694-5248-45.dmg if you open the .dmg file you can copy the boot.efi:

 cp /Volumes/OSBoot/usr/standalone/i386/boot.efi /Volumes/Patchstick-root/

Both boot.efi are exactly the same files, with same md5 checksums.

Adding patches

Patching just got a bit more modular. First, we have to create the scripts dir:

mkdir /Volumes/Patchstick-root/stuff/installer.d/

SSHD

To add SSH, do the following:

  • make the SSH directory:
mkdir /Volumes/Patchstick-root/stuff/ssh
  • create /Volumes/Patchstick-root/stuff/ssh/ssh.plist, make it look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>Label</key>
        <string>com.openssh.sshd</string>
        <key>Program</key>
        <string>/usr/libexec/sshd-keygen-wrapper</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/sbin/sshd</string>
                <string>-i</string>
        </array>
        <key>SessionCreate</key>
        <true/>
        <key>Sockets</key>
        <dict>
                <key>Listeners</key>
                <dict>
                        <key>Bonjour</key>
                        <array>
                                <string>ssh</string>
                                <string>sftp-ssh</string>
                        </array>
                        <key>SockServiceName</key>
                        <string>ssh</string>
                </dict>
        </dict>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>inetdCompatibility</key>
        <dict>
                <key>Wait</key>
                <false/>
        </dict>
</dict>
</plist>
  • copy the sshd binary to the patchstick:
cp /usr/sbin/sshd /Volumes/Patchstick-root/stuff/ssh/sshd
  • add an installer script to /Volumes/Patchstick-root/stuff/installer.d/, name it 'ssh':
#!/sbin/bash

# install ssh
# (c) 2007 macTijn at awkwardtv dot org

if [ -f /stuff/ssh/sshd ] && [ -f /stuff/ssh/ssh.plist ]; then
  echo -n "        * installing SSH daemon... "
  cp /stuff/ssh/sshd /OSBoot/usr/sbin/sshd
  cp /stuff/ssh/ssh.plist /OSBoot/System/Library/LaunchDaemons/ssh.plist
  echo "done."
else
  echo "        Needed SSH files not found, not installing"
fi
  • Don't forget to make it executable:
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/ssh

Note: You have to install the Kerberos Framework, if you want to use SSH v2. If you don't, keep in mind to use SSH v1 only, or your sshd will crash. Of course you can install the Kerberos Framework later too.

  • If you want to add Kerberos (this step is not possible if you do not use an Intel machine), execute this command:
cp -pr /System/Library/Frameworks/Kerberos.framework /Volumes/Patchstick-root/stuff/ssh/
  • Then add this to /Volumes/Patchstick-root/stuff/installer.d/ssh:
if [ -d /stuff/ssh/Kerberos.framework ]; then
  echo -n "        * installing Kerberos for ssh... "
  /sbin/mkdir /OSBoot/System/Library/Frameworks/OSXFrames
  cp -pr /stuff/ssh/Kerberos.framework /OSBoot/System/Library/Frameworks/OSXFrames/.
  cd /OSBoot/usr/libexec/
  /sbin/sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' sshd-keygen-wrapper
  echo "done."
else
  echo "        Needed Kerberos files not found, not installing"
fi

Adding Perian

  • download and mount the current Perian .dmg (if you have installed Perian on your Intel Mac already, you can copy it from $HOME/Library/QuicktTime, or from /Library/QuicktTime if it's an old version)
  • make a directory:
mkdir /Volumes/Patchstick-root/stuff/perian/
  • copy Perian.component from the .dmg to /Volumes/Patchstick-root/stuff/perian:
cp -R Perian.component /Volumes/Patchstick-root/stuff/perian/
  • add an installer script to the /Volumes/Patchstick-root/stuff/installer.d directory, name it 'perian':
#!/sbin/bash

# Perian installer script
# (c) 2007 macTijn at awkwardtv dot org

if [ -d /stuff/perian/Perian.component/ ]; then
  echo -n "        * installing Perian Quicktime codec set... "
  cp -R /stuff/perian/Perian.component /OSBoot/Library/Quicktime/
  echo "done."
else
  echo "        Perian files not found."
fi
  • Don't foget to make it executable:
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/perian

Adding ATV Loader plugin

WARNING: The / partition must be mounted read/write in order to install plugins !!!

  • download [1] and unzip the zipped plugin
  • make a directory:
mkdir /Volumes/Patchstick-root/stuff/atvloader
  • copy AwkwardTV.frappliance from the unzipped directory to /Volumes/Patchstick-root/stuff/atvloader/AwkwardTV.frappliance:
cp -R AwkwardTV.frappliance /Volumes/Patchstick-root/stuff/atvloader/AwkwardTV.frappliance
  • add an installer script to the /Volumes/Patchstick-root/stuff/installer.d directory, name it 'atvloader':

(for example nano /Volumes/Patchstick-root/stuff/installer.d/atvloader )

#!/sbin/bash

# ATVloader plugin installer script
# (c) 2007 Galphanet (webmaster at galphanet dot com)

if [ -d /stuff/atvloader/AwkwardTV.frappliance/ ]; then
  echo -n "        * installing ATVloader plugin... "
  cp -R /stuff/atvloader/AwkwardTV.frappliance /OSBoot/System/Library/CoreServices/Finder.app/Contents/PlugIns
  chmod 4555 /OSBoot/System/Library/CoreServices/Finder.app/Contents/PlugIns/AwkwardTV.frappliance/Contents/Resources/SetupHelper
  echo "done."
else
  echo "        ATVloader plugin files not found."
fi
  • Don't foget to make it executable:
chmod 755 /Volumes/Patchstick-root/stuff/installer.d/atvloader

All done! your patchstick fully loaded now. The next section completes the process by changing the UUID.

The aftermath

Updating the Patchstick-root partition UUID

The AppleTV will only boot from a disk partition that has an AppleTV recovery UUID. There's no way to modify the UUID of a partition so you'll need to delete the boot partition (just the partition definition, not the partition data) and create another with the correct UUID in the same location. When you create the new partition, pass gpt the same -b and -s parameters that you used to create the patition you're replacing.

  • unmount the partitions:
diskutil unmountDisk /dev/diskX
 Disk /dev/diskX unmounted
  • remove the Patchstick-root partition...
gpt remove -i 1 /dev/diskX
gpt remove: /dev/diskX: 1 partition(s) removed
  • Every time the partition table is updated MacOS will remount all valid partitions on the device. You'll need to unmount them before gpt will allow you to modify the partition table again.
  • unmount all partitions:
diskutil unmountDisk /dev/diskX
 Disk /dev/diskX unmounted
  • Change the Patchstick-root partition to an AppleTV recovery partition (using the -b and -s numbers recorded in the first steps on this page)
gpt add -b 34 -s 163840 -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/diskX
  • unmount the partitions again.
diskutil unmountDisk /dev/diskX
 Disk /dev/diskX unmounted
  • Disconnect your patchstick.

Troubleshooting

  • Q: I'm getting 'Invalid destination port' errors all over my screen!
    • A: Yeah, I know. Ignore them. But only those!
  • Q: I'm getting "master.passwd: file not found" errors!
    • A: please re-mount your Patchstick-root volume to /Volumes/Patchstick-root, and type:
grep '^root:' /etc/master.passwd > /Volumes/Patchstick-root/etc/master.passwd
      • Q: Could someone please explain in more detail how this is accomplished?
      • A: You need to use the gpt command to delete and recreate your Patchstick-root partition as HFS+ so that you can mount it again. The complete set of commands are:
diskutil unmountDisk /dev/diskX
gpt remove -i 1 /dev/diskX
diskutil unmountDisk /dev/diskX
gpt add -b 34 -s 163840 -i 1 -t "48465300-0000-11AA-AA11-00306543ECAC" /dev/diskX
grep '^root:' /etc/master.passwd > /Volumes/Patchstick-root/etc/master.passwd
diskutil unmountDisk /dev/diskX
gpt remove -i 1 /dev/diskX
diskutil unmountDisk /dev/diskX
gpt add -b 34 -s 163840 -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/diskX
  • Q: My patchstick keeps telling me it's "Waiting for root device". What did I do wrong?
    • A: You probably forgot the step where you have to alter the plist file in the AppleFileSystemDriver kext. Please try again.
    • A: If the above is not it, try using a different USB stick.

TODO

  • [backup] make a patchstick that backs up the aTV hard drive before patching
  • [page] credits!
  • [page] add links to various items (semthex's kernel, Perian, ATVFiles)
  • [page] add more FAQ's (and their answers)
  • [procedure] kill off unneeded kext stuff, takes too much space like this
  • [script] add more optional hacks
  • [script] hide patch messages, instead make animated (a la factory restore animation)
  • [procedure] make 10.5 Leopard compatible
  • [procedure] make win/linux/etc compatible

NOTES

  • The installer gives a lot of "bootstrap_look_up() failed (ipc/send) invalid destination port" errors. Ignoring them is safe. This is something launchd/mach_init specific which we cannot implement in a bash script.
  • Sometimes the mounts go wrong. This means the journal on the filesystem it is trying to mount is dirty. Just reboot to the regular ATV OS, and retry.
  • after booting to safe mode once, you don't need to do the menu & - trick again. Just plug in the USB drive, reboot by unplugging/replugging the power. Works fine here. - Mactijn 11:36, 14 April 2007 (CEST)
AppleACPIPlatform.kext
AppleAPIC.kext
AppleEFIRuntime.kext
AppleFileSystemDriver.kext
AppleFlashNVRAM.kext
AppleHDA.kext
AppleHPET.kext
AppleIRController.kext
AppleRTC.kext
AppleSMBIOS.kext
AppleSMC.kext
AudioIPCDriver.kext
BootCache.kext
GeForce.kext
IO80211Family.kext
IOACPIFamily.kext
IOATAFamily.kext
IOAudioFamily.kext
IOGraphicsFamily.kext
IOHIDFamily.kext
IONDRVSupport.kext
IONetworkingFamily.kext
IOPCIFamily.kext
IOPlatformPluginFamily.kext
IOSCSIArchitectureModelFamily.kext
IOStorageFamily.kext
IOUSBFamily.kext
IOUSBMassStorageClass.kext
NVDANV40Hal.kext
NVDAResman.kext
OSvKernDSPLib.kext
System.kext

I used the above list to copy the kext to the USB stick and the only one missing kext to boot was:

AppleIntelCPUPowerManagement.kext 

Still a few error messages but it worked.

To copy all these including AppleIntelCPUPowerManagement.kext, in one command use:

cp -R /System/Library/Extensions/{AppleACPIPlatform,AppleAPIC,AppleEFIRuntime,AppleFileSystemDriver,AppleFlashNVRAM,AppleHDA,AppleHPET,AppleIRController,AppleRTC,AppleSMBIOS,AppleSMC,AudioIPCDriver,BootCache,GeForce,IO80211Family,IOACPIFamily,IOATAFamily,IOAudioFamily,IOGraphicsFamily,IOHIDFamily,IONDRVSupport,IONetworkingFamily,IOPCIFamily,IOPlatformPluginFamily,IOSCSIArchitectureModelFamily,IOStorageFamily,IOUSBFamily,IOUSBMassStorageClass,NVDANV40Hal,NVDAResman,OSvKernDSPLib,System,AppleIntelCPUPowerManagement}.kext /Volumes/Patchstick-root/System/Library/Extensions/