Installation / Removal > Apple - Installation/Removal

HowTo: Install Rockbox on a fresh drive without iTunes (5.5g)


A while ago I had to replace my (5.5th gen) iPod's hard drive and was disgusted when I realized that I had to use iTunes for that. So when I had a bit of spare time I set out to try and find a way to do so without using iTunes (or any other non-free software). In case anyone cares, here's how I did it:

Basically, we need four (4) things:

* Linux (full install, VM, or live CD)
* A partition table
* Firmware (Rockbox) on the first partition
* Music on the second partition (or just Doom)
I'll assume that the storage media (hard drive, sd card or whatever) is installed in the iPod and the iPod is connected to the PC via USB (in "disk mode", hold SELECT and PLAY which powering up). I'll be using /dev/sdX for all examples, that way you shouldn't break anything if you just lazily copy & paste my commands.

I'll also assume that you've already compiled Rockbox and all its tools (including ipodpatcher and ipod_fw).

The partition table

This part is fairly straight-forward: we need two partitions. One for the firmware images, and one for the music. Rockbox supports several ways to be installed on the iPod. Since I don't care about other OS' and I don't mind a little extra work when updating Rockbox, I chose the "OSOS contains only Rockbox" way, i.e. the firmware partition only contains the Rockbox image. Also, it boots faster than all the other methods, so that's a good thing.

That said, my rockbox.bin image is about 800 kB so I'll create a 2 MB partition for it (that way we are safe even if future Rockbox images get a little larger -- compared to the 80 MB that Apple uses for this partition we are still pretty efficient).

Here's where things get a little hairy: I have two "identical" 5.5th gen iPods (same model number etc.) but they use different sector sizes on the disk. One uses 512 Bytes per sector, the other one uses 2048 Bytes. The partition table differs slightly so we should know which model we are dealing with.

Luckily, Rockbox has a tool for that. Use
--- Code: ---ipodpatcher -l
--- End code ---
and you will get something like this for the 512 Bytes model:

--- Code: ---[INFO] Scanning disk devices...
[INFO] Read XML info (9692 bytes)
[INFO] Ipod found - Photo/Color ("winpod") - /dev/sdc
[INFO] Reading partition table from /dev/sdc
[INFO] Sector size is 512 bytes

--- End code ---

Or, for the one with 2048 bytes:

--- Code: ---[INFO] Sector size is 2048 bytes

--- End code ---

So now we can create our partition table. They are almost identical for both models, except that one the 512 Bytes model, we need 4096 sectors for our 2 MB partition (4096 * 512 B = 2 KB) whereas the 2048 Bytes iPod only needs 1024 sectors (1024 * 2048 Bytes = 2 MB).

Thus we get the following partition table for the 512 Bytes model

--- Code: ---label: dos
unit: sectors
start=63, size=4096, type=0
start=4159, type=b

--- End code ---

Or, for the one with 2048 Bytes:

--- Code: ---label: dos
unit: sectors
start=63, size=1024, type=0
start=1087, type=b

--- End code ---

Copy these instruction to a file (eg. /tmp/ipod.script) and load it:

--- Code: ---sfdisk /dev/sdX < /tmp/ipod.script
--- End code ---

Confirm that the partition table has successfully been adjusted using
--- Code: ---fdisk -l /dev/sdX
--- End code ---


Now for the tricky part. In theory it's quite simple: just put the rockbox binary in the first partition and that's it. Unfortunately, the 5.5th gen iPod needs a second firmware image, too. Luckily, Rockbox knows how to generate that one, too, and we can use it. Unfortunately, we need two different tools and little bit of glue to generate the full image for our firmware partition.

Anyway, this is what we do: first we use scramble to generate an image for us. The image that it generates won't work on our iPod, but it does contain the aforementioned second image that we need. This is how we generate the image:

--- Code: ---../tools/scramble -ipod5g rockbox.bin temp.img
--- End code ---

The image is a little bit too short, so we'll need to append a few zeros to it:

--- Code: ---dd if=/dev/zero of=temp.img oflag=append conv=notrunc bs=1024 count=1
--- End code ---

Now we can extract the second image:

--- Code: ---../tools/ipod_fw -o apple_sw_5g_rcsc.bin -e 1 temp.img
--- End code ---

The name of the image ("apple_sw_5g_rcsc.bin") is a bit silly but it's hard-coded in another tool so we'll just use that.

Now that we have both images required for the iPod to boot (rockbox.bin and apple_sw_5g_rcsc.bin), we can use the ipod_fw tool to generate a firmware image from them. This step again depends on the iPod's sector size.

For iPods with 512 Bytes per sector, we use:

--- Code: ---../tools/ipod_fw -g 5g -o firmware.bin -l rockbox.bin -n -r 0xb000
--- End code ---

Or, with 2048 Bytes per sector:

--- Code: ---../tools/ipod_fw -s 2048 -g 5g -o firmware.bin -l rockbox.bin -n -r 0xb000
--- End code ---

Now we can write the image to the iPod:

--- Code: ---dd if=firmware.bin of=/dev/sdX1 bs=512
--- End code ---

And that's pretty much it. The iPod is almost ready now.

Data partition

I'm not sure whether this is really needed, but I suppose it can't hurt: When creating the file system for the data partition, we can again specify the size of our sectors. For 512 Bytes, use:

--- Code: ---mkfs.vfat -F 32 /dev/sdX2
--- End code ---

Or, for 2048 Bytes:

--- Code: ---mkfs.vfat -F 32 /dev/sdX2 -S 2048
--- End code ---

Then don't forget to add the Rockbox data files:

--- Code: ---mount /dev/sdX2 /mnt/ipod
tar --no-same-owner -C /mnt/ipod/ -xf rockbox.tar
umount /mnt/ipod

--- End code ---

Et voilĂ , your iPod should be ready.

Thank you so much for this post.

I ended up resorting to using iTunes in an XP VM with usb redirection and offline restore with "iPod_24.1.1.2.ipsw" for the many times I needed to do this in the past.

It's been a while since I've had to do this but I'll give your instructions a shot next time!

Keep me posted, I'd be interested to know if this works for you.

The process described here will not restore your Apple firmware, you will need to use iTunes for that.


[0] Message Index

Go to full version