Wednesday, April 11, 2007

IPOD HACK: Install Linux On I-pod

What can Linux on iPod do?
Linux on iPod is not yet complete, and only offers some basic functions.
Some current podzilla features:
• A music browser allowing you to view your iPod's music in a similar way to Apple's iPod firmware
• Basic MP3 playback (with volume control)
• Basic Recording
• Some simple games
o Bluecube (Tetris (http://www.wikipedia.org/wiki/Tetris))
o Invaders (Space Invaders (http://www.wikipedia.org/wiki/Space_invaders))
o iPobble (Puzzle Bobble (http://www.wikipedia.org/wiki/Puzzle_Bobble) or Bust a Move)
o Lights (Lights Out (http://www.wikipedia.org/wiki/Lights_Out_%28game%29))
o Nimesweeper (Minesweeper (http://www.wikipedia.org/wiki/Minesweeper_%28computer_game%29))
o Othello
o Pong (Pong (http://www.wikipedia.org/wiki/Pong))
o Steroids (Asteroids (http://www.wikipedia.org/wiki/Asteroids))
o Tic-Tac-Toe
o Tunnel
o Tuxchess (Chess)
• A few GFX demos
o Cube
o Matrix
o Mandelpod
• A file browser able to:
o Read text files
o View images (JPEG, GIF, BMP, PNM and XPM formats are supported)
o Execute external applications
o Play uncompressed videos
• A Linux shell interface


Playing Songs
You can play songs via either the Music menu, which plays your iPod's song in an ordered way (similar to that of the iPod's original firmware) or by selecting the song using the file browser
When the song is playing, you can pause by pressing the play/pause button, and resume the song by pressing play/pause again. The volume can be changed with the scrollwheel. You can go the next song by pressing next, and go back by pressing previous if the song was played through the Music Browser. To go back to podzilla, press Menu. When Menu is pressed, the song will stop playing and you will be shown the podzilla interface again. You can choose Shuffle and Repeat as well through the Settings menu.

Games
In the Extras menu, select Games, and you will be presented with a choice of games. Pressing Menu while in a game will bring you out of the game.
• Game Instructions
o Bluecube(Tetris): Previous is used to move the block left, Next is used to move the block right. Play/Pause is used to speed up the block going down. The scrollwheel can be scrolled left or right to turn the piece. Pressing the middle select button causes the piece to go down straight away.
o Pong: The scrollwheel is used to control the movement of the paddle.
o Othello: The scrollwheel is used to control which block is selected, and the center button is used to select that block.
o Nimesweeper(Minesweeper): The scrollwheel is used to select the mine you want to mark. Press play to mark a mine. Press play once again to cancel.
o Steroids(Asteroids): Scroll wheel rotates ship, middle select button fires, Next toggles thrusters on/off. Play/Pause can be used to pause the game.
Browsing Files
The File Browser is located on the main menu. When in the File Browser, you will be able to access the different directories on the iPod's harddrive. You can open text files by selecting .txt files. To select a file, scroll to that file, and press the center button. To get back to the File Browser from the text file viewer, press Menu. You can also open picture files (JPEG, GIF, BMP, PNM and XPM) on the iPod by selecting the file, and pressing the select button. A picture may take a while to open depending on the size. Pressing Menu will take you back to the File Browser. Pressing Menu in the File Browser will take you back to the Main Menu. If you want to go into another directory, scroll to the directory and press the center button. If you want to go back to the parent directory, scroll to the top of the file browser till you see "..". Selecting this will take you back to the parent directory.
When you hold down the select button on a file object, you will get a menu containing at least the "Delete" command. If you confirm it will delete the object. For text files another menu option will show up: Edit in viP. When you select this, the viP text editor will be opened on the selected file.
Shell: Command Line Interface
There is an external site containing 19 screenshots (http://www.artm-friends.at/rm/ipodlinuxguidedtour/ipodlinuxguidedtour.html) about sash and viP usage. The text and examples are similar to those presented here.
Starting the sash Shell
An unmodified iPod Linux (as installed by the GUI-installers for Mac OS X or Windows) boots straight into the podzilla GUI application. You can enter the sash shell in the following way: From podzilla, start the File Browser. Navigate to the "/bin" directory. Scroll down to the program "sh" (actually this is a link to the sash executable). Start it by pressing the center button.
Entering Commands
The prompt shows your current dir. When sash was entered as above, the initial dir is /sbin. As an example enter the command "cd .." to change to the root dir "/" as follows:
Choose a character by using the scroll wheel. All available characters show up: lower case letters, upper case letters, numbers and some other ascii chars. When the correct char is displayed at the insertion point (cursor position), in our example the lower case "c", press the Next button. The char will be accepted and the cursor will be advanced. As the default for the next char a second "c" is displayed. (The default is always the same char as the last one.) But we want a "d", so by carefully moving the scroll wheel a very small amount change the "c" into a "d". Commit this "d" by pressing again the Next button. A second "d" appears. Change it by scrolling into a space. You find the space just before the "a". To complete the example, we need two dots. Enter a dot. This time the second dot appearing as default is okay, we just want it. So do not change it but press enter now. Enter is the "Play/Pause" button. The command is executed and the working dir is now "/".
In order to feel at home in Linux we can go on making a home directory (iPod Linux arrives without one). Enter the command "mkdir home" now, than enter "cd home". Here we can create a new file named "test" by entering the command "touch test".
Using the viP Text Editor
When you want to edit the contents of a file "test", enter the command "viP test". viP is the text editor of iPod Linux. (If "test" exists already, it will be opened for editing, otherwise a file of that name will be created.)
As its grandfather vi, viP makes heavy use of modes. When started up viP is in "insert" mode. In "insert" mode you can enter text (using the scroll wheel and the Next button, just like in sash). This text will be inserted at the cursor position, i.e. already existing will not be overwritten but shifted behind.
When ready with text input you have to change to the command mode. Press the Menu button once to change to the command mode. The cursor jumps to the last line of the screen and awaits for a typed command. Instead of typing a command it is usually easier to press Menu again. Now you have a scrollable menu of available commands in that last line of the screen. Available commands include :insert, :move, :save, :quit. You execute a command by pressing the enter button (Play/Pause).
• insert brings you into the "insert" mode, described above
• save saves the current state of the file to disk
• quit leaves the editor (and returns to sash)
• move switches to the "move" mode
In "move" mode the cursor is back in the text area. You can now move around in the open file. Turning the scroll wheel either moves horizontally inside a line from char to char, or vertically from line to line. You switch between these two submodes by pressing the center button.
Other examples
Other shell command examples (besides the already mentioned cd, ls, mkdir, viP, touch) include:
• ps - list of running processes
• uptime - elapsed time since booting into Linux
• exit - leave the shell
and others, found in the /bin directory.
Leaving the Shell
While in the shell you can return to the podzilla GUI by entering the command "exit" or by simply pressing the Menu button.




Installation
Installing Linux onto your iPod is a non-destructive process and will leave all your existing configuration and music intact. The included bootloader will also allow you to choose either the Apple or the Linux software when you reboot (reset) your iPod.
Before installing iPodLinux, make sure your iPod is supported! If you try to install Linux on any of the unsupported iPods, there's a much higher chance of error or unworkability; tread carefully, and don't come crying to us when you think your iPod is broken. (It's not.)

Computer Connection
In order to install Linux on your iPod you first need to make sure your system is configured to connect to your iPod. If you are using Mac OS X, it is most likely already configured. If you are using Windows, make sure iTunes lets your iPod show up as a disk drive in My Computer.

Disk Mode
Connect the iPod to your computer and make sure it shows Do not disconnect on the iPod's screen. This is called Disk mode. The iPod should enter Disk mode automatically once connected. If it does not, for 1-3G iPods you can force it to enter disk mode by rebooting your iPod (hold down menu and play/pause for a few seconds (until the screen blanks out), and then quickly hold down rewind and fast forward). For later generation iPods, you can enter disk mode by holding down menu and select for about 5 seconds and then switch quickly to select and play/pause once the screen display changes.

Overview

Components
iPodLinux consists of several components, some of which are currently being migrated from their original versions to second generation versions. Here is a overview of the components involved:
• The Boot Loader. There is the original version which silently boots either the Apple firmware or Linux, choosing the other by pressing the Rewind key at startup. There is also a new version 2 which offers a menu with many more options, including support for Rockbox loading.
• The Kernel. There is mainly one version that hasn't been changed in a while, which is stored in CVS and which you can download as a prebuilt file. There is, however, a side project on an improved kernel, which you may alternatively install once you have had success with the default kernel.
• The Userland is a set of files and folders providing the basic functionality to using Linux on the iPod. It contains a shell, the /etc/rc startup file, among others. The default shell may be sash, a very dumb shell. You might want to install the Minix shell as a replacement.
• Podzilla is the main user application for iPodLinux, being similar to what you use on a Apple-driven iPod: You get a graphical menu from which you can launch tools, change settings, browse music etc. There exists the original monolithic podzilla, which only supports older iPod models, and the new modular podzilla 2, which supports all current iPod models and allows adding new modules easily.
Partitioning
Linux needs a file system that supports Unix-style permissions.
WinPods use the FAT32 format, which is not adequate for Linux. Therefore, you need to add another partition, e.g. ext2, to install Linux on. This may require that you reformat your iPod, losing all your stored data on it. Make sure you have a backup of your iPod files before installing iPodLinux on it. The easiest way to add a ext2 partition to your WinPod is to use Installer 2, which takes care of the partitioning for you.
MacPods, on the other hand, use the HFS+ format, which Linux can be run from. Hence, you can simply store the Linux files on a MacPod from a Mac OS computer by copying them using the Finder or the cp in a command shell. You may have to use chmod +x on select files (/etc/rc and /sbin/* after the copying to make them executable.
Recommended Installation Procedures
There are several methods for installing iPodLinux. Here is a brief list of your options:
• Using the new Installer 2 is probably the easiest solution to get a quick start. It is currently only available for Windows and Linux, not Mac OS X, though. Also note that it's still in development, and may not fully work in all corners yet. It is a good idea to use a "fresh" iPod, meaning that if you have already done any kind of modification to your iPod and the installer isn't working for you, you should go here: http://www.apple.com/ipod/download/ and get the restore/upgrade software and use it to return your iPod to a workable state.
• Mac OS X users should try the new Mac Installer. That one is still under development as well, though.
• If you had success with the basic installation, you can switch to using the latest Loader 2 with the Installer. You can also do it by hand with the manual installation instructions.
• Note: Before installation, make sure that the path to your installer contains ONLY English letters. Otherwise, for instance, if you have Russian letters, installation will end with an error
Starting iPodLinux (and Apple's)
Eject (or unmount) your iPod from your PC, then reboot the iPod using the Key Combinations if it doesn't reboot by itself after the installation already.
Important: When you had connected your iPod to your PC, do not reboot the iPod while it says do not disconnect, because that might have the bad effect that the modifications you made to the iPod get partially lost. Make sure you eject the iPod so that it says ready to disconnect before you reboot it!
When the iPod restarts, it'll show first the usual picture of an apple, then it should either:
• Show a picture of the original happy Mac, and after another few seconds should be back in the normal Apple software.
• Show a picture of a penguin, after which it will boot into Linux.
• Show a menu with choices such as Apple OS and iPodLinux.
In the first two cases, you have the original loader installed - hold down the << (rewind) key after a reboot and before either the Mac or the penguin picture appears to have the alternative software loaded. In the latter case, you have Loader 2 installed. Use the <<>> keys to select an item from the menu and press the center button to select it.
If you chose to boot into Linux, podzilla should start. It may show a few messages which you have to dismiss with the center button, and then you have a menu interface similar to that of the original Apple software.
Now you are ready to explore iPodLinux. See the Documentation page for further pointers.
Note that if you have a WinPod, you'll not be able to see the newly installed Linux files from your Windows PC. See Accessing ext2 to learn how to access those linux files and folders.
If you want to copy new items to the iPod, you'll have to get it into disk mode again, just like before. iPodLinux does not offer its own disk mode - you have to reboot it into Apple's software for that.

What if something goes wrong?
Be sure to have a backup of your music before installing iPodLinux (while Installer 2 offers to make a backup for you, that does not include your files on the iPod but only Apple's iPod firmware)! If anything goes wrong, you can always use Apple's handy Firmware Restore Utility (http://www.apple.com/ipod/download/) to reinstall Apple's iPod operating system (called firmware). This will remove iPodLinux and make your iPod work the same way it did when you bought it. If you follow the directions exactly, the worst case scenario is to lose your music and settings.
If you attempt to install iPodLinux on an unsupported iPod it is possible that the Apple restore ut

No comments:

MAKE FREE MONEY

WELCOME

Welcome to my world where everybody is somebody and none is nobody. Together we shall hack all hackables