This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

Installing iPodLinux on the iPod Nano

By Joe Barr on April 06, 2006 (8:00:00 AM)

Share    Print    Comments   

I recently received an iPod Nano as a gift. My Nano is amazingly small, contains a gigabyte of storage, and sounds very good through its ear buds. It didn't take long for me to learn that folks have been putting Linux on iPods for a couple of years now, courtesy of the iPodLinux Project. Granted, the software for the Nano and most fourth- and fifth-generation versions of the iPod is experimental -- we're talking the bleeding edge -- but, well, you know me -- Linux on my desktop, workstation, laptop, Tivo, and router. I had to have it on the Nano, too. Here's my report how I converted my stock iPod Nano into a dual-booting, sweet MP3-singing, iDoom-playing monster.
If you have any music on the Nano before you start, you won't when you finish. Make sure you back it up before you start. In fact, I also recommend that you have your Apple iPod install CD and access to a Mac or Windows machine nearby, just in case you make a mistake and need restore the iPod to its original state using the iPod Updater. I had to restart from scratch several times before I finally got it right. Also note that the following instructions are for an iPod Nano, and will probably not work on other iPods. There are installation instructions for all flavors of the iPod on the iPodLinux project wiki.

Finally, an important note: All commands in this article are as they would be entered on my machine. Your system may require you to use different devices, mount points, and directories. DO NOT SIMPLY COPY AND PASTE THESE COMMANDS TO EXECUTE THEM ON YOUR MACHINE.

Housekeeping

Before we get started on the Nano, let's do a little preparation on the Linux machine we'll be installing from. To keep things tidy during the installation, I went into superuser mode for the duration of the install and created a directory for the purpose with the command # mkdir iplinstall.

Next, I visited the iPodLinux Project site and downloaded a kernel and podzilla, the user interface for iPodLinux, from the nightly builds. I also downloaded the iPod Boot Loader and an iPod Linux Userland from the project page on SourceForge, placing both items in my newly created iplinstall directory. The iPod Boot Loader is needed to install and boot iPodLinux on the Nano, and the iPod Linux Userland provides a Linux file hierarchy populated with all the executables needed to run iPodLinux.

I decompressed the nightly kernel and podzilla downloads, but left the filesystem tarball alone. We'll decompress that later after we get the iPod ready for it. Next, I made a backup of the existing master boot record (MBR) and boot partition on the iPod. After booting the iPod into disk mode, I connected the USB cable to the iPod and the PC. There is no guarantee that the iPod is going to show up as the same device (/dev/sda, /dev/sdb, /dev/sdc) each time, so always check and see where it is each time it is mounted. Do that with a naked mount command, like this:

# mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
devshm on /dev/shm type tmpfs (rw)
/dev/sda1 on /backup type ext2 (rw)
/dev/hdb1 on /home type ext3 (rw)
tmpfs on /lib/modules/2.6.15-19-386/volatile type tmpfs (rw,mode=0755)
/dev/sdb2 on /media/ipod type vfat (rw,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,iocharset=utf8)

As you can see, this time it showed up as /dev/sdb2 and Ubuntu mounted it as /media/ipod. Your mount type may vary, as distributions choose their own paths for these things.

Making a copy of the MBR and the boot partition is as easy as entering the following two commands:

# dd if=/dev/sdb of=ipod_boot_sector_backup bs=512 count=1
# dd if=/dev/sdb1 of=ipod_os_partition_backup
Checkpoint, Charlie?

Let's check to make sure we have everything we need before proceeding. A directory listing in your install directory should look similar to this:

# ls -al
total 84364
drwxr-xr-x  2 warthawg warthawg     4096 2006-03-23 14:08 .
drwxr-xr-x 57 warthawg warthawg     4096 2006-03-23 13:51 ..
-rw-r--r--  1 warthawg warthawg  1650596 2006-03-23 13:14 2006-03-22-kernel.bin
-rw-r--r--  1 warthawg warthawg   821824 2006-03-23 13:14 2006-03-22-podzilla
-rw-r--r--  1 root     root          512 2006-03-23 14:07 ipod_boot_sector_backup
-rw-r--r--  1 warthawg warthawg  1578270 2006-03-23 13:17 ipod_fs_240206.tar.gz
-rw-r--r--  1 root     root     82220544 2006-03-23 14:08 ipod_os_partition_backup

We have a kernel, podzilla, filesystem, and the two iPod backup files. Everything is in place.

Repartitioning the Nano

Straight from the factory, the Nano comes with two partitions -- one of 10 cylinders and the second 114 cylinders. If your Nano is still mounted, use umount to unmount it. On my system, the command is:

umount /media/ipod

Now start fdisk to see what's there, using the p command to display the existing partition table:

# fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 1023 MB, 1023933952 bytes 255 heads, 63 sectors/track, 124 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 1 10 80293+ 0 Empty /dev/sdb2 11 124 915705 b W95 FAT32

Just as expected. Delete the second partition using the d command and specifying partition 2 when asked. That done, we'll recreate it a few cylinders smaller than it was originally. Here's the fdisk dialog from my machine when I recreated the partition:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-124, default 1): 11
Last cylinder or +size or +sizeM or +sizeK (11-124, default 124): 104

Command (m for help): p

Disk /dev/sdb: 1023 MB, 1023933952 bytes 255 heads, 63 sectors/track, 124 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 1 10 80293+ 0 Empty /dev/sdb2 11 104 755055 83 Linux

Be careful that you don't overlap the first partition with the second, because fdisk is not smart enough to keep you from doing so, or even to suggest a decent default starting location. Make the starting cylinder for the second partition 1 greater than the end of the first partition. As shown above, the first partition ends in cylinder 10, and the second begins in 11, just as it did originally. But now the end point is 104 instead of 124, which gives us plenty of space for our new Linux partition.

Before we make the Linux partition, let's do two more things: change the type of the second partition to FAT, and make both the first and the second partitions bootable. To change the type, use fdisk's t command, specify partition 2, and enter b for the new type. To make both partitions bootable, use the a command, specify 1, and then repeat for partition 2. Now the partition table should look like this:

Command (m for help): p

Disk /dev/sdb: 1023 MB, 1023933952 bytes 255 heads, 63 sectors/track, 124 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 * 1 10 80293+ 0 Empty /dev/sdb2 * 11 104 755055 b W95 FAT32

If your partition table looks like the one above, you're ready to proceed. If not, repeat the deletion and creation of the second partition, changing the type to FAT, and making both partitions bootable.

n command, p for primary partition, and 3 for the partition number. The starting cylinder will be 105, and you can accept the default ending location of 124. When you've finished, it should look like this:

Command (m for help): p

Disk /dev/sdb: 1023 MB, 1023933952 bytes 255 heads, 63 sectors/track, 124 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sdb1 * 1 10 80293+ 0 Empty /dev/sdb2 * 11 104 755055 b W95 FAT32 /dev/sdb3 105 124 160650 83 Linux

Double check that you haven't overlaid the previous partition, and if all looks right write the new partition table to disk using the w command. fdisk will end automatically when the write completes. Now you can unmount and eject the Nano:

# umount /media/ipod
# eject /dev/sdb

Doing so should cause the iPod to reboot, and it will be remounted when it does. Remember to double check that it is mounted and to verify which device it is.

As you can see from the output of the mount command on my system, I now have two partitions showing up on /dev/sdb: sdb2 is the FAT partition and SDB3 is the Linux (ext2) partition:

# mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
devshm on /dev/shm type tmpfs (rw)
/dev/sda1 on /backup type ext2 (rw)
/dev/hdb1 on /home type ext3 (rw)
tmpfs on /lib/modules/2.6.15-19-386/volatile type tmpfs (rw,mode=0755)
/dev/sdb3 on /media/ipod type ext2 (rw,nosuid,nodev)
/dev/sdb2 on /media/ipod-1 type vfat (rw,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,iocharset=utf8)

Now let's create the filesystems for those partitions. Unmount sdb2 and create the FAT file system on it:

# umount /media/ipod-1
# mkdosfs -F 32 /dev/sdb2

Then unmount sdb3 and create the ext2 file system on it:

# umount /media/ipod
# mke2fs /dev/sdb3

And finally, turn off the autochecking on the Linux partition:

# tune2fs -c 0 /dev/sdb3
tune2fs 1.38 (30-Jun-2005)
Setting maximal mount count to -1

Our partitioning chores are done.

Create and install the new root image

Now we're going to create a new root image that will load Linux by default, or the Apple OS originally installed if you hold down REVERSE while booting. We already downloaded the iPod Boot Loader from the project Web site and placed it in our installation directory. Untar and decompress it by entering:

# tar xzf Ipodloader-20060114.tar.gz

Now enter the new subdirectory just created by tar and copy two of the files up into the parent directory, and return to the install directory:

# cd iploader-20060114
# cp loader.bin ../
# cp make_fw ../
# cd ..

Back in the friendly confines of our install directory, we can now extract the Apple OS from the backup of the root partition we made earlier. Enter the following command:

# ./make_fw -o apple_os.bin -e 0 ipod_os_partition_backup

The next step requires we have the Apple binary (just created), the Linux binary (downloaded earlier), and the loader binary, just copied into the install directory. With those three pieces of the puzzle all present and accounted for, we can create our new image:

# ./make_fw -g nano -o my_sw.bin -l 2006-03-22-kernel.bin -i apple_os.bin loader.bin
Generating firmware image compatible with iPod mini, 4g and iPod photo...

Copy the new image to the Nano using dd:

# dd if=my_sw.bin of=/dev/sdb1
13180+1 records in
13180+1 records out
6748508 bytes (6.7 MB) copied, 0.802989 seconds, 8.4 MB/s

Check to make sure the Linux partition is mounted, and if not, mount it:

mount -t ext2 /dev/sdb3 /media/ipod

Now go into that partition and lay down the file system we downloaded earlier:

# cd /media/ipod
root@desktop:/media/ipod# tar zxpf /home/warthawg/iplinstall/ipod_fs_240206.tar.gz
tar: dev: implausibly old time stamp 1903-12-31 18:00:00
tar: home: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules/2.4.20-uc0/kernel/drivers/ieee1394: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules/2.4.20-uc0/kernel/drivers: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules/2.4.20-uc0/kernel: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules/2.4.20-uc0/pcmcia: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules/2.4.20-uc0: implausibly old time stamp 1903-12-31 18:00:00
tar: lib/modules: implausibly old time stamp 1903-12-31 18:00:00
tar: lib: implausibly old time stamp 1903-12-31 18:00:00
tar: mnt: implausibly old time stamp 1903-12-31 18:00:00
tar: proc: implausibly old time stamp 1903-12-31 18:00:00
tar: var/log: implausibly old time stamp 1903-12-31 18:00:00
tar: var/run: implausibly old time stamp 1903-12-31 18:00:00
tar: var/tmp: implausibly old time stamp 1903-12-31 18:00:00
tar: var/lock: implausibly old time stamp 1903-12-31 18:00:00
tar: var: implausibly old time stamp 1903-12-31 18:00:00

One more thing to do while we are in the Linux partition. Let's replace the version of podzilla that came in the file system download with the latest build we downloaded earlier and make it executable:

# cd /media/ipod/bin
# mv podzilla podzilla.old
# cp ~/iplinstall/2006-03-22-podzilla podzilla
# chmod +x podzilla

Now we need to get out of Dodge -- well, out of the Linux partition, at least -- and unmount the partition and eject the Nano:

# cd ~/iplinstall
# umount /media/ipod
# eject /dev/sdb

Disconnect your Nano from the USB and reboot it. If all has gone correctly, it should go directly into Linux and run podzilla when you do so. To boot into Apple OS instead, hold down REVERSE while booting.

Now you can impress your friends at a LUG meeting, as I did last night, because you are the proud owner of a dual-booting Nano.

Share    Print    Comments   

Comments

on Installing iPodLinux on the iPod Nano

Note: Comments are owned by the poster. We are not responsible for their content.

relief joint

Posted by: Anonymous Coward on May 28, 2006 03:16 PM
[URL=http://painrelief.fanspace.com/index.htm] Pain relief [/URL]

  [URL=http://lowerbackpain.0pi.com/backpain.htm] Back Pain [/URL]

  [URL=http://painreliefproduct.guildspace.com] Pain relief [/URL]
[URL=http://painreliefmedic.friendpages.com] Pain relief [/URL]
[URL=http://nervepainrelief.jeeran.com/painrelief<nobr>.<wbr></nobr> htm] Nerve pain relief [/URL]

#

Impressive

Posted by: Anonymous Coward on April 07, 2006 03:21 AM
Impresive work. I had no idea this was even possible, but since you can <a href="http://www.strangehorizons.com/2004/20040405/badger.shtml" title="strangehorizons.com">install linux on dead badgers</a strangehorizons.com> I guess I shouldn't be suprised.

#

Rockbox

Posted by: Anonymous Coward on April 07, 2006 03:21 PM
Anyone interested in this should also take look at <a href="http://www.rockbox.org/" title="rockbox.org">Rockbox</a rockbox.org>. Ogg, FLAC, Wav, gapless playback, crossfade, on-the-fly playlists, configurable screens etc etc. You never knew the Nano was so good!

#

Re:Rockbox

Posted by: Joe Barr on April 07, 2006 07:18 PM

I really enjoy Rockbox. And part two of this string will be about my Rockbox adventures on the Nano.


Joe Barr

#

does this

Posted by: Anonymous Coward on April 07, 2006 10:15 PM
work on ipod mini??? I would like to do it on my ipod mini!

#

Re:does this

Posted by: Anonymous Coward on April 07, 2006 10:44 PM
Read the part where it said:
"Generating firmware image compatible with iPod mini, 4g and iPod photo..."

Looks like it should work fine.

#

Re:does this

Posted by: Anonymous Coward on April 09, 2006 03:42 AM
mini instructions are here:

<a href="http://ipodlinux.org/Installation_from_Linux#1G.26ndash.3B4G.2C_Mini.2C_and_Photo" title="ipodlinux.org">http://ipodlinux.org/Installation_from_Linux#1G.2<nobr>6<wbr></nobr> ndash.3B4G.2C_Mini.2C_and_Photo</a ipodlinux.org>

#

Pain relief

Posted by: Anonymous Coward on May 28, 2006 03:18 PM
[URL=http://painrelief.fanspace.com/index.htm] Pain relief [/URL]

  [URL=http://lowerbackpain.0pi.com/backpain.htm] Back Pain [/URL]

  [URL=http://painreliefproduct.guildspace.com] Pain relief [/URL]
[URL=http://painreliefmedic.friendpages.com] Pain relief [/URL]
[URL=http://nervepainrelief.jeeran.com/painrelief<nobr>.<wbr></nobr> htm] Nerve pain relief [/URL]

#

hfs+ nano

Posted by: Anonymous Coward on April 09, 2006 03:40 AM
My nano seems to have a different partitioning scheme. Fdisk can not read the partition table; in parted you can see that there are three partitions, the largest one of type hfs+. I'm wondering if there is any reason *not* to just delete all the partitions and re-create them with fdisk as described in the article? Any comments on that idea appreaciated.

Thanks -- great article.

#

Un-repartioning?

Posted by: Anonymous Coward on July 12, 2006 06:07 AM
How would I get the partitions back to normal? Obviously, the data is lost, but can I at least use the boot sectors made at the beggining to have only the 2 partitions? (The boot & os)

#

slight ommision

Posted by: Administrator on April 08, 2006 05:33 AM
Great instructions, two things that are missing though:

1) you must DISABLE selinux if you are using it, or mount the filesystem without selinux options (that means DISABLE not put in permissive)

2) you need to get the cvs version of make_fw as you need to use -g nano (I tried the other versions using -3 and this doesn't work at all)

#

2nd gen nano...

Posted by: Anonymous [ip: unknown] on September 19, 2007 12:45 PM
does this work on iPod nano the 2nd Generation? (full metal cover)
if I know well, iPod 1st gen has plastic forecover and metal backcover... mine has full-metal cover so that is a 2nd generation iPod nano...
I searched for weeks to find out how to install Linux on MY nano, but every release I tryed FAILED!
plz help me... how to...?:?:?:?:? :S
thx a lot!

#

Installing iPodLinux on the iPod Nano

Posted by: Anonymous [ip: 71.111.145.160] on December 14, 2007 01:49 PM
Hey - if you super glue two regular foam ear plugs (cut a hole in the middle of them) you get a very good pair of earphones that WILL NOT come out! The earphones glue to the buds and will give you very good sound. It even seems to have some base to it since it connects well to the inside of your ear - making your skull area around the ear a bass cannon...

#

Installing iPodLinux on the iPod Nano

Posted by: Anonymous [ip: 86.137.114.0] on December 17, 2007 07:14 PM
every time i try to install it it says not responding

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya