Tuesday, April 29, 2008

Enable NFS Server - AwkwardTV

Enable NFS Server - AwkwardTV

Enable NFS Server

From AwkwardTV

Jump to: navigation, search

[edit] AppleTV 1.0 software (Or Safe Update 1.1)

  • First we have to setup up the export: To do this we use the nicl command. (the netinfo command line utility) Since netinfo uses the / to separate path components, and we have / characters in the entry we want to create, those / have to be escaped. This is done with the backslash, \, and since we are running in a shell, we need to double them up. After the shell is done examining the command, the string \\/ becomes \/ which is what we need to pass to nicl.
sudo nicl . -create /exports/\\/mnt\\/Scratch\\/Users\\/frontrow

This will create an export for the frontrow users directory. We need to use the /mnt/Scratch/Users/frontrow path instead of /Users/frontrow because /Users/frontrow is actually a link which NFS doesn't like.

  • We can list all of the current exports on your appletv with:
sudo niutil -list . /exports

In our example that should result in something like:

89       /mnt/Scratch/Users/frontrow
  • If we wanted to delete this export we would do this (example):
sudo nicl . -delete /exports/\\/mnt\\/Scratch\\/Users\\/frontrow
  • Once we have our exports set up to our liking we need to start the mountd daemon and the NFS daemon. We would also have to start portmap, but it is already running on the appletv.
sudo /usr/sbin/mountd
sudo /sbin/nfsd -t -u -n 6

These commands start the mount daemon as well as the nfs daemon. The command arguments to nfsd just mean, enable TCP, enable UDP, and start with 6 threads. If you want the nfsd to start automatically, you can add the two commands above to your /etc/rc.local file.


  • If you make changes to your exports you don't need to restart the nfs server. You simply need to notify the mountd daemon to check for changes. You can do this by sending the "1" signal to the running mountd with this command:
sudo kill -1 `cat /var/run/mountd.pid`
  • If you want to check what exports are available on your appletv you can use the showmount command (from your Mac OS X box or Linux)
showmount -e appletv

Where appletv is the name of your Apple TV on your network.

To connect to the Apple TV NFS share from Linux you would type (from Linux):

mkdir /mnt/frontrow
mount -t nfs appletv:/mnt/Scratch/Users/frontrow/ /mnt/frontrow

[edit] AppleTV 1.1 software

  • I have not tested this.

Monday, April 28, 2008

LarsBlog - Archives for: September 2007

LarsBlog - Archives for: September 2007

Installing Fink to access open-source apps on an AppleTV

Filed under: AppleTV — lars @ 04:23:11

I was recently able to enable ssh on my new AppleTV. One of the first things I wanted to do was to be able to play with it as a unix box and set up some standard open-source software on it. It seems there are a couple of package managers for opensource software on OS-X: Fink and MacPorts. However, as a non-Mac person, it took me some time to figure out how to install these on the cut-down unix environment provided by the AppleTV, and I had better luck setting up Fink. Below are the steps I used.

Note, this does not cover the installation of dev-tools so will only allow the install of fink's binary packages (Will hopefully write that process up later).

Pre-requisites:

  • Darwin x86 8.01 ISO (I used darwinx86-801.iso)
  • Fink intel installer (I used Fink-0.8.1-Intel-Installer.dmg)
  • An ssh-enabled AppleTv
  • OS-X /usr/bin/manpath command (optional)

The process:

  1. Mount the Darwin ISO so you can access it's files (on windows, use something like DaemonTools). We're going to need some files from it later (commands that are missing on the AppleTV).

  2. Use a program like WinSCP or FileZilla to connect to your AppleTV (username/password is frontrow/frontrow). First of all, it will help to have some basic unix-commands available that are missing on the AppleTV by default, such as 'vi' (text-editor), 'curl' (downloader, like wget) and while you're at it, 'top' (system monitor - not needed by fink but very handy all the same). These can be copied from the /usr/bin directory of the Darwin ISO, and for now just drop them in the your default/home directory (should be /Users/frontrow).

  3. Create a directory called "Install_Fink" in your default/home directory on your AppleTV. Transfer the file Fink-0.8.1-Intel-Installer.dmg to this directory (You can use scp or FileZilla to do this)

  4. Connect to your AppleTV using SSH (again, as frontrow/frontrow). You should start out in the frontrow user's home directory (and you can always get back there using the command: cd ~). Then change into the Install_Fink directory:
    cd Install_Fink/
  5. Now we're going to mount the .dmg file we copied in here earlier so that we can access the files inside:
    hdiutil mount Fink-0.8.1-Intel-Installer.dmg
  6. Now we're going to copy the files out of this .dmg and into a new directory under Install_Fink (as I had trouble running the installer directly from the mounted .dmg)
    mkdir Fink-0.8.1-Intel-Installer
    cd Fink-0.8.1-Intel-Installer
    sudo cp -R /Volumes/Fink-0.8.1-Intel-Installer/ .
  7. Now we're finished with the .dmg file's contents, we can detach it from the filesystem:
    hdiutil detach /Volumes/Fink-0.8.1-Intel-Installer/
  8. Now we're ready to install Fink. We first have to remount the root file-system as writable (as this is read-only by default on the AppleTV):
    sudo mount -o remount,rw /dev/disk0s3 /
  9. Before we kick-off the fink install, let's take this opportunity to drop the extra unix commands (vi, curl and top) into the correct place to be executed. We need to set their permissions to be executable too:

    sudo cp vi /usr/bin
    sudo chmod +x /usr/bin/vi
    sudo cp curl /usr/bin
    sudo chmod +x /usr/bin/curl
    sudo cp top /usr/bin
    sudo chmod +x /usr/bin/top
  10. Now, finally, we run the installer we copied from inside the .dmg file, using a command called 'installer'

    sudo installer -dumplog -pkg Fink\ 0.8.1-Intel\ Installer.pkg -target "/"

    You should have about 20-30 lines of output, with a line near the end saying the install was successful.

  11. Now there's one last step we need to perform before Fink is ready to use. Fink requires some environment variables to be set up before it will work properly. To do this, it provides a path-setup script that adds a line (that calls an init script) to your .profile file in your home directory. Unfortunately, Fink's automatic setup script seems to rely on a bunch of OS-X commands (printenv, basename, osascript, manpath in /usr/bin, possibly more) that appear to be missing from the OS on the AppleTV. So I took a look at the instructions on setting up this path manually: http://www.finkproject.org/doc/users-guide/install.php#setup

  12. First we need to ensure that we have everything on our Apple-TV required to run Fink's init.sh script. We can do this by attempting to run it from the command-line:
    . /sw/bin/init.sh

    If you get no errors, then things are looking good. (Note: You may get an error about the 'manpath' command being missing. This doesn't *appear* to cause major issues. I had trouble using the manpath command from Darwin, but apparently the OS-X one will work).

  13. Next, use the following commands to edit your .profile file.

    cd ~
    vi .profile

    And add this line to the file:

    . /sw/bin/init.sh

    (In vi, you use i to go into 'insert' mode (so you can type), and wq to save and exit.)

    This will ensure that the required environment variables are created whenever you login with ssh.

  14. Now we can follow Fink's setup instructions here: http://www.finkproject.org/download/index.php?phpLang=en - by running:
    fink scanpackages; fink index
    sudo apt-get update
    sudo apt-get install fink
    This will ensure that Fink and it's list of packages is up-to-date.

  15. To test that it's working ok, you might want to try installing a couple of simple packages. First, I installed links - a lynx-like text based web browser:
    fink install links
    And then I installed wget, a command for downloading files from http or ftp servers (a bit like OS-X's curl):
    fink install wget
    And all seemed to work well! I can't guarantee that every Fink package is going to install properly using the above steps, but it seems like a good start.

You might want to check out the following links to continue from here:

Using Fink: http://www.finkproject.org/doc/bundled/usage.php
Fink Usage FAQ's: http://finkproject.org/faq/usage-fink.php

In a later post, I'll hopefully manage to install Apple's DevTools so that we can try some unstable packages and also building from source.

Good luck!

Thursday, April 10, 2008

gcc - High Performance Computing for Mac OS X

High Performance Computing for Mac OS X

Computation Tools :: Fortran

GCC 4.3 (auto-vectorizing gcc with openmp) :

Compiled using source code from the GNU CVS servers. This contains current versions of gfortran (GNU F95, this is a version of the much awaited, free, open source, F95 compiler), gcc (GNU C) and g++ (GNU C++) compilers that can perform auto-vectorization (i.e. modify code to take advantage of AltiVec/SSE, automatically). Use flag -O3 -ftree-vectorize to enable that option. For more information, see this webpage. Download my binaries, and cd to the download folder. Then gunzip gcc-bin.tar.gz (if your browser didn't do so already) and sudo tar -xvf gcc-bin.tar -C /. It installs everything in /usr/local. You invoke F95 by typing gfortran. You will also need to have Apple's Developer Tools installed. They are included on a separate CD in the retail version of OS X and also available as a free download from Apple's Developer Site. Please install the most current version of Developer Tools, version 2.4.1. Finally, note that there is an alternate g95 project, that is not part of GCC. They seem to have recently released their own official version of g95 for OS X which you may wish to try. Again, note that that g95 is not the same as this version here. Some reports suggest that this alternate g95 is ahead in the implementation of F95 features, but there are mixed reports regarding its optimization capabilities.

Binaries:

gcc-ppc-leopard-bin.tar.gz (PowerPC), gfortran-ppc-leopard-bin.tar.gz (PowerPC gfortran only), gcc-intel-leopard-bin.tar.gz (Intel Mac), gfortran-intel-leopard-bin.tar.gz (Intel Mac gfortran only), updated January 2008 (Leopard only).

gcc-bin.tar.gz (PowerPC), gfortran-bin.tar.gz (PowerPC gfortran only), gcc-intel-bin.tar.gz (Intel Mac only), gfortran-intel-bin.tar.gz (Intel Mac gfortran only), updated January 2008 (Tiger).


Documentation: click here!

ImageMagick: Install from Binary Distribution

ImageMagick: Install from Binary Distribution

Mac OS X Binary Release

We provide a Mac OS X binary distribution, however, if you already have MacPorts installed on your system, simply type:

  sudo port install ImageMagick

The port command downloads ImageMagick and many of its delegate libraries (e.g. JPEG, PNG, Freetype, etc.) and configures, builds, and installs ImageMagick automagically. Alternatively, download the ImageMagick Mac OS X distribution we provide:

Version HTTP FTP Description
ImageMagick-universal-apple-darwin8.11.0.tar.gz download download Mac OS X Tiger 10.4
ImageMagick-universal-apple-darwin9.2.2.tar.gz download download Mac OS X Leopard 10.5

Create (or choose) a directory to install the package into and change to that directory, for example:

  cd $HOME

Next, extract the contents of the package. For example:

  tar xvfz ImageMagick-universal-apple-darwin9.2.2.tar.gz

Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

  export MAGICK_HOME="$HOME/ImageMagick-6.4.0"

If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

  export PATH="$MAGICK_HOME/bin:$PATH"

Set the DYLD_LIBRARY_PATH environment variable:

  export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

Finally, to verify ImageMagick is working properly, type the following on the command line:

  convert logo: logo.gif
identify logo.gif
display logo.gif

Note, the display program requires the X11 server available on your Mac OS X installation DVD.

Congratulations, you have a working ImageMagick distribution under Mac OS X and you are ready to use ImageMagick to convert, compose, or edit your images or perhaps you'll want to use one of the Application Program Interfaces for C, C++, Perl, and others.

Saturday, April 5, 2008

Netpbm home page

Netpbm home page
The Gallery project distributes a few Netpbm programs pre-built for various platforms. The purpose of this package is use with Gallery, but it is just ordinary Netpbm (usually rather old). It contains:
  • jpegtopnm
  • pngtopnm
  • pnmfile
  • pnmrotate
  • pnmscale
  • ppmtojpeg
  • ppmquant
  • ppmtogif
  • pnmtopng
  • giftopnm
  • pnmcut
  • pnmflip

This is the Gallery binary micro distribution of the NetPBM graphics package.
Both of these products are released under the Gnu Public License and source
code for each can be found at:

Gallery home page: http://gallery.sourceforge.net
NetPBM home page: http://netpbm.sourceforge.net

INSTALLING
----------

1. Unpack the tar/zip package into any directory.

2. Make sure the binaries are executable:
% cd netpbm
% chmod 755 *

XAMMP - Apache/MySQL/PHP5/Perl - AwkwardTV

XAMMP - Apache/MySQL/PHP5/Perl - AwkwardTV

XAMMP - Apache/MySQL/PHP5/Perl

From AwkwardTV

Jump to: navigation, search

XAMPP is a simple, most practical and most complete webserver solution. The XAMPP for OS X distribution provides an Apache 2 web server, integrated with the latest builds of MySQL, PHP (both 4 and 5) and Perl. It requires no dependencies.

If you are an experienced web developer or a Mac enthusiast who needs to run a webserver, create dynamic webpages or use databases, this is your lucky day!

Contents

[hide]

[edit] Note

The XAMPP package gets installed in /Applications which is in the partition /dev/disk3 (named OSBoot) and requires it to be mounted with write permissions.

In contrast, the /Users folder is linked to /mnt/Scratch/Users and as such is in the partition /dev/disk4 (named Media) which is mounted on /mnt/. This allows the system to be located on a read-only partition and as such to be more immune to unproper power off.

Anyway: once you've installed SSH on the AppleTV, you've decided to make a server out of it and you're going to treat it the right way.

[edit] Prerequisites

[edit] XAMPP package

The XAMPP package can be downloaded from their website. Choose the tar version.

[edit] Unzip binaries

Unzip binaries will be used on your AppleTV to extract the XAMPP package, but aren't found on the AppleTV base installation.

  • Download the binary Darwin for Intel distribution from the Opensource pages.
    This contains many useful files.
  • Untar the file (Double click in Mac OS X)
  • Mount the disk image (Double click in Mac OS X)
  • In the Terminal:
scp /Volumes/Darwin8_i386/usr/bin/zip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/unzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/gzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/gunzip frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/bzip2 frontrow@AppleTV.local:/Users/frontrow/Documents
scp /Volumes/Darwin8_i386/usr/bin/bunzip2 frontrow@AppleTV.local:/Users/frontrow/Documents
ssh frontrow@AppleTV.local
sudo -s
mount -uw /
mv /Users/frontrow/Documents/* /usr/bin/
chown root:wheel /usr/bin/*

You might want do install further binaries...

[edit] Installing XAMPP on the Apple TV

To Install the XAMPP package on the Apple TV follow this steps :

[edit] On your Mac

  • Copy the .tar.gz file to your Apple TV (the way you prefer, AFP, SCP, etc...).
    Fugu provides a graphical interface for this purpose.
  • Open a SSH connection to your Apple TV.

[edit] On the AppleTV

  • Navigate to the download folder.
  • Get the required privileges:
sudo -s
mount -uw /
  • Extract the downloaded file:
tar -xvzpf xampp-macosx-0.7.2.tar.gz -C /
  • Start your XAMPP:
/Applications/xampp/xamppfiles/mampp start

You should see the following:

Starting XAMPP for MacOS X 0.7.2...
XAMPP: File permissions are being checked... this may take a while.
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for MacOS X started.
  • Try your installation by surfing to http://AppleTV.local and choose a language.
    Tip - If you get PHP errors, it's because you didn't extract it with the 'p' parameters. Re-extract it with the exact command.
  • Assuming it's working, it's time to secure your XAMPP installation.
/Applications/xampp/xamppfiles/mampp security

Tip - If you give an SQL root password, the demos won't work any more.

[edit] Configuring Apache

Find the Apache configuration file:

find /Applications/xampp/ -iname httpd.conf

Mine is /Applications/xampp/etc/httpd.conf

Find the location of the web pages:

cat /Applications/xampp/etc/httpd.conf | grep ^ServerRoot

Mine is /Applications/xampp/xamppfiles/htdocs/

You can modify the location of the web pages in httpd.conf and put your files at the proper location.

[edit] Enabling at boot time

[edit] Enabling the Apple way

Apple provides a page on how to create a Startup Item.

[edit] Enabling using the AppleTV base installation

The AppleTV already ships with an Apache startup file: /System/Library/StartupItems/Apache/Apache which will need some modifications.

If not done already, get the required privileges:

sudo -s
mount -uw /

Optional: set new host name

scutil --set ComputerName NewName
scutil --set LocalHostName NewName

Make your root partition to be mounted read/write at startup:

touch /.readwrite

Edit the file /System/Library/StartupItems/Apache/Apache and replace apachectl with /Applications/xampp/xamppfiles/mampp

Edit the file /etc/hostconfig and replace WEBSERVER=-NO- with WEBSERVER=-YES-

Test it:

reboot

and surf to http://AppleTV.local

[edit] Enabling with the help of AFP

Assuming you have enabled AFP (AppleShare) to start at boot, you can add the line:

/Applications/xampp/xamppfiles/mampp start

to the file /System/Library/StartupItems/AppleShare/AppleShare after the If statement in the StartService function, and then XAMPP will startup at boot time.

Adding XAMPP to the AppleShare startup item is not recommended.

Installing Sapphire Manually Sapphire Browser

Installing Sapphire Manually Sapphire Browser

Installing Sapphire Manually

These instructions are intended to be used to install Sapphire Manually on your AppleTV. You will probably only need to do this if Sapphire is unavailable through the ATVLoader (it takes a little while for new versions to get approved by AwkwardTV to be listed).

-WARNING- READ THIS TUTORAIL FIRST. If you are not confident in what you are going to be doing PLEASE DON’T PREFORM THIS TYPE OF INSTALLATION and wait for the ATVLoader to be updated.

1. We need the IP address for the AppleTV - to find it go to the AppleTV’s Menu and select Settings -> Network. For these instructions we will assume the IP Address is 192.168.100.100.

2. We need to make sure SSH is enabled. To turn it on, go to the Awkward TV plugin and select the SSH Service button. The button will say “SSH Service Enabled” when it’s turned on.

3. Now we need to SSH into the AppleTV. Using the terminal* type: “ssh -1 frontrow@192.168.100.100″. Remember to use your AppleTV’s IP Address.

4. The password is “frontrow”

5. Now we need to make sure we can write to the OSBoot volume. Using the terminal* type: “sudo mount -uw /”. Again, the password is “frontrow”.

6. Now our AppleTV is ready for an install. If you already have a version of Sapphire Installed we need to remove it. Using the terminal* type: “sudo rm -r /System/Library/CoreServices/Finder.app/Contents/PlugIns/Sapphire.frappliance”.

7. Now we need to get the new version on the AppleTV. From your computer, copy the Sapphire.frappliance folder on to your AppleTV’s frontrow partition.

8. Now we need to move the Sapphire.frappliance folder from the frontrow partition to the OSBoot partition. Using the termianl* type: “sudo mv ~/Sapphire.frappliance /System/Library/CoreServices/Finder.app/Contents/PlugIns/”

9. Almost done! we just need to reload the AppleTV’s UI. Using the terminal* type: “sudo reboot”.

10. Wait for the AppleTV to reboot.

* To open a terminal window type “Terminal” into spotlight - it will be the top hit.

Exif Jpeg header manipulation tool

Exif Jpeg header manipulation tool

Pre-built OS-X Intel executable jhead (61 k)
Pre-built OS-X PPC executable jhead (67 k)

The program also has a lot of other command line options for manipulating Exif files, such as options to manipulate the date in the header, renaming image files, or coordinating running Jpegtran and Mogrify to manipulate whole directory trees of images.

Here's the program files. Just right click and save as. The source archives should end in .tar.gz (as in jhead-2.7.tar.gz). Windows browsers have the annoying habit of renaming files on saving, so you may have to rename the file back to what is shown for programs to recognize them properly. You can use WinZip to open .tar.gz files.

For novice Linux/Unix/OS-X users: Don't forget to set the executable bit after downloading the pre-built executables. Type "chmod +x jhead" at a shell window after downloading it to do this. You don't have to do this if you use one of the RPM packages.

I don't at this point have an OS-X machine to build the binary on, nor do I have a RedHat system to build the RPM for that anymore. Until somebody builds it for me for those platforms, just use the previous release - it works just fine.

Thursday, April 3, 2008

NitoTV - AwkwardTV

NitoTV - AwkwardTV

Install Howto

To install it, you will need to copy the NitoTV folder from nitoTVInstaller.zip into your AppleTV. You can copy it to the home folder of the 'frontrow' user if you wish, although its location doesn't really matter.

Next, you need to open an SSH connection to your AppleTV, like so:

ssh -1 frontrow@AppleTV.local

When prompted for a password, enter 'frontrow'.

Now go to the directory where you placed this folder on your AppleTV and type the following command:

chmod 755 installme
sudo ./installme

When prompted for a password, enter 'frontrow' again

To fix permission
sudo mount -uw /
cd /System/Library/CoreServices/Finder.app/Contents/PlugIns/nitoTV.frappliance/Contents/Resources/
sudo chmod 755 nitoHelper
sudo chmod u+s nitoHelper

To enable USB drive

cp -R mach_kernel.prelink /




Wednesday, April 2, 2008

The Unix Command Line: Administration

The Unix Command Line: Administration

Reference


OS X's BSD/unix command-line

System Administration Commands

By Gordon Davisson

Copyright (c) 2003, Westwind Computing inc.

Index:


Administration Commands:

ps - List the processes running on the system

Examples:
ps
List processes belonging to the current user that are attached to a terminal (not very useful under OS X)
ps -x
List processes belonging to the current user whether or not they're attached to a terminal
ps -ax
List all running processes
ps -aux
List all running processes, with additional information about their resource useage

top - List the top CPU-consuming processes running on the system, along with various other system load statistics. Note: it runs continuously, updating the stats repeatedly, until you quit it with "q".

Examples:
top
Display a list of processes, highest-process-id (i.e. most recent) first, updating once a second
top -us5
Display processes sorted by CPU useage, updating every 5 seconds

kill - Kill (or send other signals to) a process

Examples:
kill 220
Terminate process #220
kill -9 220
Terminate process #220 with extreme prejudice
kill -HUP 220
Send process #220 a hangup signal - by convention, background processes (daemons) treat this as a cue to restart, and reload their configuration information.

su - Set user. Allows you to temporarily become another user (root is the default). It'll ask for that user's password. Use the "exit" command to go back to normal.

Note:
  • You must be a member of the "wheel" group to su to root; under OS X 10.2, nobody is a member of "wheel" so this is effectively forbidden. Use sudo instead.

sudo - Set user and do. Execute a single command as another user (root is the default). It will ask for your password. Access is controlled by a configuration file and can be made quite complex (see the man page). By default, any administrator use sudo to perform any command as any user.

Examples:
sudo rm /private/var/db/.AppleSetupDone
Become root just long enough to delete one file.
sudo -u george ls ~george/Documents
Become george and list the files in his Documents directory.
sudo -s
Start a root shell (similar to su, except that it asks for your password, rather than the root password, and doesn't requires admin access, not wheel membership).

lsbom - List the contents of an installer's bom (bill of materials) file. This can be used to find out what files an installer will add/replace in your system before running it. It can also be used to find out what files a past install messed with.

Examples:
lsbom /Volumes/Developer\ Tools/Packages/DevTools.pkg/Contents/Resources/DevTools.bom >contents.txt
List the files that will be installed by the "DevTools" package, saving the list in a file named contents.txt.
lsbom /Library/Receipts/Essentials.pkg/Contents/Resources/Essentials.bom | more
List the files that were installed by the "Essentials" package (and pipe it through more to prevent overload).

lsof - List open files on the system. Normally, it only lists files you (or processes you own) have open; if run as root, it lists all open files.

Examples:
lsof
List all files currently open by me and my processes.
sudo lsof
List all files currently open on the entire system.
sudo lsof -i
List all open network connections on the entire system.
sudo lsof "/Volumes/FW Drive"
List all open files on the "FW Drive" volume; useful for figuring out why you can't eject/dismount a disk because something is using it.

ifconfig - Configure network interfaces (e.g. ethernet ports, AirPort cards, etc).

Notes:
  • In general, it's better to adjust the network settings in the Network pane of System Preferences. ifconfig sometimes allows a little more control/information, but changes made this way will almost never "stick" when the computer is rebooted, and may get reset when the network settings change (e.g. if the location changes, a port gets connected or disconnected, etc).
  • Changing the network settings requires root access.
  • ifconfig refers to network ports using rather cryptic identifiers such as:
    en0
    The first ethernet interface (generally, the built-in ethernet port).
    en1, en2, etc
    Additional ethernet interface(s) and/or AirPort wireless network card(s), firewire, etc.
    lo0
    The local loopback pseudo-interface, which your computer uses to talk to itself. Don't worry, this is not a sign of schizophrenia, it's just the way unix systems work...
Examples:
ifconfig -a
List the computer's network ports and their settings.
sudo ifconfig en0 media 100baseTX mediaopt full-duplex
Set the built-in ethernet interface to 100-megabit, full-duplex mode. Note that this may or may not have any effect, depending on whether the driver supports this form of configuration-forcing.
sudo ifconfig en0 alias 10.0.0.150 netmask 255.255.255.0
Attach an additional IP address (aka an alias or subinterface) to the built-in ethernet port. Note that (at least as of OS X 10.2) this is probably better done by simply adding another port configuration in the Network preference pane.

diskutil - Provides various utilities for dealing with Apple's disk format options (HFS+, journaling, RAID, etc). Many options require root access.

Examples:
diskutil
Display a list of diskutil's options.
diskutil info /
List information on the boot volume.
diskutil info /Volumes/Data
List information on a mounted (non-boot) volume named "Data".
diskutil info /dev/disk0s9
List information on partion #9 of disk #0.
sudo diskutil repairDisk /Volumes/Data
Repair the file structure on the volume "Data" (note: this unmounts the volume during repair).
sudo diskutil repairPermissions /
Repair the file permissions on the boot volume.
sudo diskutil enableJournal /
Enable HFS+ journaling on the boot volume.
sudo diskutil disableJournal /
Disable HFS+ journaling on the boot volume.

61. Handy Unix Network Troubleshooting Commands

61. Handy Unix Network Troubleshooting Commands


Introduction to Data Communications
61. Handy Unix Network Troubleshooting Commands

1. Handy Unix Network Troubleshooting Commands

The following network troubleshooting commands will vary slightly in syntax depending on which operating system is used. Some operating systems will provide more options and some less. Please use the following information as a guide and the syntax presented with "a grain of salt".


arp

Use this command to see the IP to MAC address translation table if you are having problems connecting to other network hosts. It is a dynamic cache which updates every 120 seconds. ARP stands for Address Resolution Protocol (ARP).

 arp - a

address resolution protocol
host name (IP address) at (ethernet address)

ping

The ping command is the most versatile network troubleshooting command in Unix. Use it to verify that your TCP/IP network services are operating correctly. The ping command allows you to determine that the:

  • TCP/IP stack is configured properly

  • Network interface card is configured properly

  • Default gateway and subnet mask is configured properly

  • Domain name services is configured properly.

The following is a step by step guide in determining if your network stack is configured properly:

  1. ping 127.0.0.1

    Checks that your TCP/IP stack is working properly up to the network interface card (NIC). If this fails, check to see if you have TCP/IP services loaded.

  2. ping "IP address of default gateway"

    Checks that the network interface card is working on the local subnet by pinging the local side of the default gateway which is a router. If this fails, check that TCP/IP is bound to the NIC. Then check that the NIC's IRQ, and base address are set properly both on the card itself and in the operating system's interface configuration.

  3. ping "IP address across the gateway"

    Checks that the default gateway is correctly identified in the TCP/IP configuration and that the proper subnet mask is configured. The IP address selected must not be on the local subnet.

  4. ping "domain name"

    Checks that the domain name services (DNS) is correctly configured in the TCP/IP stack. A domain name is a name like www.yahoo.com. If it fails, check that the DNS server's IP address is entered in properly in the TCP/IP configuration.


netstat

The network status command netstat displays status information about the network interfaces on the host machine and it can display routing table information.

  1. Local interface status

    netstat -ain

    a - all interfaces are displayed
    i - displays configuration
    n - IP addresses (!n - host names)

    example output:

    Name MTU Net/dest address Ierrs Opkts Collis Queue
    le0 1500 (net IP addr) (local IP) . .. ... ....

  2. Routing table information

    netstat -r  (-nr or rn gives ip addresses)

    Routing Table
    Destination Gateway Flags Interface
    (net or host) (IP address) UHGD (name)

    U - up H - host G - gateway D- discovered using ICMP Req


ifconfig

The ifconfig command is used to display the local interface configuration (winipcfg for Windows) and to modify the configuration. Local interfaces can be Ethernet network cards, modems, etc..

ifconfig (interface name) (down/up/nothing) nothing gives status

(interface name): flags - 63 (up, broadcast, notra, Running)
inet (ip address) netmask FFFFFF00 broadcast 128.6.7.255

route

The route command allows you to add static routes to the routing tabling.

route (-n) (add/delete/nothing) (dest IP address/subnet/DEFAULT) (local IP address) (hop)


traceroute (tracert in Windows)

Traceroute displays the routers that are passed through to reach the destination.

traceroute "IP address or domain name"

Tracing route to www.apllejcok.com [192.168.1.64]
over a maximum of 30 hops:

1 116 ms 134 ms 112 ms ts10.dshark.com [192.168.128.20]
2 124 ms 112 ms 114 ms bl1.poufe.com [192.168.130.1]
3 122 ms 118 ms 117 ms fifo.amalag.com [192.168.64.2]
4 130 ms 156 ms 132 ms dfg.apllejcok.com [192.168.1.1]

Introduction to Data Communications
Previous Table of Contents Next

AFP

Wednesday, April 2, 2008

AFP-

AFP
Some Patchstick-Instructions were replacing the Kerberos.framework file of the AppleTV. This is causing some problems. In particular, mount_afp fails with "Illegal instruction".

So be sure to have the following Directory-Structure on your ATV:

Code: Select all
/System/Library/Frameworks/
/System/Library/Frameworks/Kerberos.framework/
/System/Library/Frameworks/Kerberos.framework/Versions/
/System/Library/Frameworks/Kerberos.framework/Versions/A/
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos

/System/Library/Frameworks/OSXFrames/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Kerberos
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Resources/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/


1st Kerberos is 40408 / md5 5a2805de06aea5a4b52be9fbd95c65e6
2nd Kerberos is 2322540 / md5 e110e4e8c1d6ea881ced60c996836487


Check also the /usr/libexec/sshd-keygen-wrapper. The wrapper should contain the following line at the end:

Code: Select all
DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec /usr/sbin/sshd $@



...if not, run:

Code: Select all
sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' /usr/libexec/sshd-keygen-wrapper


This works on my ATV just perfect and I can mount the Time Capsule HD through AFP! Of course SSH v1 and v2 works too 8)

Cheers

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

Ok, finally got afp working according to the instructions in this post.

viewtopic.php?f=2&t=1338&st=0&sk=t&sd=a&start=20#p8283

To summarize these are the steps I took to solve the "illegal operation" error.

Please note that you are working with two different versions of Kerberos.framework, one from the MacOSX update package, and the other from the AppleTV restore partition. These are not interchangeable and are the cause of all the "illegal operation" errors

1) Copy /System/Library/Frameworks/Kerberos.framework from the MacOSXCombo10.4.8Intel.pkg to your AppleTV home directory. (10.4.9 would probably work as well, but I haven't tried it)

2) create the /System/Library/Frameworks/OSXFrames directory
Code: Select all
sudo mount -uw /
sudo mkdir /System/Library/Frameworks/OSXFrames

3) Copy Kerberos.framework from your AppleTV home directory to the OSXFrames directory
Code: Select all
sudo cp -pr ~/Kerberos.framework /System/Library/Frameworks/OSXFrames/

3) On the AppleTV run the sed command.
Code: Select all
sudo sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' /usr/libexec/sshd-keygen-wrapper

4) mount the recovery partition
Code: Select all
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
sudo hdiutil mount recovery.dmg
sudo hdiutil mount /Volumes/Recovery/OS.dmg

5) copy the Kerberos.framework from your recovery image to the proper directory (Note: I have a 1.0 recovery partition, a 1.1 may not work)
Code: Select all
sudo cp -pr /Volumes/OSBoot\ 1/System/Library/Frameworks/Kerberos.framework /System/Library/Frameworks/

at this point I lost my ssh connection, you may have to log back in using sshV1 (ssh -1 frontrow@appletv.local). Thank-you sugarola.

6) repair permissions
Code: Select all
sudo /usr/sbin/diskutil repairPermissions /

7) Mount the shared drive
Code: Select all
mount_afp afp://username:password@myMac.local/SharedDrive ~/MountPoint


You should now have both ssh2 and working afp.

Once again I would like to thank everyone on this board for helping out.

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

@jayfehr

Nice tutorial :mrgreen:

But you should add something (above 4.) If you don't run "afpinstall.sh" the file recovery.dmg is missing. You can obtain the file running:

Code: Select all
sudo mount -uw /
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m


Cheers
================================================================
@The stig

One other thing I had not mentioned in the tutorial was that when installing afp I did NOT use the afpinstall.sh script, I used the manual install process from the Take 2 Full Update wiki (http://wiki.awkwardtv.org/wiki/Take_2_Full_Update) This method copies over many, many more files then the script, some of which may be relevant. Also these may only work on a 1.0 AppleTV, if you are running a different version these instructions may not help. Also after running the manual process be sure to run:
Code: Select all
sudo /usr/sbin/diskutil repairPermissions /

As mentioned in one of the comments below the manual instructions (those comments do not include the "sudo" or final "/" which are very important

Anyway here is the info you asked for:

From the MacOSXUpdCombo10.4.8Intel (now installed in the OSXFrames dir on the AppleTV)
-rwxr-xr-x 1 frontrow frontrow 2322540 Sep 8 2006 /System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/A/Kerberos
MD5 (/System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/A/Kerberos) = 2b7df04894c3dca1704c095bf3f3e1fc

From the AppleTV Restore partition (now installed in the Frameworks dir on AppleTV)
-rwxr-xr-x 1 frontrow frontrow 40408 Mar 14 2007 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
MD5 (/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos) = d1da821aab78143be38f9a58471cc99c

AwkwardTV Community & Forums • View topic - nitoTV 0.3.1a/b (take two) released!

AwkwardTV Community & Forums • View topic - nitoTV 0.3.1a/b (take two) released!: Sorry another release right before work (it was either that or chancing not till tomorrow- sorry) update as usual internally (if you already have nitoTV installed) settings - > install software - > update nitoTV

or

http://nitosoft.com/nitoTVInstaller_tt.zip

heres a clip from the about file on update info.

General Update Info 0.3.1
===================

The fixPerm script works again, AND the installer section is more lenient with which permissions are acceptable to run. More importantly, the smart installer will work from a 1.0 AppleTV restore image. So if you have a copy of the recovery.dmg from a 1.0 AppleTV in the /Users/frontrow/Documents folder it will install AFP, install scripting components (fixes POD and emulators in take 2 full), remote desktop and perl. The play folder bug is fixed, and DVD playback should go to mplayer again rather than just locking up. We have cover art viewing and generating returning, unplayed markers as well, coming much closer to catching the Take 2 version up to the 1.x functionality.

Lack of time:

1. File Copy / Paste

Potential code re-writes:

1. On screen display in quicktime
2. dvd playback framework (dvd plays in mplayer for now)
3. metadata



--

Bit of a delayed post update, the release day was a busy day as was yesterday. there appears to be a REALLY stupid problem with the permission check that i THOUGHT i totally fixed when doing the transition to leopard but i guess i didnt. sorry about that- the following code will fix the permission check for any installers that arent working.

Code: Select all
sudo mount -uw /
cd /System/Library/CoreServices/Finder.app/Contents/PlugIns/nitoTV.frappliance/Contents/Resources/
sudo chmod 755 nitoHelper
sudo chmod u+s nitoHelper


when i have more time this week im going to start up a new wiki for the take 2 version of nitoTV to focus on the differences between the two versions. (1.x and take 2)

the about file / section has all the updates as usual, no reason to post the info that is repeated in a few different places.


--

Two major changes in 0.2.2, perian installer and smart installer both are directly tested and verified to work in the full take 2 environment. smart installer will also take care of usb patching for take 2 (verified) as well :) same links as before. (or grab it internally if you already have 0.2.x installed)


---

beta 0.2, it's 4:45 am so ill keep it short.

download and follow install instructions

http://nitosoft.com/nitoTVInstaller_tt.zip

NOTES:

fixed the linker error with AppleShareClientCore.framework / AppleShareClient.framework. Will load, but bonjour section will still crash if those frameworks are missing. Smart installer SHOULD accomodate easy USB patching for 2.0 (untested in full 2.0, just followed instructions from full update wiki and made appopriate bsdiff files)

on a different note i finally got around to making a patchstick so i may backup my atv and do a full take 2 update and see if i can't make sure everything works properly and maybe get some of those update features from the full udpate wiki into the smart installer.. now that the plugin has returned more to its original capability i can look on towards new features again soon....

--

nitoTV version 0.2 (take two), Feb 28th, 2008.

Beta 2 welcomes back RSS, installation manager, file sizes, properly sorted menus, ejecting volumes, file deletion, playlist core data (playlist modes, shuffle, repeat), plenty of bug fixes and probably some things i forgot.

The lists have been reorganized, the top list is stuff I didn't have time to finish for this release, the second list are features that are going to require some re-writing that I haven't quite figured out yet.

Lack of time:

1. Music
2. Photos
3. unplayed / played markers

Potential code re-writes

1. On screen display in quicktime
2. volume / sub / audio toggling in quicktime
3. dvd playback framework (dvd plays in mplayer for now)
4. Cover art / preview auto generation
5. metadata

--

okay heres the first take two release, (is kind of alpha/beta stage) ill update the wiki and more later after i get back from work.

download and follow install instructions

http://nitosoft.com/nitoTVInstaller_tt.zip

for now heres a carbon copy of the about section for some basic information on what doesn't work yet
---
nitoTV version 0.1 (take two), Feb 23rd, 2008.

Alright at long last, the first alpha/beta of nitoTV for Take 2. This is a bit of a slimmed down version and some things got 86'ed in favor of a faster release. The following does not work yet.

1. Music
2. Photos
3. On screen display in quicktime
4. volume / sub / audio toggling in quicktime
5. dvd playback framework (dvd plays in mplayer again for now)
6. emulators aren't exiting properly.
7. POD
8. RSS
9. Weather
10. Preview views / auto generation
11. unplayed / played markers
12. metadata

Most of the above wasn't implemented just for lack of time and for quicker initial release, some of the things will take longer because it appears i need to write some new code to accomodate some of the new graphic / video frameworks installed w/ Take 2.

Sorry for the barren about section, this will be better polished in the second release.

Tuesday, April 1, 2008

Frequently Used Unix Commands

Frequently Used Unix Commands

Frequently Used Unix Commands


U-M Information Technology Central Services * R1159 *November 2003

The Unix operating system supports many commands. To review a more complete definition of any of the commands listed below, type man command at the Unix shell prompt (%), where you have replaced command with the name of a Unix command. For example, type man exit to find out more about the exit command.

NOTE: This document assumes you are using Unix on the ITCS Login Service (host name login.itd.umich.edu). These instructions apply to many other Unix machines; however, you may notice different behavior if you are not using the ITCS Login Service.

TIP: The variable files refers to a list of any number of files separated by white space; in the same way; names refers to a list of file or directory names separated by white space.


NOTE: This document is also available in these formats:


Table of Contents


General

apropos command
Locate commands by keyword lookup.

exit
Terminate your current session, or shell.

man command
Display the Unix manual page describing a given Unix command.

File System Navigation

cd
Return to your home directory.

cd directory
Change directory to make directory your current directory.

file files
Determine file type.

ls
List the contents of the current directory.

ls names
List the contents of the directories; names can name files and/or directories:

ls -l
. . . in a long format, showing permissions, owner, size, and other file info.

ls -a
. . . all files, including "hidden" files (file names that begin with a dot ".").

ls -R
. . . Recursively, for all subdirectories.

ls -t
. . . in time order (when modified, newest to oldest) rather than in name order.

pwd
Display the name of the current directory, or "print working directory."

File/Directory Manipulation

compress files
Reduces the size of a file.

uncompress files
Restores compressed files to their original form.

cp file1 file2
Copy file(s).

cp files directory
Copy file(s) into a directory.

cp -r dir1 dir2
Copy a directory and, recursively, its subdirectories.

mkdir directory
Create, or "make" a directory.

mv file1 file2
Move a file or, if file1 and file2 are in the same directory, rename a file.

mv files directory
Move files into a directory.

mv dir1 dir2
If directory dir2 exists, move dir1 into dir2; otherwise, rename dir1 as dir2.

rm files
Remove (erase) file(s).

rm -r names
Remove files, directories, and recursively, any subdirectories.

rmdir directory
Remove directory (directory must be empty).

Data Manipulation

cat files
Concatenate file(s); you can use cat to display the contents of a file (this is not advisable if the file is a binary file).

grep "pattern" files
Display all lines in the files that match a pattern.

more files
Display contents of files one screen at a time.

sort files
Order the lines in a file or files alphabetically (this command does not alter the file or files -- it merely displays the sorted output to the screen):

sort -r files
. . . in reverse order.

sort -n files
. . . numerically (puts 2 before 10 instead of after).

Networking/Communications

finger user@umich.edu
Displays information about a U-M user from the U-M Online Directory.

ssh hostname
Connect to a remote host using Secure Shell.

telnet hostname
Connect to a remote host using the telnet protocol.

talk user
Initiate a conversation with another user (end conversation with Control-C); talk works only between machines of the same architecture.

Miscellaneous

!!
Repeat last shell command.

!string
Repeat last shell command that began with string (for example, type "!m" to repeat the last command that began with "m").

cal
Display a calendar of the current month.

cal month year
Display a calendar of the given month and year. Note that the year must be fully qualified, for example, "2003" and not "03."

clear
Clears terminal screen.

date
Display the current local date and time.

who
Display a list of users currently logged in.

Additional Resources

Visit ITCS's Information System to obtain ITCS computer documentation and other resources. A list of relevant documents follows.

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.