% $Id$ %

\opt{ipodvideo}{\newcommand{\bootloaderfile}{bootloader-ipodvideo.ipod}}%
\opt{ipodmini}{\newcommand{\bootloaderfile}{bootloader-ipodmini1g.ipod}}%
\opt{ipodnano}{\newcommand{\bootloaderfile}{bootloader-ipodnano.ipod}}%
\opt{ipodcolor}{\newcommand{\bootloaderfile}{bootloader-ipodcolor.ipod}}%
\opt{ipod4g}{\newcommand{\bootloaderfile}{bootloader-ipod4g.ipod}}%
\opt{ipod3g}{\newcommand{\bootloaderfile}{bootloader-ipod3g.ipod}}%
%
\opt{ipodnano}{\warn{If your Nano has a stainless steel back and plastic front 
it is a 1st generation and is compatible with Rockbox.  If, on the other hand, 
your Nano has a one-piece aluminum body it is a 2nd generation Nano and there 
is currently no Rockbox port available.  Do not attempt to install the 
bootloader on a 2nd generation Nano}}

In order to make your iPod load and execute the Rockbox firmware you have just 
installed, you will need to install the Rockbox bootloader. Unless bugs are 
found in the bootloader code, or significant new feature are added, you will 
only have to perform this step once.

The following instructions refer to the ``installation folder.''  For Windows 
users, the "installation folder" is assumed to be a folder in the root (top-
level) of the C: drive called \fname{rockbox} (you will obviously need to 
create this folder yourself).  For Mac OS X and Linux users, the ``installation 
folder'' is assumed to be the Desktop folder. But you can use any folder 
you wish. Note that these files should be saved onto your computer's hard disk, 
\emph{not} on your Ipod. 

\begin{enumerate} 

  \item First, download the \fname{ipodpatcher} tool to your installation 
  folder.  You can download the \fname{ipodpatcher} tool for your operating 
  system at \download{bootloader/ipod/ipodpatcher/}.
  
  \item Next, download the following file to the installation folder: 

    \download{bootloader/ipod/\bootloaderfile}
    \opt{ipodmini}{%
        or \download{bootloader/ipod/bootloader-ipodmini2g.ipod}
        depending on which generation your \dap{} is.
        The following page describes the differences between the two
        generations of the \dap{}: 
        \url{http://docs.info.apple.com/article.html?artnum=300850}.
    }

  \item Next, open a command prompt (Windows) or terminal window (Mac OSX and Linux).
  
    Windows users will perform this and the following steps from the Windows 
    command prompt. Start a command prompt and navigate to the isntallation 
    directory.

    Mac OS X and Linux/Unix users will perform these steps from the Terminal. 
    Start a new terminal window and navigate to the Desktop folder (type cd 
    Desktop into the terminal and press enter). You then need to ensure that the 
    ipodpatcher program is ``executable'' by typing the command chmod +x 
    ipodpatcher and then pressing enter.
  
  \item Connect your ipod to your computer.

    If you haven't already done so, you should now plug your iPod into your 
    computer (via either the USB or Firewire cable).

    \fixme{Notes about closing itunes, enabling the ``show ipod as disk'' option 
    in ipod, anything else?}

  \item Find your ipod with ipodpatcher (Windows users only)

    Windows users:  Type the following command to search for ipods attached to 
    your computer: 
      \begin{code} 
        ipodpatcher --scan 
      \end{code}
    
    When ipodpatcher finds your ipod, remember the number it displays - this 
    will  be the number you use to access your ipod in the following steps.

    \note{Windows users require administrator rights for running  ipodpatcher. 
    Either re-login as administrator, or open a command prompt running under an 
    administrator account by using one of the "Run as" features of Windows XP.}

  \item Find your ipod (Mac OS X users only)

    Attach your iPod to your Mac (using either USB or Firewire) and wait for 
    iTunes to open. When iTunes opens, close it down.  In your Terminal window, 
    type the command mount and press enter. This will list all the disks (and 
    other devices) that are "mounted" on your computer. The last  drive in the 
    list should be your iPod. For example: 
    \begin{code}
       /dev/disk1s2 on /Volumes/DAVE_S IPOD 1 (local, nodev, nosuid) 
    \end{code}

    In order to install the ipod bootloader, you need to "unmount" this disk 
    using the following command: 
      \begin{code} 
        diskutil unmount /dev/disk1s2 
      \end{code}
      
    replacing ``/dev/disk1s2'' with the device name Mac OS has assigned to your
    ipod. This may take a few seconds, after which Mac OS will say ``Volume 
    /dev/disk1s2 unmounted.'' ``/dev/disk1s2'' refers to the second partition on 
    /dev/disk1 - remember   ``/dev/disk1'' for the next step.

    It's possible that itunes will try to be ``helpful'' and remount your ipod 
    after you modify it with ipodpatcher. If this happens, you need to unmount 
    it again using the above command. 
  
  \item Create a backup of your ipod's firmware partition

    Type the following command, replacing "[device]" with the number (for 
    Windows users) or the device name (Mac OS X and Unix users) assigned to 
    your ipod that  you found in the previous step: 
      \begin{code} 
        ipodpatcher [device] -r bootpartition.bin (Windows) 
      \end{code}
      or
      \begin{code}
        ./ipodpatcher [device] -r bootpartition.bin (Mac OS X/Unix)
      \end{code}
  
    This should create a file in the current folder called bootpartition.bin 
    (approximately 40MB for the iPod 3G, 4G and Color/Photo, 80MB for the Nano 
    1st gen and 30GB Video, and 112MB for the 60GB Video) containing a copy of 
    the ``firmware partition'' from your iPod.

    If it ever becomes necessary (i.e. your ipod refuses to start), you can 
    restore this backup to your ipod using the command ipodpatcher [device] -w 
    bootpartition.bin (Windows) or ./ipodpatcher [device] -w bootpartition.bin 
    (Mac OS X/Unix).   

    \opt{ipodmini}{
      \note{Ipod Mini 2g users need to replace ``1g'' with ``2g'' in the
      following commands.} 
    }
 
  \item Install the bootloader.
    Windows users should now type:
    \begin{code}
    ipodpatcher [device] -a \bootloaderfile
    \end{code}
    %

    and Mac OS X/Unix users should type:

    \begin{code}
    ./ipodpatcher [device] -a \bootloaderfile
    \end{code}

  Replace [device] with the number (Windows users) or device name (Mac OS X/Unix 
  users) you've been using to access your ipod.  
  
  You can now disconnect your ipod from your computer in the normal way. This 
  should cause your iPod to reboot and start Rockbox.
  
\end{enumerate} 
