2006-08-14 14:50:32

zoomj ipod

I just got my ipod working under linux. It was less than trivially easy.

First I had to get a firewire card. This was surprisingly easy. And then all I had to do was plug the ipod in and Linux automagically recognized it and mounted the file system.

Ha ha ha. Just kidding. This is what it did after I plugged it in.
[root@aluminum uqm-0.5.0]# dmesg -c
ieee1394: Node changed: 0-00:1023 -> 0-01:1023
ieee1394: Node changed: 0-01:1023 -> 0-00:1023
ieee1394: Node changed: 0-00:1023 -> 0-01:1023
ieee1394: Node changed: 0-01:1023 -> 0-00:1023
ieee1394: Error parsing configrom for node 0-00:1023
ieee1394: Error parsing configrom for node 0-01:1023
ieee1394: The root node is not cycle master capable; selecting a new root node and resetting...
ieee1394: Node resumed: ID:BUS[0-00:1023] GUID[000a270002012f83]
ieee1394: Node changed: 0-00:1023 -> 0-01:1023
scsi7 : SCSI emulation for IEEE-1394 SBP-2 Devices
ieee1394: sbp2: Logged into SBP-2 device
ieee1394: Node 0-00:1023: Max speed [S400] - Max payload [2048]
Vendor: Apple Model: iPod Rev: 1.30
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sdc: 9780750 512-byte hdwr sectors (5008 MB)
sdc: test WP failed, assume Write Enabled
sdc: asking for cache data failed
sdc: assuming drive cache: write through
SCSI device sdc: 9780750 512-byte hdwr sectors (5008 MB)
sdc: test WP failed, assume Write Enabled
sdc: asking for cache data failed
sdc: assuming drive cache: write through
sdc: [mac] sdc1 sdc2 sdc3
Attached scsi removable disk sdc at scsi7, channel 0, id 0, lun 0
HFS+-fs warning: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.
SELinux: initialized (dev sdc3, type hfsplus), not configured for labeling

So I could see all the files, and listen to stuff, but I couldn't delete anything, or add any music.

But hey! What about fsck.hfsplus?
[root@aluminum uqm-0.5.0]# fsck.hfsplus /dev/sdc3
bash: fsck.hfsplus: command not found

Fuck!

So I get online and grab fsck.hfsplus. The problem is that it's a Darwin native app, so it's little-endian. Linux can't run little-endian code, so you have to apply a patch.
[bbot@aluminum uqm-0.5.0]$ cd /media/usbdisk1
[bbot@aluminum usbdisk1]$ ls
4chan hokuto~ mIRC
Archive HOWTO_hfsplus_files New Folder
diskdev_cmds-332.11.patch.bz2 HOWTO_hfsplus.htm Untitled.txt
diskdev_cmds-332.11.tar.gz imprints (another copy).html~ Untitled.txt~
diskdev_cmds.diff.gz imprints (copy).html~
hfsplus-patch-20020606.htm japan photos

[bbot@aluminum usbdisk1]$ tar zxf diskdev_cmds-332.11.tar.gz
[bbot@aluminum usbdisk1]$ bunzip2 -c diskdev_cmds-332.11.patch.bz2 | patch -p0

(a few hundred lines of patcher messages.)

[bbot@aluminum usbdisk1]$ cd diskdev_cmds-332.11
[bbot@aluminum diskdev_cmds-332.11]$ make -f Makefile.lnx

(a few hundred lines of complier messages.)

[bbot@aluminum diskdev_cmds-332.11]$ cp newfs_hfs.tproj/newfs_hfs /sbin/mkfs.hfsplus
cp: cannot create regular file `/sbin/mkfs.hfsplus': Permission denied
[bbot@aluminum diskdev_cmds-332.11]$ su
Password:
[root@aluminum diskdev_cmds-332.11]# cp newfs_hfs.tproj/newfs_hfs /sbin/mkfs.hfsplus
[root@aluminum diskdev_cmds-332.11]# cp fsck_hfs.tproj/fsck_hfs /sbin/fsck.hfsplus
[root@aluminum diskdev_cmds-332.11]# cd /sbin
[root@aluminum sbin]# ln -s mkfs.hfsplus mkfs.hfs
[root@aluminum sbin]# ln -s fsck.hfsplus fsck.hfs

Victory!
[root@aluminum sbin]# ./fsck.hfsplus /dev/sdc3
** /dev/sdc3
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 3)
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
Master Directory Block needs minor repair
** Repairing volume.
** Rechecking volume.
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 3)
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 3)
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 3)
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** The volume iPod could not be repaired after 3 attempts.

Shit!
[root@aluminum sbin]# ./fsck.hfsplus -q /dev/sdc3
** /dev/sdc3
QUICKCHECK ONLY; FILESYSTEM CLEAN

And sure enough, dmesg wasn't showing the error message anymore.

Now I installed the linux equivilent of iTunes. Which worked beautifully!

Ha ha ha.
[root@aluminum uqm-0.5.0]# gtkpod
gtkpod: error while loading shared libraries: libgpod.so.0: cannot open shared object file: No such file or directory

So I had to export the enviromental varible, so gtkpod could find itself.
[root@aluminum uqm-0.5.0]# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
[root@aluminum uqm-0.5.0]# export LD_LIBRARY_PATH
[root@aluminum uqm-0.5.0]# gtkpod

Ta dah. From there on out it actually worked.

The moral? Linux is only free if your time has no value.

But this would have been a lot harder a few years ago. My firewire card Just Worked, and the ipod initialized automatically.
But if I had a mac, I could have just plugged it in.

Posted by | Permanent link | File under: Linux