Showing posts with label atv hack. Show all posts
Showing posts with label atv hack. Show all posts

Tuesday, April 1, 2008

kernel patcher utility (enable USB) - InsanelyMac Forum

Announcement: kernel patcher utility (enable USB) - InsanelyMac Forum


I've written a utility to let you patch your own "mach_kernel.prelink" file (from your AppleTV) (it decompresses it, patches it, then recompresses it). This should allow for legal distribution of 'patches' (without distributing the actual copyrighted binaries).

The utilities I've written are generic 'decompress/patch/compress' tools, but I've included a script/.bat file to apply Turbo's "enable USB port" patch (as described on his web page: http://0xfeedbeef.com/appletv/

I've put the utility on my website - I'd appreciate it if AwkwardTV could host the file (so my website isn't hammered). I'll leave it on my website until either someone else hosts it, or a few days has passed - whichever comes first. (actually, the file is quite small (about 30kbytes)).

Here's a link to the archive containing the utilities (and full source code): prelink_tool.070330a.tgz

(I'm assuming everyone knows how to extract from a gzip-compressed 'tar' file (".tgz" file))

There's a readme.txt inside the archive with more info.

Of course, I take no responsibility if you 'brick' your AppleTV - I assume you know what you're doing if you are patching/replacing kernel files.

Thanks to Turbo for his work in getting the USB port enabled, and for a pointer to the "lzss" compress/decompress source code (which I include in my utility)

Have fun hacking!

- Paul Bartholomew (oz_paulb@hotmail.com)

BTW: the above archive contains Windows (DOS command prompt) ".exe" files. For Unix/Linux, you'll need to build from the included source code. See readme.txt for more info.

Hi -

I just noticed some problems with downloading the ".tgz" file, so in case others have seen the same, here's a ".zip" file that contains the same: http://www.paulbart.net/AppleTV/prelink_tool.070330a.zip

Also, here's the contents of the "readme.txt" file inside the archive:

CODE
================================================================================
==
README for 'prelink_tool' (includes USB whitelist patcher to enable USB on AppleTV)
================================================================================
==


'prelink_tool' written by Paul Bartholomew ([email="oz_paulb@hotmail.com"]oz_paulb@hotmail.com[/email])

USB whitelist patch by Turbo ([url="http://0xfeedbeef.com/appletv/"]http://0xfeedbeef.com/appletv/[/url])



'prelink_tool' is a simple utility to decompress/recompress the "mach_kernel.prelink" file
which contains the AppleTV kernel + several other modules (kext's).

Using this utility, you can decompress the file, 'patch' the resulting binary output, then
recompress to a new "mach_kernel.prelink" file to load onto your AppleTV.


'patching' of the decompressed binary can be done multiple ways. I've included a
simple app that will 'poke' bytes into specific offsets in the file.

I've also included a ".bat" (for DOS prompt in Windows) and ".sh" (for Unix/Linux)
that will make use of these tools to apply Turbo's "enable USB devices" patch as
described on his webpage (referenced above).

================================================================================

NOTE: I am *NOT* including a copy of Apple's (copyrighted) "mach_kernel.prelink"
file, nor am I including a copy of the patched file. Using my utilities, and your
own "mach_kernel.prelink" file (presumably taken from your own AppleTV's hard
drive), you can generate your own modified kernel. This should avoid any legal
issues related to distributing patched (but copyrighted) binaries.
================================================================================



Source code to the utilities is included in the archive, along with Windows
(DOS command problem) ".exe" files (built from the included source using
"MinGW"). If you are not running in Windows, you'll need to build the
utilities on your system from the included source (Makefile is included)

As mentioned above, a ".bat" (Windows) and ".sh" (Unix/Linux) are included which
make use of these utilities to apply Turbo's USB patch. The scripts are called
"do_usb_patch.bat" (Windows) and "do_usb_patch.sh" (Unix/Linux).


Here's how to run the USB patch script:
---------------------------------------

- Extract all files from this archive into a work directory.

- From a command prompt, "cd" into the directory containing the
extracted files

- If you're not running Windows, you'll need to build the utilities
(type "make" from command prompt)

- Copy your own 'original/unpatched' "mach_kernel.prelink" into the
same directory where all of the extracted files are

- If running Windows, type: "do_usb_patch.bat" (without quotes). Or,
if running Unix/Linux, type "do_usb_patch.sh" (without quotes)


The script will use 'prelink_tool' to decompress your
"mach_kernel.prelink" into a temp file (called "mach_kernel_patched.bin").
It will then apply the patches to the temp file (using the 'poke' utility).
It will then re-compress the patched file to a new file called
"mach_kernel_patched.prelink".


You'll need to figure out how to get "mach_kernel.prelink" from your
own AppleTV, and how to replace it with "mach_kernel_patched.prelink".
I'm not an Apple/OS X expert, and wouldn't want to confuse anyone with
my descriptions. Hopefully, someone else can document this process
step-by-step.


I have tested this script from both Windows and a PowerPC Mac Mini using
my original AppleTV "mach_kernel.prelink" (md5sum: a195f9e6b0b4899a2917e5c20602ca1e).
The new "mach_kernel_patched.prelink" (with USB patch applied)
has an this md5sum: c71420b6a021e15e0b6beadf9eab2ba8. As you can see,
this is the same result as Turbo's patched kernel.


I hope that as more 'hacks' need to be applied to "mach_kernel.prelink", we
can make use of these utilities to make easy-to-distribute (legal) mods.


Using the individual ('prelink_tool' and 'poke') utilities
----------------------------------------------------------

The above description is helpful if you just want to apply the USB
patch and move forward (without caring about the details).

If you want to make use of the utilities, here's a quick description
of how they are used:


prelink_tool:
-------------
Usage: prelink_tool [-d|-e] input_file.bin output_file.bin

Use "-d" to decompress an input file ("mach_kernel.prelink")
to a decompressed binary.

Use "-e" to recompress an input file into a new ".prelink" file

The utility takes care of parsing/removing the 'header' before
decompression, and will generate a new header when compressing a
file.




poke:
-----
Usage: poke filename.bin starting_file_offset val1 [val2...valN]

'starting_file_offset' is the byte offset into the file where
patching should start. All subsequent 'values' will be written
starting at this offset.

'val' is either a simple byte value (decimal or "0x??" hex value),
or a 'pair' specified as "old:new" (example: 0x34:0x30). When
a 'pair' is specified, "old" is the value that you expect to
already be at that location, and "new" is the value it should be
replaced with.

The 'poke' utility will ensure that all expected "old" values
are already in the file at those locations before overwriting
(can/should be used as a sanity check to make sure you are
patching the correct file/version of file). If any of the "old"
values don't match, 'poke' will exit with an error status of "1".
Otherwise, it will apply the patch(es), then exit with "0".





See "do_usb_patch.bat/do_usb_patch.sh" for examples of using these
utilities.


Have fun hacking!

- Paul Bartholomew ([email="oz_paulb@hotmail.com"]oz_paulb@hotmail.com[/email])

Manually Take 2.0 Upgrade - AwkwardTV

Take 2.0 Upgrade - AwkwardTV: "Take 2.0 Upgrade

Take 2.0 Upgrade

From AwkwardTV

Jump to: navigation, search

What follows is a step by step guide for upgrading an AppleTV to Take 2.0, and not the latest version (which at the time of this writing is 2.0.1). This can be applied to other versions as well, with the appropriate modifications to the version.xml file and the appropriate update files.

Contents

[hide]

[edit] Requirements

[edit] Hacked AppleTV

First hack your AppleTV to contain software prior to 2.0. This can be done by restoring (if your AppleTV is old enough) if yours is currently running 2.0.1.

[edit] WebServer

You will need a webserver running on a computer where you can put arbitrary files. I turn on web sharing on my mac, and placed the appropriate files within /Library/WebServer/Documents/

[edit] Update Files

You will need the take 2 update files. These can still be downloaded directly from Apple. The files you need are:

* http://mesu.apple.com/data/OS/061-3561.20080212.ScoH6/2Z694-5274-109.dmg
* http://mesu.apple.com/data/OS/061-3561.20080212.ScoH6/2Z694-5274-109.dmg.signature
* http://mesu.apple.com/data/EFI/061-3046.20080212.U7tgG/AppleCapsule.efi
* http://mesu.apple.com/data/EFI/061-3046.20080212.U7tgG/AppleCapsule.efi.signature
* http://mesu.apple.com/data/EFI/009-7567.20080212.Vc45T/LOCKED_ATV11_00DA_00B.scap
* http://mesu.apple.com/data/SI/061-3618.20080212.Pk8Bn/hdmiutil
* http://mesu.apple.com/data/SI/061-3618.20080212.Pk8Bn/hdmiutil.signature
* http://mesu.apple.com/data/SI/061-3617.20080212.Qvh6u/FW29050_20080205_dse_hex.sihex
* http://mesu.apple.com/data/SI/061-3617.20080212.Qvh6u/FW29050_20080205_dse_hex.sihex.signature

[edit] Placing files in the Web Space

Put the above files in your webserver's space. You will be putting them is the same directories as they appear in their URLs. When properly placed, the directory structure should look like this:

ls -R /Library/WebServer/Documents/data
EFI OS SI

/Library/WebServer/Documents/data/EFI:
009-7567.20080212.Vc45T 061-3046.20080212.U7tgG

/Library/WebServer/Documents/data/EFI/009-7567.20080212.Vc45T:
LOCKED_ATV11_00DA_00B.scap

/Library/WebServer/Documents/data/EFI/061-3046.20080212.U7tgG:
AppleCapsule.efi AppleCapsule.efi.signature

/Library/WebServer/Documents/data/OS:
061-3561.20080212.ScoH6

/Library/WebServer/Documents/data/OS/061-3561.20080212.ScoH6:
2Z694-5274-109.dmg 2Z694-5274-109.dmg.signature

/Library/WebServer/Documents/data/SI:
061-3617.20080212.Qvh6u 061-3618.20080212.Pk8Bn

/Library/WebServer/Documents/data/SI/061-3617.20080212.Qvh6u:
FW29050_20080205_dse_hex.sihex FW29050_20080205_dse_hex.sihex.signature

/Library/WebServer/Documents/data/SI/061-3618.20080212.Pk8Bn:
hdmiutil hdmiutil.signature

[edit] Create the version.xml

In the webroot (/Library/WebServer/Documents), place a file named version.xml with the following contents:


http://www.apple.com/DTDs/PropertyList-1.0.dtd">


OS

BuildVersion
8N5400
UpdateURL
http://mesu.apple.com/data/OS/061-3561.20080212.ScoH6/2Z694-5274-109.dmg
Version
10.4.7
DownloadSize
176408698

EFI

InstallerURL
http://mesu.apple.com/data/EFI/061-3046.20080212.U7tgG/AppleCapsule.efi
UpdateURL
http://mesu.apple.com/data/EFI/009-7567.20080212.Vc45T/LOCKED_ATV11_00DA_00B.scap
Version
ATV11.88Z.00DA.B00.0601061206
DownloadSize
2198592

SI

InstallerURL
http://mesu.apple.com/data/SI/061-3618.20080212.Pk8Bn/hdmiutil
UpdateURL
http://mesu.apple.com/data/SI/061-3617.20080212.Qvh6u/FW29050_20080205_dse_hex.sihex
Version
2.9.50
AltVersion
3.0.0
DownloadSize
862796



[edit] Redirect AppleTV's Update

Edit the /etc/hosts file on the AppleTV to contain an entry for mesu.apple.com to point at the above mentioned webserver. For example, I put in the following:

10.0.1.4         mesu.apple.com

[edit] Run update on the AppleTV

At this point, it should update from the files you set up, and not from Apple. This means you can update to software which is not the newest.

Enable Remote Desktop (VNC) After 1.1 Update - AwkwardTV

Enable Remote Desktop (VNC) After 1.1 Update - AwkwardTV

Enable Remote Desktop (VNC) After 1.1 Update

From AwkwardTV

Jump to: navigation, search

Due to Apple removing the AppleVNCServer in the 1.1 update, if you want to use VNC on your AppleTV you'll need to install a third-party server, such as Redstone Software's Vine Server.

Contents

[hide]

[edit] Requirements

  • Intel Mac
  • Fugu - graphical SFTP client (or use scp if you prefer)
  • Vine Server - OS X VNC server software (Version 2.2)

[edit] Step 1

To enable Remote Desktop on your AppleTV after the 1.1 update, you'll need to download Vine Server, and run the Vine Server app from the mounted dmg. Setup Vine Server according to your needs then choose Start System Server from the Startup tab.

[edit] Step 2

Using Fugu (or scp) copy /Library/StartupItems/OSXvnc to your frontrow directory on your AppleTV. You can now stop the System Server process in the System tab of Vine Server. This removes the OSXvnc directory from your Intel Mac.

[edit] Step 3

SSH into your AppleTV, enable readwrite, and move the OSXvnc directory to /Library/StartupItems

 sudo mount -uw /
sudo mv ~/OSXvnc /Library/StartupItems/OSXvnc

[edit] Step 4

Ensure you have the proper permissions by using chmod:

sudo chmod +x /Library/StartupItems/OSXvnc/OSXvnc
sudo chmod +x /Library/StartupItems/OSXvnc/OSXvnc-server
sudo chmod +x /Library/StartupItems/OSXvnc/OSXvnc-keepalive

[edit] Step 5

Reboot your AppleTV by sending it a shutdown command.

sudo reboot

Your AppleTV will now reboot and OSXvnc will load on startup. You can now log in to your VNC server.

Enable SAMBA server - AwkwardTV

Enable SAMBA server - AwkwardTV

Enable SAMBA server

From AwkwardTV

Jump to: navigation, search

Contents

[hide]

[edit] Introduction

SAMBA is an ethernet based service wich allows to share files and printers.

This how-to bases on the AwkwardTV forum SMB in reverse.

[edit] Prerequisites

This method bases on the installation via SSH. Following this method, the extracting and editing commands will work directly on the AppleTV.

[edit] Installation

The installation bases on the MacPorts project and its Samba package. The idea is to install a SAMBA service on an Intel Mac and copy it to the AppleTV. Luckily, you won't have to do this yourself, as the result is downloadable.

  • Copy it to your AppleTV via scp or Fugu to /Users/frontrow/Documents/.
  • Extract it:
ssh frontrow@AppleTV.local
sudo -s
tar -xvjpf /Users/frontrow/Documents/samba3_macports_bin.tar.bz2 -C /

[edit] Configuration

[edit] Configuration file

The server configuration is found in /opt/local/etc/samba3/smb.conf.

Edit it:

cp /opt/local/etc/samba3/smb.conf.sample /opt/local/etc/samba3/smb.conf
nano -w /opt/local/etc/samba3/smb.conf

Editing the configuration can be a tedious process. The simplest thing to do is to modify the proper part in order to have:

[homes]
comment = Home Directories
browseable = yes
writable = yes

[edit] Password

The SAMBA passwords are different from the user login ones. Give the user frontrow a password:

/opt/local/bin/smbpasswd -a frontrow

[edit] Service

The service is now ready to be started:

/opt/local/sbin/smbd -c /opt/local/etc/samba3/smb.conf
/opt/local/sbin/nmbd -c /opt/local/etc/samba3/smb.conf

Test if from your Mac's Finder menu: Go -> Connect to Server... (Cmd-K), give the server address smb://AppleTV.local and follow the indications.

The chosen directories are mounted on /Volumes/. You can unmount them from there, either from the Finder or from the Terminal.

[edit] Automatic loading at boot

Automatically loading the Samba service 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

# start the SAMBA service
/opt/local/sbin/smbd -c /opt/local/etc/samba3/smb.conf
/opt/local/sbin/nmbd -c /opt/local/etc/samba3/smb.conf

Unmount the Samba shares, restart the AppleTV and try mounting them again.

Samba Server on ATV

AwkwardTV Community & Forums • View topic - SMB in reverse
First of all big thanks to user adn77. Both for his instructions and for the Binaries that he has sent. My thanks are well overdue!

I have finally got the Samba server running on the AppleTV, so I would like to write a little explanation of what I did to get there!
I am not a big computer person, so if I did it, probably anyone can do it!

1. I don't know if it is legal to publish the link to the binaries on this forum, but if you don't have a mac in the house (and this is probably the reason why you want the smb server in the first place!) you will need to get hold of the binaries somehow. On the other hand samba is a free package, so I don't know why it would be illegal to distribute the binaries of it!

2. Untar the binaries in the root folder of your appletv. I am not too clever so I could not untar the file on appletv, so I used winrar to unpack the file on the PC and used SSH to copy the entire /opt directory onto AppleTV - nice and easy

3. I have had the most problems editing /etc/rc.local. The file is write protected and it is not possible to change permissions using winscp.
Hence used the comand (from putty): sudo ed /etc/rc.local Using ed was a pain but I managed to add the recommended lines to the file:
/opt/local/sbin/smbd -c /opt/local/etc/samba3/smb.conf
/opt/local/sbin/nmbd -c /opt/local/etc/samba3/smb.conf

4. It is necessary to change the permissions and ownership for /opt/local/sbin/smbd and /opt/local/sbin/nmbd I used the instructions for ATVLoader to do this and used the following commands (using putty):
sudo chown root:wheel /opt/local/sbin/smbd
sudo chmod 4555 /opt/local/sbin/smbd
sudo chown root:wheel /opt/local/sbin/nmbd
sudo chmod 4555 /opt/local/sbin/nmbd

5. You will need to change the permissions for your Movies folder: /mnt/Scratch/Users/frontrow/Movies as well as Torrents, Documents, etc. You can use WinSCP to do this by right-clicking on a Movies and allowing guestes and user to change and delete files (basically tick all boxes!)


6. Copy the file /opt/local/etc/samba3/smb.conf.sample to /opt/local/etc/samba3/smb.conf and edit to your linking. Mine looks like this:

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba,
# read the Samba-HOWTO-Collection. This may be obtained from:
# http://www.samba.org/samba/docs/Samba-H ... ection.pdf
#
# Many working examples of smb.conf files can be found in the
# Samba-Guide which is generated daily and can be downloaded from:
# http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = MSHOME

# server string is the equivalent of the NT Description field
server string = AppleTV Samba Server

# Security mode. Defines in which mode Samba will operate. Possible
# values are share, user, server, domain and ads. Most people will want
# user level security. See the Samba-HOWTO-Collection for details.
security = user

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
; hosts allow = 192.168.1. 192.168.2. 127.

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = no

# you may wish to override the location of the printcap file
; printcap name = /etc/printcap

# on SystemV system setting printcap name to lpstat should allow
# you to automatically obtain a printer list from the SystemV spool
# system
; printcap name = lpstat

# It should not be necessary to specify the print system type unless
# it is non-standard. Currently supported print systems include:
# bsd, cups, sysv, plp, lprng, aix, hpux, qnx
; printing = cups

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = pcguest

# this tells Samba to use a separate log file for each machine
# that connects
; log file = /usr/local/samba/var/log.%m

# Put a capping on the size of the log files (in Kb).
max log size = 50

# Use password server option only with security = server
# The argument list may include:
# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
# password server = *
; password server =

# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
; realm = MY_REALM

# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.
; passdb backend = tdbsam

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting.
# Note: Consider carefully the location in the configuration file of
# this line. The included file is read at that point.
; include = /usr/local/samba/lib/smb.conf.%m

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
; interfaces = 192.168.12.2/24 192.168.13.2/24

# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
; local master = no

# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
; os level = 33

# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
; domain master = yes

# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
; preferred master = yes

# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
; domain logons = yes

# if you enable domain logons then you may want a per-machine or
# per user logon script
# run a specific logon batch file per workstation (machine)
; logon script = %m.bat
# run a specific logon batch file per username
; logon script = %U.bat

# Where to store roving profiles (only for Win95 and WinNT)
# %L substitutes for this servers netbios name, %U is username
# You must uncomment the [Profiles] share below
; logon path = \\%L\Profiles\%U

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
; wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one WINS Server on the network. The default is NO.
; wins proxy = yes

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The default is NO.
dns proxy = no

# These scripts are used on a domain controller or stand-alone
# machine to add or delete corresponding unix accounts
; add user script = /usr/sbin/useradd %u
; add group script = /usr/sbin/groupadd %g
; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
; delete user script = /usr/sbin/userdel %u
; delete user from group script = /usr/sbin/deluser %u %g
; delete group script = /usr/sbin/groupdel %g


#============================ Share Definitions ==============================
;[homes]
; comment = Home Directories
; browseable = yes
; writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
; comment = Network Logon Service
; path = /usr/local/samba/lib/netlogon
; guest ok = yes
; writable = no
; share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
; path = /usr/local/samba/profiles
; browseable = no
; guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
comment = All Printers
path = /usr/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = no

# This one is useful for people to share files
;[tmp]
; comment = Temporary file space
; path = /tmp
; read only = no
; public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
; comment = Public Stuff
; path = /home/samba
; public = yes
; writable = yes
; printable = no
; write list = @staff

# Other examples.
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# home directory. Note that fred must have write access to the spool directory,
# wherever it is.
;[fredsprn]
; comment = Fred's Printer
; valid users = fred
; path = /homes/fred
; printer = freds_printer
; public = no
; writable = no
; printable = yes

# A private directory, usable only by fred. Note that fred requires write
# access to the directory.
;[fredsdir]
; comment = Fred's Service
; path = /usr/somewhere/private
; valid users = fred
; public = no
; writable = yes
; printable = no

# a service which has a different directory for each machine that connects
# this allows you to tailor configurations to incoming machines. You could
# also use the %U option to tailor it by user name.
# The %m gets replaced with the machine name that is connecting.
;[pchome]
; comment = PC Directories
; path = /usr/pc/%m
; public = no
; writable = yes

# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user could of course
# be specified, in which case all files would be owned by that user instead.
[movies]
path = /mnt/Scratch/Users/frontrow/Movies
public = yes
browsable = yes
only guest = yes
writable = yes
printable = no

# The following two entries demonstrate how to share a directory so that two
# users can place files there that will be owned by the specific users. In this
# setup, the directory should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many users as required.
;[myshare]
; comment = Mary's and Fred's stuff
; path = /usr/somewhere/shared
; valid users = mary fred
; public = no
; writable = yes
; printable = no
; create mask = 0765



7. I still have a problem that AppleTV is called Localhost. No problems for Windows XP, but Vista is not happy!!!!!!!

8. It is possible to mount the remote folders (in my case it is \\Localhost\movies) as a drive: N: for example.

9. If you have installed nitoTV and all other fun stuff that comes with it, your US connected drives will be mounted into Movies folder, and you will be able to access them from your PC, hence you can use AppleTV as a NAS!!

I hope someone can edit this into a proper howto!



1.)
I may as well supply a download link for everyone, as the package should only contain open source binaries...
http://netpbx.de/tmp/samba3_macports_bin.tar.bz2
(this is 25MB in size, as I did not strip the compile down it contains openssl and cups libraries for example)

2.)
I am not sure anymore if the appleTV contained a "bunzip2", if so you can unpack the whole thing via:
Code: Select all
cd /
bunzip2 -C /samba3_macports_bin.tar.bz2| tar -xf -

Otherwise unzip it on another platform using "bunzip2" and untar it on the appleTV.
Code: Select all
cd /
tar -xf /samba3_macports_bin.tar.bz2


3.)
I like "nano" as a Texteditor (unfortunatly not readily available on the appleTV).
But you can do the following without having to mess with the awful "ed"
Code: Select all
sudo echo "/opt/local/sbin/smbd -c /opt/local/etc/samba3/smb.conf" >> /etc/rc.local
sudo echo "/opt/local/sbin/nmbd -c /opt/local/etc/samba3/smb.conf" >> /etc/rc.local


4.)
You might want to set the executable flags on some more programs in the "/opt/local/bin" folder.
If you used the un-tar on the appleTV method as decribed above, all priviledges should be already in place.

5.+6.)
I was using WinXP and set the smb.conf line "security=" to Share-Level security
Code: Select all
...
security = share
...
[yourfunnyshare]
comment = Whatever you please
path = /mnt
public = yes
writable = yes
browsable = yes

(see http://us3.samba.org/samba/docs/man/man ... onf.5.html for further information on "smb.conf")

For any real user shares one would need to setup some appleTV users and use "smbpasswd" in order to create those users for SAMBA as well.
On a Mac users are created with
Code: Select all
sudo niutil -create / /users/[username]
sudo niutil -createprop / /users/[username] uid [numerical UID]
sudo niutil -createprop / /users/[username] gid [numerical GID]
sudo mkdir /Users/[username]
sudo chown -R [username]:[groupname] /Users/[username]
sudo niutil -createprop / /users/[username] home /Users/[username]
sudo niutil -createprop / /users/[username] shell /usr/bin/false

(also see http://docs.info.apple.com/article.html?artnum=30760 for additional information)

In order to actually use these other users, it might be necessary to run Samba with root privileges (sudo)...

7.)
How did you assign the IP to the appleTV? Can you resolve other hostnames?

for NETBIOS name advertising this line in the [global] section of your smb.conf might help.
Code: Select all
netbios name = APPLETV



If the appleTV's IP is static you could also try
Code: Select all
sudo echo " appleTV<.your.domain> appleTV" >> /etc/hosts


Alex

Take 2 Full Update - AwkwardTV

Take 2 Full Update

From AwkwardTV

Jump to: navigation, search

What follows are step by step instructions for upgrading your Apple TV to the 2.0 (Take 2) software, and then loading back on all the "extras". First thing to do is grab all the required files and put them in a folder called AppleTVUpdate which is located on your desktop.

Contents

[hide]

[edit] Required Hardware

  • Apple TV running the Take2 update firmware version 1, since version 1.1 doesn't have AFP and VNC support.
  • Intel Mac - there are ways to do this on PC's and PPC Macs, but they are not covered here.
  • USB "thumb drive" of at least 128 MB. Some users have reported problems with drives with more than 2 GB.

[edit] Required Files

- ATVFiles-1.0.take2a2.run
- turbo_kext_enabler.bin


From Perian:
- AC3MovieImport.component - provides ac3 sound for perian (bundled in perian install)
- A52Codec.component - (bundled in perian install)
- Perian.component - provides divx, xvid, flv,mkv, srt support


From Flip4Mac:
- Flip4Mac WMV Import.component - provides windows media support
Note: The above files (with exception of the .DMG) can be found under /Library/Audio/Plug-Ins/Components and /Library/QuickTime, if you have Perian (and Flip4Mac) installed on your Intel Mac.


From MacOS X 10.4.9 Combo Updater (Download and mount, open the pkg with Pacifist):
- IOUSBMassStorageClass.kext
- IOSCSIArchitectureModelFamily.kext
- IOStorageFamily.kext
- msdosfs.kext
- ntfs.kext
- smbfs.kext
- udf.kext
Note: The above files can be found inside /System/Library/Extensions inside the package mentioned above using Pacifist.
- mount_smbfs
Note: The above files can be found inside /sbin inside the package mentioned above using Pacifist.

[edit] Steps

NOTE: All commands are to be run one at a time, do not try pasting everything in and running all at once

[edit] 1) Install Apple TV Take 2 update from your Apple TV

[edit] 2) Install SSH

Either use a Patchstick (see Take2patch) or install by physically removing the AppleTV's hard drive from the AppleTV, mounting the drive on another computer, and copying over the appropriate files (see Install SSH, including Install SSH / Notes for Take 2).

[edit] 3) Install ATVFiles


a) on Mac:

scp -1 -r ~/Desktop/AppleTVUpdate/ATVFiles-1.0.take2b1.run frontrow@AppleTV.local:~


b) on AppleTV

sudo sh ~/ATVFiles-1.0.take2b1.run
[edit] Alternate 3 to 8

a) Copy MacOS X 10.4.9 Combo Updater to ~/Documents folder on AppleTV

b) Install nitoTV http://forum.awkwardtv.org/viewtopic.php?f=6&t=1262

c) Once on the menu, install (from the nitoTV installer menu)

c1) Perian, say NO when asked to use Perian h.264 instead of Quicktime's

c2) mplayer codecs

c3) Turbo's Kextloader

c4) Smart Installer (not the updater)

d) jump to step 9

  • Note: added c3 and moved Smart Installer to c4! otherwise the Smart Installer will throw errors at the end, and the kextloader is needed for the USB patch anyway.

[edit] 4 Install Perian and other Quicktime Components


a) on Mac:

scp -1 -r ~/Desktop/AppleTVUpdate/AC3MovieImport.component frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/Flip4Mac\ WMV\ Import.component frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/Perian.component frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/A52Codec.component frontrow@AppleTV.local:~


b) on AppleTV

sudo mount -uw /
sudo mv ~/AC3MovieImport.component /Library/Quicktime/
sudo mv ~/Flip4Mac\ WMV\ Import.component /Library/Quicktime/
sudo mv ~/Perian.component /Library/Quicktime/
sudo mv ~/A52Codec.component /Library/Audio/Plug-Ins/Components/

[edit] 5) Install AFP

Both the processes listed below presume a 1.0 recovery partition on the AppleTV, and have been tailed towards that. Many of the files can likely be gotten from the 10.4.9 combo updater, but probably not all. A full install of 10.4.9 on an Intel Mac would also do nicely, but both the script and the manual process would need to be tweaked in order to properly get and place the files.
a) Automatic Process:
On Mac:
Download the script.

 scp -1 -r ~/Desktop/AppleTVUpdate/afpinstall.sh frontrow@AppleTV.local:~


On AppleTV:

sudo sh afpinstall.sh


b) Manual Process: Because the sed command wasn't working, we'll just create out own hostconfig file.
On Mac:
Create a text file with the following contents:

AFPSERVER=-YES-
AUTHSERVER=-NO-
AUTOMOUNT=-YES-
CUPS=-AUTOMATIC-
NFSLOCKS=-AUTOMATIC-
NISDOMAIN=-NO-
TIMESYNC=-YES-
QTSSERVER=-NO-
WEBSERVER=-NO-
SMBSERVER=-NO-
SNMPSERVER=-NO-
SPOTLIGHT=-YES-


Name it "hostconfig" (no quotes, no extension) and place it in your AppleTVUpdate folder on your desktop.

scp -1 -r ~/Desktop/AppleTVUpdate/hostconfig frontrow@AppleTV.local:~

On AppleTV:

sudo mount -uw /
sudo touch /.readwrite
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
hdiutil mount recovery.dmg
hdiutil mount /Volumes/Recovery/OS.dmg
sudo cp -pRvn /Volumes/OSBoot\ 1/* /
echo -ne 'Installing the Filesystem Extensions...\n'
sudo ln -s /System/Library/Filesystems/AppleShare/afpfs.kext /System/Library/Filesystems/afpfs.fs
echo -ne 'Installing into /usr/sbin...\n'
sudo ln -s /System/Library/CoreServices/AppleFileServer.app/Contents/MacOS/AppleFileServer /usr/sbin/AppleFileServer
echo -ne 'Updating /etc/hostconfig to start AFP at boot...\n'
echo -en 'AFPSERVER=-YES-\nAUTHSERVER=-NO-\nAUTOMOUNT=-YES-\nCUPS=-AUTOMATIC-\nNFSLOCKS=-AUTOMATIC-\nNISDOMAIN=-NO-\nTIMESYNC=-YES-\nQTSSERVER=-NO-\nWEBSERVER=-NO-\nSMBSERVER=-NO-\nSNMPSERVER=-NO-\nSPOTLIGHT=-YES-'
sudo mv hostconfig /etc/hostconfig
sudo chown root:wheel /etc/hostconfig
echo -ne 'Done!\n'

For Apple TV OTB 1.1 or later: If you have a recovery partition of 1.1 or later, look for OS.dmg from 1.0 and copy it into the same folder as afpinstall.sh and comment out these:

sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
sudo hdiutil mount recovery.dmg

Make sure the path to OS.dmg is correct, then run sudo sh afpinstall.sh

--Yargok 18:49, 5 March 2008 (CET) Does anyone have a similar procedure for those who have a recovery partition of 1.1?
--pheno 14:20, 12 March 2008 (CET) Please note if you will use the command "sudo cp -pRvn /Volumes/OSBoot\ 1/* /" to run aftwards "/usr/sbin/diskutil repairPermissions"

[edit] 6) Reboot AppleTV


a) on AppleTV:

sudo reboot

[edit] 7) Install USB


a) on Mac:
Download Take 2 DMG and mount it.
Download the kernel patcher, and extract the three files into a folder (this currently requires an Intel Mac).
Copy the file mach_kernel.prelink from the mounted image (it is in the root directory) and place it in the same folder as the kernel patcher files you just extracted.
Open up terminal and do the following:

cd (to the directory you have the kernel patching files)
./do_usb_patch.sh


--Bloo 08:49, 9 March 2008 (CET) Running ./prelink_tool -d mach_kernel.prelink mach_kernel_patched.bin fails with: Bus error.. thoughts?
--blues 08:46, 16 March 2008 (CET) Problem occurs because of binary incompatibility with the tools. One solution is to recompile source on your system.

2.0.1 Note: the offsets have changed in the 2.0.1 prelink, thanks to some notes from jphelp32 on the forum the following will be sufficient changes to the do_usb_patch.sh script

#
# ==== patch the decompressed kernel
#
echo ======== patch kernel =========
./poke mach_kernel_patched.bin 0x52055e 0x75:0x75 0x34:0x30
if [ $? -ne 0 ]; then exit 1; fi
./poke mach_kernel_patched.bin 0x52123E 0x75:0x75 0x34:0x30
if [ $? -ne 0 ]; then exit 1; fi
./poke mach_kernel_patched.bin 0x520576 0x75:0x75 0x1c:0x18
if [ $? -ne 0 ]; then exit 1; fi
./poke mach_kernel_patched.bin 0x521256 0x75:0x75 0x1c:0x18
if [ $? -ne 0 ]; then exit 1; fi

The 2.0.1 patch is tested and works! --Nito 12:28, 1 April 2008 (CEST)


Once the kernel is patched, rename it to mach_kernel.prelink and place it in your AppleTVUpdate folder on your desktop

scp -1 -r ~/Desktop/AppleTVUpdate/mach_kernel.prelink frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/turbo_kext_enabler.bin frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/IOUSBMassStorageClass.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/smbfs.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/udf.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/msdosfs.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/ntfs.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/IOStorageFamily.kext frontrow@AppleTV.local:~
scp -1 -r ~/Desktop/AppleTVUpdate/IOSCSIArchitectureModelFamily.kext frontrow@AppleTV.local:~


b) on AppleTV:

sudo mv /mach_kernel.prelink /mach_kernel.prelink.bak
sudo mv ~/mach_kernel.prelink /mach_kernel.prelink
sudo mv ~/turbo_kext_enabler.bin /sbin/
sudo mv ~/IOUSBMassStorageClass.kext /System/Library/Extensions/
sudo mv ~/smbfs.kext /System/Library/Extensions/
sudo mv ~/udf.kext /System/Library/Extensions/
sudo mv ~/msdosfs.kext /System/Library/Extensions/
sudo mv ~/ntfs.kext /System/Library/Extensions/
sudo mv ~/IOStorageFamily.kext /System/Library/Extensions/
sudo mv ~/IOSCSIArchitectureModelFamily.kext /System/Library/Extensions/
sudo chown -R root:wheel /System/Library/Extensions/*.kext
sudo chmod -R 755 /System/Library/Extensions/*.kext
sudo chmod 755 /sbin/turbo_kext_enabler.bin
sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

[edit] 8) Install mount_smbfs


a) on Mac:

scp -1 -r ~/Desktop/AppleTVUpdate/mount_smbfs frontrow@AppleTV.local:~


b) on AppleTV:

sudo mv ~/mount_smbfs /sbin/
sudo chown root:wheel /sbin/mount_smbfs
sudo chmod +s /sbin/mount_smbfs

[edit] 9) Create rc.local


a) on Mac:
Create a text file with the following contents:

# rc.local
# enable USB
/sbin/turbo_kext_enabler.bin
/sbin/kextload -v /System/Library/Extensions/IOUSBMassStorageClass.kext
/sbin/kextload -v /System/Library/Extensions/smbfs.kext
/sbin/kextload -v /System/Library/Extensions/udf.kext
/sbin/kextload -v /System/Library/Extensions/msdosfs.kext
/sbin/kextload -v /System/Library/Extensions/ntfs.kext
# enable cron
/usr/sbin/cron


Name it "rc.local" (no quotes) and place it in your AppleTVUpdate folder on your desktop.

scp -1 -r ~/Desktop/AppleTVUpdate/rc.local frontrow@AppleTV.local:~
scp -1 /usr/bin/crontab frontrow@AppleTV.local:~
scp -1 /usr/bin/nano frontrow@AppleTV.local:~
scp -1 /usr/sbin/cron frontrow@AppleTV.local:~


b) on AppleTV:

sudo mv ~/rc.local /etc/
sudo chown root:wheel /etc/rc.local
sudo mv ~/crontab /usr/bin
sudo mv ~/nano /usr/bin
sudo mv ~/cron /usr/sbin
sudo chown root:wheel /usr/bin/crontab
sudo chown root:wheel /usr/bin/nano
sudo chown root:wheel /usr/sbin/cron
sudo chmod 4555 /usr/bin/crontab
sudo chmod 555 /usr/bin/nano
sudo chmod 555 /usr/sbin/cron

[edit] 10) Enable VNC


a) on AppleTV:

echo 71463E00FFDAAA95FF1C39567390ADCA > /Library/Preferences/com.apple.VNCSettings.txt
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-configure -clientopts -setvnclegacy -vnclegacy yes
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-activate -configure -access -on -users frontrow -privs -all -restart -agent -menu

--PatentBoy 01:15, 28 March 2008 (CET) Where can I grab the ARDAgent.app? From Tiger or Leopard install, for example?
--Kheops 18:22, 28 March 2008 (GMT+7) You can copy the RemoteManagement folder from the recovery.dmg:

sudo mount -uw /
sudo touch /.readwrite
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
sudo hdiutil mount recovery.dmg
sudo hdiutil mount /Volumes/Recovery/OS.dmg
sudo cp -pr /Volumes/OSBoot\ 1/System/Library/CoreServices/RemoteManagement/ /System/Library/CoreServices/
sudo cp -pr /Volumes/OSBoot\ 1/System/Library/Perl/ /System/Library/Perl/
sudo cp -pr /System/Library/Perl/Extras/5.8.6/ /System/Library/Perl/5.8.6/

Then you will be able to run the 'kickstart' commands above, but still I didn't succeed to connect (the ARDAgent is running, but I have "connection refused(16001)" from my VNC client

[edit] 11) Disable Updates

To prevent future updates from breaking your custom Apple TV don't forget to add the Apple update site to your hosts file as a loop back:
a) on AppleTV:

sudo bash -c 'echo "127.0.0.1       mesu.apple.com" >> /etc/hosts'

[edit] 12) Reboot the AppleTV


a) on AppleTV:

sudo reboot

[edit] Watchdog

--Elchubi 06:22, 22 March 2008 (CET) Might be missing something (However, I'd done several Take 1 AppleTVs in the past) but I have been unsuccessfully disabling watchdog... Would some some confirm old method is working? Mine keeps rebooting so I have to enable it and Finder keeps restarting when running other app (as MythTV or Miro for example) instead of Finder. Thanks in advance

[edit] Aftermath

At this point your AppleTV should come back up with full 1080i/1080p support, AirTunes working, HD Rentals working, AFP running, USB working (and the drive should automount), ATVFiles should be running, and ssh should be working.