Manual Installation

From iPodLinux

Jump to: navigation, search

This page describes how to install iPodLinux manually on your iPod. The instructions are working on all iPods iPodLinux runs on, regardless of Generation or whether you have a WinPod or MacPod.

Please: Don't be scared because of all the text or the confusing looking commands. Most of the text is there to explain what those scary looking commands will do.

The installation process will take 2 to 15 minutes depending on how skilled you are with using the terminal (commandline).


WARNING: Many MacPod users have experienced a bug in the iPodLinux kernel. This bug leads to a kernel panic because it fails to mount the root filesystem (the HFS+ partition) due to the partition map that iTunes generates.

When you encounter this issue, you will see the boot message from iPodLinux:

"Unable to mount root fs on 03:03"

A few things have been found to bypass this problem:

  • One method using command newfs_hfs -v <label> <slice> was able to successfully create a correct partition. Providing your iPod is on disk1 and disk1s3 is the HFS partition that will not mount. You can use the following command to recreate the partition again:
 
# newfs_hfs -v Disk /dev/disk1s3

Warning: This is an equivalent of a formating the partition and all data on it will be lost. So backup first!

  • Another method is to repartition your iPod with the instructions for 5.5G MacPods below.
  • Yet another method is to back up your iPod's contents and then restore your iPod using the older Apple iPod Updater. This will generate a partition map that iPodLinux can work with.
  • Or try to convert the MacPod into a WinPod until the problem is solved. You can do that with using a Linux Live CD (as described below) and following the instructions for WinPod users.


Contents


Before you begin

Important Notes

  • It is necessary to have read and write permission on the raw block device files for the iPod (Firmware Partition and MBR). In general, this means you need to be root (the superuser / administrator).
  • You cannot use Windows for most of this guide. You have to use Linux. If you don't have Linux already installed on your PC, get a Linux live CD like Slax.
    A LiveCD is an operating system (in this case a Linux distribution) stored on a bootable CD-ROM that can be executed from it, without installation on a hard drive. The system returns to its previous OS when the LiveCD is ejected and the computer is rebooted. It does this by placing the files which typically would be stored on a hard drive, onto a ram disk. This however does cut down on the RAM available to applications which reduces performance somewhat. Live CDs do not allow editing of content, as you are not logged on as root (you are considered a user named after the version of Linux being run).
This works on any computer which is able to boot from a CD. It doesn't depend on the operating system you are using.
Downloads:
  • Slax (available in different languages)
  • Ubuntu
  • Knoppix (available in English and German)


Downloads

You will need the following files to perform the steps below.

Loader2

  • Latest Loader2 binary - This Loader works on all iPods except the Nano2G and newer iPods. It also includes the getLoader2Args binary.

ipodpatcher

Kernel

  • official kernel - Get the latest one.
    Note: Due to server issues the official kernels aren't available. Please use this one instead until the server is fixed.

Userland

Locating Your iPod

Using the ipodpatcher utility

Linux users may have to make ipodpatcher executable first (chmod +x ./ipodpatcher) (for more information: man chmod).

Linux / MacOSX: Type:

./ipodpatcher --scan

Windows: Type:

ipodpatcher --scan

Note 2: The ipodpatcher commands used here are the same on every OS. The only difference is that Windows-Users must remove "./" in front of each ipodpatcher command.

You will get the following output:

ipodpatcher v2.0 with v2.0 bootloaders - (C) Dave Chapman 2006-2007
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[INFO] Scanning disk devices...

The next line is important; it contains information about where your iPod is located!

Windows:

[INFO] Ipod found - Video (aka 5th Generation) - disk device 1

Linux:

[INFO] Ipod found - Video (aka 5th Generation) - /dev/sda

MacOSX:

[INFO] Ipod found - Video (aka 5th Generation) - /dev/disk1


The following example commands will use /dev/sd1 or /dev/disk1 as the device for the iPod; please replace this with the correct device for you configuration.

If you use the wrong device, you might accidentally write to your computer's hard drive! This actually happened to someone.


Note: If you are using MacOSX the iPod has to be unmounted (but not ejected) otherwise the --scan option will fail.


Mac OS X (if ipodpatcher fails)

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:

/dev/disk1s3 on /Volumes/DAVE_S IPOD 1 (local, nodev, nosuid)

In order to install the ipod bootloader, you need to "unmount" this disk using the following command:

# diskutil unmount /dev/disk1s3

replacing /dev/disk1s3 with the device name Mac OS X has assigned to your Ipod. This may take a few seconds, after which Mac OS X will say

Volume /dev/disk1s3 unmounted.

/dev/disk1s3 refers to the second partition on /dev/disk1 - remember /dev/disk1 for the next steps and replace /dev/diskX with it.

Note: 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.


Linux (if ipodpatcher fails)

Under Linux you should check the file "/proc/scsi/scsi" for an entry where the Vendor is "Apple" and the model is "iPod". For example:

# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: Apple Model: iPod Rev: 1.50
Type: Direct-Access ANSI SCSI revision: 02

The scsi0 portion indicates the iPod is the first SCSI device and so will be visible as /dev/sda; if on your system you see scsi1, your iPod would be using device /dev/sdb.


First Time

Backup

Since we will update the partition information stored in the MBR (Master Boot Record), which contains the partition table for the harddisk (WinPods only), and replace the firmware image, we will now make a backup of all important data.


Music and Other Stuff

If you have a MacPod a backup of all your data is not necessary (but recommended) but WinPod owners have to format the harddrive of their iPod, meaning that all of their music, videos and other files stored on their iPod will be lost! So make a backup first! A simple file copy operation will suffice. If you copy the entire iPod_Control directory to your PC and put it back after you are done with the installation, all your Music, Playcounts, Playlists etc. will be back and are safe.


Firmware Partition:

This is a complete backup of the firmware partition of the iPod and includes the original firmware (Apple iPod operating system). This file is usually 40MB (roughly 90MB to 125MB on the Video models) and can be compressed once the installation process is complete.

./ipodpatcher -r bootpartition.bin

This will create a file named bootpartition.bin in the current folder where ipodpatcher is in.

MBR (WinPods only):

It is not necessary to make a backup of the MBR, although it is recommended. If you make a mistake in partitioning, you can use this command to recover the MBR.

Linux:
 
# dd if=/dev/sdX of=ipod_mbr_backup bs=512 count=1
MacOSX:
 
# dd if=/dev/diskX of=ipod_mbr_backup bs=512 count=1

5.5G MacPod

Repartitioning the Hard Drive (WinPods only)

Now that the backups are done we will add a new partition to the iPod to hold the root file system for Linux. This is required on WinPods as Linux cannot use a FAT partition for its root file system.

You must use fdisk in Linux (instructions below) or another partition editing utility to ensure that the following criteria are met:

  • partition 1: the "firmware partition" (raw) must start on cylinder 1.
  • partition 3: the "iPodLinux partition" (ext2 or ext3) must physically start after the "firmware partition". Its size should be at least 32MB but can be larger to suit your needs.
  • partition 2: the "iTunes partition" (fat32) must physically start after Partition3 and can fill the remaining space on the disk. This partition holds your music/videos to be accessed by the regular AppleOS.


Partitioning instructions differ between 1G / 2G / 3G / 4G / Photo / Color / Mini1G / Mini2G and Nano1G / 5G / 5.5G. This is because the Nano and Video have a software suspend-to-disk feature that kicks in after 12 to 18 hours of inactivity, writing the contents of RAM to the firmware partition. We can't use that space for Linux like we can for the older generations, because this uses practically all the space in the firmware partition; if we did, we would see filesystem corruption whenever suspend-to-disk kicked in.

The alternative, however, requires us to delete and recreate the music partition with a smaller size, and put the Linux partition after it, at the end of the disk. This is not the best solution, mainly because you lose all the data on that partition.

Two example sessions are below.

Note: Things you should type look like this or this; placeholders you should replace with an actual value look like this, and output looks like this.

[*], [#] and [o] are values you should use which refer to values above, marked the same way.

Please note that you have to be root to do the following steps.


1G–4G, Mini1G/2G and Photo/Color


The following commands describe a session with fdisk that deletes the existing firmware partition and then creates a new, smaller, partition to hold the firmware. The additional space is then used to create a new partition which we format for use with Linux.

Note: the output displayed below is correct for a 20GB 3g iPod; some output will be different for different sized iPod's and different iPod generations. Your iPod has to be unmounted in order to successfully complete operation number 8, so unmount it before beginning to work on it.


Before you start make sure that the iPod's partitions are not mounted.

# umount /dev/sdX2

1. Start fdisk.

# fdisk /dev/sdX
The number of cylinders for this disk is set to 2431.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): 

2. Take a look at the partiton table.

Command (m for help): p

Disk /dev/sda: 64 heads, 32 sectors, 19073 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot    Start       End       Blocks   Id  System
/dev/sdX1   *         1        33 [#]    22544    0  Empty
/dev/sdX2   *        34     19073     19496960    b  Win95 FAT32
Now, you need to figure out how big to make your Linux partition. Partition sizes are measured in terms of cylinders, whose size is printed when you run the p command in fdisk. You might see something like the following, which would indicate 1MB cylinders.
Units = cylinders of 2048 * 512 = 1048576 bytes
In general, you want to make your Linux partition as big as you can without making the firmware one too small; generally the best results are achieved by splitting it roughly in half. Guidelines for specific iPod's follow:
  • For an iPod with a 33-cylinder firmware partition (all 1G and 2G iPod's and most 3Gs), try shrinking it to 10 cylinders and creating the Linux partition from 11 to 33.
  • For a 4G, Photo/Color, or any other iPod that has a 5-cylinder firmware partition, try keeping the firmware partition as 1–2 and making the Linux one from 3–5.
  • If your firmware partition is neither 33 nor 5 cylinders, try splitting it roughly in half; ask us if you have questions.
  • If your firmware partition is bigger than 100 cylinders, you've got the wrong disk! Leave fdisk without saving changes ("q" command) and try to locate your iPod again.


3. Delete the firmware partition.

Command (m for help): d
Partition number (1-4): 1

4. Recreate the firmware partition with a smaller size.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19073, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-33, default 33): use value you figured out above
                                                               in this example we would use 10

5. Activate the first partition.

Command (m for help): a
Partition number (1-4): 1

6. Set partition type to 'Empty'.

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 0 

7. Create the 3rd primary partition to fill the space you just freed up.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-19073, default 1): value you entered for last cylinder of partition 1, plus 1
                                     in this example 11
Last cylinder or +size or +sizeM or +sizeK (1-19073, default 33): Enter [#] (see above), regardless of the default

8. Review the changes.

Command (m for help): p

Disk /dev/sda: 64 heads, 32 sectors, 19073 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdX1   *         1        10     10224    0  Empty
/dev/sdX2   *        34     19073  19496960    b  Win95 FAT32
/dev/sdX3            11        33     23552   83  Linux

Partition table entries are not in disk order
Keep in mind that this is for a 20GB 3G iPod; for other iPod versions, cylinder numbers may vary.
  • Ensure that sda1 starts at cylinder 1.
  • The end cylinder of sda1 is one less than the start cylinder of sda3.
  • The end cylinder of sda3 is one less than the start cylinder of sda2.
  • Each partition has the same ID as the ones in this table. (0, b, and 83 respectively.)
  • Only the first two partitions are marked as bootable.
If it doesn't look right leave fdisk without saving changes ("q" command) and try again.

9. If everything looks OK, write out the partition table.

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Note: If re-reading the partition table fails, attempt
# sfdisk -R /dev/sdX
or eject and remount your iPod.
# eject /dev/sdX

10. Now continue with formatting the newly created Linux partition.


Nano, Video or Big Linux Partition


Remember, these instructions will cause all data on the iPod to be lost!

These instructions are applicable if you have a Nano or a Video iPod, or if you want a larger Linux partition on older iPod's. In this case, the amount of space to allocate is completely up to you. We will start by deleting the music partition and creating a smaller one in its place; then, we will make a new partition for iPodLinux that uses the now-freed space after the music partition.


Before you start make sure that the iPod's partitions are not mounted.

# umount /dev/sdX2

1. Start fdisk.

# fdisk /dev/sdX
 The number of cylinders for this disk is set to 7296.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

You can ignore this warning.

2. Check the current partition table.

Command (m for help): p

Disk /dev/sdX: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End         Blocks   Id  System
/dev/sdX1   *           1          14        112423+    0  Empty
/dev/sdX2   *          15 [*]    7296 [#]   58492665    b  W95 FAT32

This is what your partition table should look like now. The sizes may be different, though; these values are for a 60GB 5G.
Remember the value of Start for sdX2 ([*]) and the End too ([#])!

Now, you need to figure out how big to make your Linux partition. Partition sizes are measured in terms of cylinders, whose size is printed when you run the p command in fdisk. You might see something like the following, which would indicate 8MB cylinders.
Units = cylinders of 16065 * 512 = 8225280 bytes
On 5.5G iPod's you will see something like the following which would indicate 31,4MB cylinders.
Units = cylinders of 16065 * 2048 = 32901120 bytes
In general, you can make your Linux partition as big as you want. But 512MB sould be sufficent.
To get the amount of cylinders, that represents 512MB you have to multiply 512 two times by 1024 to convert MB in Byte. The result is 536870912Bytes. Now you divide this value by the cylinderssize in Bytes that you figured out above. So 536870912Bytes / 8225280Bytes = 65,27cylinders. Round the result up to 66cylinders.
Now subtract the result (66cylinders) from the total amount of cylinders available on your iPod ([#], in this example 7296). 7296 - 66 = 7230 Remember this value. It becomes the mark [o].

However, in this example a 2.26GB partition is created.

3. Delete the music partition.

Command (m for help): d
Partition number (1-4): 2

4. Create a new, smaller one in its place.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-7296, default 1): [*] see above
Last cylinder or +size or +sizeM or +sizeK (15-7296, default 7296): [o] see above 

5. Create the Linux partition.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-7296, default 1): [o] plus 1, see above
Last cylinder or +size or +sizeM or +sizeK (7001-7296, default 7296): Enter [#] (see above) regardless of the default

6. Mark the new music partition bootable.

Command (m for help): a
Partition number (1-4): 2

7. Change its type to the right one.

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): b
Changed system type of partition 2 to b (W95 FAT32)

8. Print out the partition table to verify that everything is OK.

Command (m for help): p

Disk /dev/sdX: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdX1   *           1          14      112423+   0  Empty
/dev/sdX2   *          15        7000    56115045    b  W95 FAT32
/dev/sdX3            7001        7296     2377620   83  Linux
Your partition table will not look exactly like this one. Things you should check at this point:
  • The end cylinder for sdX1 should be one less than the start cylinder for sdX2; the same should be true for the end cylinder of sdX2 and the start of sdX3.
  • Only the first two partitions are marked as bootable.
  • Your music partition (sdX2) is the size you want. (Look at the Blocks field; it's measured in kilobytes.)
  • Each partition has the same ID as the ones in this table. (0, b, and 83 respectively.)
If it doesn't look right leave fdisk without saving changes ("q" command) and try again.

9. Otherwise, write the new partition table; fdisk will exit.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Note: If re-reading the partition table fails, attempt
# sfdisk -R /dev/sdX
or eject and remount your iPod.
# eject /dev/sdX

10. Now continue with formatting the newly created Linux and Music partition.


Format the Partitions (WinPods only)

If you don't have a WinPod you can skip this step.

Format the Linux partition


Create the ext3 filesystem on your Linux partition:

# mkfs.ext3 /dev/sdX3
a bunch of output snipped...

Disable filesystem checks for the ext3 partition:

# tune2fs -c 0 /dev/sdX3
tune2fs 1.34 (25-Jul-2003)
Setting maximal mount count to -1


Format the Music partition


# mkfs.vfat -F 32 /dev/sdX2

If mkfs complains that /dev/sdX2 is mounted do:

# umount /dev/sdX2

If you get an error with mkfs.vfat

bash: mkfs.vfat: command not found 

try

# mkdosfs -F 32 /dev/sdX2

instead.


5.5G WinPod owners only

It seems that mkfs.vfat contains a bug (same belongs to mkdosfs since it is the same tool) which creates a broken FAT32 filesystem on harddrives with a sectorsize other then 512bytes. Since the 5.5G iPod has a sectorsize of 2048bytes you cannot use mkfs.vfat!.

If you still whish to try it out yourself, the command would be:

# mkfs.vfat -S 2048 -F 32 /dev/sdX2

However the linux kernel, the Apple Firmware, MacOSX, Linux and Windows aren't complaining about the filesystem being broken. The only issues you'll get is that recording in the Apple Firmware is broken and RockBox cannot handle the filesystem at all.

If you intend to use the recording feature of the Apple Firmware or want to install RockBox alongside with iPodLinux, then you have two choices on how to format the FAT32 partition instead of mksfs.vfat.


1. You can use mformat, which is part of the mtools package (how to compile). Before you're going to compile mtools yourself, check if it is already installed or if you can install it with the package manager of your linux distribution.

To make mformat work, you have to add the following line in /etc/mtools.conf

drive i: file="/dev/sdX2"

Then in the Terminal run:

# mformat -t [cylinders] -h 255 -s 63 -S 2048 -M 2048 -F i:

[cylinders]: Specifies the number of cylinders on the FAT32 partition. To get this value subtract the start cylinder of /dev/sdX2 from the end cylinder of /dev/sdX2. If you don't know these values anymore run

# sfdisk -l /dev/sdX

to print your iPod's partition table again.

If you receive this error while running mformat

arggsize must be less than 6

then run the following command instead:

# mformat -t [cylinders] -h 255 -s 63 -S 4 -M 2048 -F i:


2. If you are using Windows and a Live CD which lacks gcc for compiling mformat or a preinstalled mtools package or package manager that can install mtools, you can format the partition with Windows' formatter and return to the Live CD when you are finished with this step.

Please note that this doesn't work with 80GB iPod's because Windows cannot create FAT32 filesystems bigger than 32GB.

  • Go to Computer Management by right-clicking on My Computer and selecting Manage.
  • Select Disk Management under the node Storage in the panel on the left.
  • Right-click the FAT32 partition on your iPod's disk entry on the right and selecting Format.
  • Ensure the File System is FAT32 and the Allocation unit size is Default, you can also check Perform a quick format.
  • Select OK.


Repartitioning the Hard Drive (5.5G MacPods only)

If you don't have a 5.5G MacPod you can skip this step.

Warning: this will definitely wipe out everything, down to the partition map on block 1, so backup.

It's meant for 5.5G MacPods, but could also be applied to older generation MacPods.


First step is to use pdisk to get the current partitioning scheme of your MacPod. In Mac OS 10.5 (leopard) you open up a terminal and type the following:

# pdisk /dev/diskX


You will get a prompt like this:

Edit /dev/diskX -
Command (? for help):


Type 'p' and on a 30GB MacPod 5.5G you will get the following:

Edit /dev/diskX -
Command (? for help): p

Partition map (with 2048 byte blocks) on '/dev/diskX'
 #:                type name       length   base     ( size )
 1: Apple_partition_map Apple          62 @ 1       
 2:          Apple_MDFW firmware    81920 @ 63       (160.0M)
 3:           Apple_HFS disk     14569288 @ 81984    ( 27.8G)

Device block size=2048, Number of Blocks=14651280 (27.9G)
DeviceType=0x0, DeviceId=0x0

Command (? for help):
  • Copy and paste the partition map in a text editor, you will need this information later. You might notice that the length of Apple_partition_map is rather odd (normally it would be 63 blocks in length), this is what we want to correct.
  • Quit pedit (q)
  • Now unmount your iPod (on Mac use Disk Utilities, no amount of sudo-ing will let you unmount the drive).
  • We are going to wipe out everything on the hard drive, so again, make sure you have made a backup.

Type the following:

# sudo dd if=/dev/zero of=/dev/diskX

There is nothing verbose in this process so you'll have to time it. 4 minutes is plenty.

Next we partition it back to life:

# sudo pdisk /dev/diskX

Remember that table you copied? Now you have to recreate it (sans the odd partition map size). pdisk is somewhat similar to fdisk so there should be no problem in understanding what command does what, but in case you don't understand what the commands do, type '?' at pdisk's prompt.

First we have to initialize the disk (we just zeroed it out):

pdisk: No valid block 1 on '/dev/diskX'
Edit /dev/diskX -
Command (? for help): i
A physical block is 512 bytes: 2048
A logical block is 512 bytes: 2048
size of 'device' is 14651280 blocks (2048 byte blocks):
new size of 'device' is 14651280 blocks (2048 byte blocks)
Command (? for help): p
 
Partition map (with 2048 byte blocks) on '/dev/diskX'
 #:                type name     length   base     ( size )
 1: Apple_partition_map Apple        63 @ 1       
 2:          Apple_Free Extra  14651216 @ 64       ( 27.9G)

Device block size=2048, Number of Blocks=14651280 (27.9G)
DeviceType=0x0, DeviceId=0x0

The size of the blocks varies from iPod to iPod (or so I've read), luckily everything we need to know is in the old partition map.

Now we need to setup the last two remaining partitions. Please adjust the commands accordingly.


Firmware Partition:

Command (? for help): c
First block: 64
Length in blocks: 81920
Name of partition: firmware
Command (? for help): p

Partition map (with 2048 byte blocks) on '/dev/diskX'
 #:                type name       length   base     ( size )
 1: Apple_partition_map Apple          63 @ 1       
 2:           Apple_HFS firmware    81920 @ 64       (160.0M)
 3:          Apple_Free Extra    14569296 @ 81984    ( 27.8G)

Device block size=2048, Number of Blocks=14651280 (27.9G)
DeviceType=0x0, DeviceId=0x0

Command (? for help): t
Partition number: 2
Existing partition type ``Apple_HFS´´.
New type of partition: Apple_MDFW
Command (? for help): p

Partition map (with 2048 byte blocks) on '/dev/diskX'
 #:                type name       length   base     ( size )
 1: Apple_partition_map Apple          63 @ 1       
 2:          Apple_MDFW firmware    81920 @ 64       (160.0M)
 3:          Apple_Free Extra    14569296 @ 81984    ( 27.8G)

Device block size=2048, Number of Blocks=14651280 (27.9G)
DeviceType=0x0, DeviceId=0x0

Command (? for help):


Data Partition:

Command (? for help): c
First block: 81984
Length in blocks: 14569296
Name of partition: disk
Command (? for help): p

Partition map (with 2048 byte blocks) on '/dev/diskX'
 #:                type name       length   base     ( size )
 1: Apple_partition_map Apple          63 @ 1       
 2:          Apple_MDFW firmware    81920 @ 64       (160.0M)
 3:           Apple_HFS disk     14569296 @ 81984    ( 27.8G)

Device block size=2048, Number of Blocks=14651280 (27.9G)
DeviceType=0x0, DeviceId=0x0

Command (? for help):


At this point if your Partition Map looks okay than we can just type 'w' to write the changes and quit pdisk.

Now We have most of this fixed, now we have to write the firmware back to the iPod. I hope you made a backup of the firmware with ipodpatcher (if not, you can get it from here).

The next step is to restore the iPods firmware with dd:

# sudo dd if=bootpartition.bin of=/dev/diskXs2 

This takes some time. Mac OS might have mounted the iPod so you'll have to unmount it again. The next steps is to format the 'disk' partition with newfs.

# sudo newfs_hfs /dev/diskXs3

That should be it. Eject the iPod, let it restart and reconnect it to your Mac. If you want you can use iTunes to name it and reconfigure your settings (this won't affect anything low level).

Now you can proceed to the next step.


Recreating the Folder Structure on the FAT32 partition

If you don't have a WinPod you can skip this step.

You must recreate the folder structure of the FAT32 partition; otherwise the Apple firmware won't be able to save its settings. Note that if you made a backup of the whole drive earlier, you may just copy-and-paste it back and skip this step.

# mkdir /mnt/ipod1 (for the first time)
# mount -w /dev/sdX2 /mnt/ipod1
# cd /mnt/ipod1

# mkdir Calendars
# mkdir Contacts
# mkdir Notes
# mkdir iPod_Control
# cd iPod_Control
# mkdir Device
# mkdir iTunes
# mkdir Artwork
# mkdir Music

If iTunes gives you the error message "The iPod cannot be updated. The required file is locked.", make sure that the iPod_Control directory and all of its subdirectories are writeable.

First Time Installation or Updating an Existing Installation

The following steps apply to both user categories, those who are installing iPodLinux the first time and those who what to update certain parts of their already existing iPodLinux installation.

Installing/Updating the Bootloader

In order to make your iPod dualboot AppleOS and iPodLinux you have to install a bootloader called Loader 2. You can do this with the ipodpatcher utility.

ipodpatcher is a tool designed for installing the Rockbox bootloader on your iPod, but we can use it to install Loader 2 as well.

On Linux and MacOSX you have be root to use ipodpatcher or use the administrator account if you are doing this step on Windows.

Rename the loader binary to "loader.bin" and install the loader with the following command:

./ipodpatcher -ab loader.bin

Note: MacOSX users may have to unmount their iPod first. You can use diskutil unmount /dev/diskX to do this. If the last thing ipodpatcher tells you is still [INFO] /dev/disk1: Resource busy, try unmounting by opening the application Disk Utility in /Applications/Utilities, selecting the iPod volume at the left, and clicking the Unmount button in the toolbar, and then running ipodpatcher again.

Note: Windows users should run ipodpatcher -ab loader.bin instead.

Installing/Updating the Userland

A userland provides the folders the Kernel needs to find, configuration files and standard commandline tools. The version of the Userland you are going to install now doesn't contain the getLoader2Args binary but the startup script /etc/rc already has the ability to use it once it is installed.


WinPod:

 

First create a folder where you want to mount your iPod's ext3 partition.

# mkdir /mnt/ipod (for the first time)

Mount your iPod's ext3 partition

# mount -w /dev/sdX3 /mnt/ipod

Change the directoy to your iPod's ext3 partition

# cd /mnt/ipod

Extract the Userland to your iPod's ext3 partition

# tar xvzf /<path_to>/Ipod_fs_220606.tar.gz

MacPod:

 

To install the Userland, extract it to the root of your iPod. If you prefer using the terminal to install the Userland, do the following:

# cd /Volumes/<Your_iPod>/
# tar xvzf /<path_to>/Ipod_fs_220606.tar.gz


Note: If you get errors about old timestamps, you can ignore them.

Now copy the getLoader2Args binary which you downloaded together with Loader 2 to /mnt/ipod/bin/ (Linux) or /Volumes/<Your_iPod>/bin/ (MacOSX) and make it executable (chmod +x).


Installing/Updating the Kernel

WinPod

Rename the Kernel to linux.bin and place it in the root of your ext3 partition or fat32 partition (whatever you prefer).

MacPod

Rename the kernel to linux.bin and place it in the root of your HFS+ partition.


Installing/Updating podzilla2 + Modules

Official instructions:

Follow the steps on the podzilla page.

Quick instructions:

  • Copy the podzilla binary to /mnt/ipod/bin/
  • Copy the modules (directories with files in them called Module and *.mod.o) to /mnt/ipod/usr/lib/.
  • Copy the appearances (directories named fonts and schemes) to /mnt/ipod/usr/share/
  • Create the directory /mnt/ipod/etc/podzilla, if it does not exist.
  • Make podzilla executable:
 
# chmod +x /mnt/ipod/bin/podzilla


Congratulations! You have successfully installed all official iPodLinux components. Should you ever want to remove iPodLinux, follow the steps below.

Restoring the iPod (Removing iPodLinux)

MBR

Linux:

# dd if=ipod_mbr_backup of=/dev/sdX

MacOSX:

# diskutil unmount /dev/diskX
# dd if=ipod_mbr_backup of=/dev/diskX'

You might have to format the Music partition afterwards if you have created a bigger Linux partition with shrinking the Music partition.


Firmware

Put the previously backed up firmware back to your iPod.

# ./ipodpatcher -w bootpartition.bin

ipodpatcher is also able to delete the bootloader.

# ./ipodpatcher -d

Note: MacOSX users may have to unmount their iPod first (diskutil unmount /dev/diskX).

If, for whatever reason, you don't have the backup of the Apple firmware, use the Restore feature in iTunes or restore your iPod manually.


Support for Manual Installation

You may ask questions on the discussion page of this topic or the forums.


Additional Modifications

If you think that installing iPodLinux manually was too easy for you check out the this page for more commandline actions.