Installation from Linux Hfsplus

From wikiPodLinux

Table of contents

Outdated!

This article is a bit outdated. See the Installation page for up-to-date information.

Overview

This section of the guide explains howto use a mac formatted (hfs+) ipod on Linux. This is much nicer as IPL and the music are on the same partition and I enjoy much more reliable transfer speeds. Formerly, there was issues on recreating partitions, running fsck and even mounting the hfsplus partitions on linux. This has all been resolved now with the addition of packages ported from OSX and its x86 variant to linux.

Right now the only IPL issue with mac formatted ipods is the lack of a driver for ipodloader2, so if you have a 5g I would not do this unless you intend to use Apple's OS only.

Limitations of Linux's Hfsplus driver

The linux hfsplus driver can read and write just fine, and is good for normal use, however it should be noted that it will mount read-only if the filesystem contains journaling or case-support. Both of which are not fully supported by the linux driver, and without a patch will cause it to mount read-only for safety. I recommend reformatting the ipod without journaling support so that this does not happen.

Check the gentoo hfsplus wiki (http://gentoo-wiki.com/HOWTO_hfsplus) for updates to hfsplus kernel or filesystem tools as it is the source of this some of this information.

Acquiring Filesystem Tools

Up until fairly recently, Linux had no means of creating or fsck'ing a hfsplus filesystem. These tools are included in OSX and were ported directly to Linux. Two versions of these tools can be fetched and built. The first is most likely the most stable for now, as it has the most testing. The second I am including because it will more then likely be the one of choice soon as it came from OSX x86. Gentoo users may visit this bug entry for a ebuild for their overlay: http://bugs.gentoo.org/show_bug.cgi?id=46342.

Current x86/PPC Linux port from OS X 10.4.3 / Darwin 8.3

wget http://darwinsource.opendarwin.org/tarballs/apsl/diskdev_cmds-332.11.tar.gz
wget http://dev.gentoo.org/~josejx/diskdev_cmds-332.11.patch.bz2
tar zxf diskdev_cmds-332.11.tar.gz
bunzip2 -c diskdev_cmds-332.11.patch.bz2 | patch -p0
cd diskdev_cmds-332.11
make -f Makefile.lnx
cp newfs_hfs.tproj/newfs_hfs /sbin/mkfs.hfsplus
cp fsck_hfs.tproj/fsck_hfs /sbin/fsck.hfsplus
cd /sbin
ln -s mkfs.hfsplus mkfs.hfs
ln -s fsck.hfsplus fsck.hfs

Experimental x86/PPC Linux port from OS X 10.4.5 / Darwin 8.5(x86)

This is a port from the recently released x86 Darwin kernel and has limited testing!!!

wget http://darwinsource.opendarwin.org/tarballs/apsl/diskdev_cmds-332.14.tar.gz
wget http://www.ecl.udel.edu/~mcgee/diskdev_cmds/diskdev_cmds-332.14.patch.bz2
tar zxf diskdev_cmds-332.14.tar.gz
bunzip2 -c diskdev_cmds-332.14.patch.bz2 | patch -p0
cd diskdev_cmds-332.14
make -f Makefile.lnx
cp newfs_hfs.tproj/newfs_hfs /sbin/mkfs.hfsplus
cp fsck_hfs.tproj/fsck_hfs /sbin/fsck.hfsplus
cd /sbin
ln -s mkfs.hfsplus mkfs.hfs
ln -s fsck.hfsplus fsck.hfs

Kernel Setup

Since there are two options in particular that are a little oddball, this section will be here to make sure Linux can read the ipod as mac-formatted stuff tends to be used less then windows-formatted stuff. I'm going to assume you have all the USB support, its the same as you need for the FAT install. The two other things you need are mac partition support and hfsplus support of course.

In make menuconfig, goto File Systems, both options are in here.

From here, go into Miscellaneous Filesystems, and enable this option as follows:

 │ │ <*> Apple Extended HFS file system support                          │ │


Back out to File Systems and go into Partition Types. Select the following:

 │ │ [*] Advanced partition selection                                    │ │
 │ │ [ ]   Acorn partition support                                       │ │
 │ │ [ ]   Alpha OSF partition support                                   │ │
 │ │ [ ]   Amiga partition table support                                 │ │
 │ │ [ ]   Atari partition table support                                 │ │
 │ │ [*]   Macintosh partition map support                               │ │
 │ │ [*]   PC BIOS (MSDOS partition tables) support                      │ │

That should be all, recompile and reboot with it.

Locating Your Ipod

Same old for the most part, Use dmesg though, it'll show the partitions it recognized. Look near the bottom right after you plug the ipod in So as root:

# dmesg
SCSI device sdb: 39063023 512-byte hdwr sectors (20000 MB)
sdb: Write Protect is off
sdb: Mode Sense: 64 00 00 08
sdb: assuming drive cache: write through
sdb: [mac] sdb1 sdb2 sdb3

Notice the last line. It should be like that, if there is just a sdb, you don't have mac partition support. sdb1 is the partition map, sdb2 is the firmware partition, and sdb3 is the main partition. The device might be something different (sda, sdc, etc.) thats ok.

Backup

I used to suggest a full drive image, but that was in the days before the OSX tools were ported to linux. Things are much safer now, although I still recommend that you backup the partition map and the firmware image.

1. Backup the partition map

# dd if=/dev/sda1 of=partition_map

2. Backup the firmware partition

# dd if=/dev/sda2 of=firmware_backup

Restoring

Restoring the partition map and firmware is easy, just reverse the process.

1. Restore the partition map

# dd if=partition_map of=/dev/sda1

2. Restore the firmware partition

# dd if=firmware_backup of=/dev/sda2

Partitioning

Under normal use this shouldn't be necessary. Otherwise, this section will be included soon.


Formatting

The iPod should be formatted with mkfs.hfsplus before use because doing so will remove the journaling which causes the linux driver some problems.

1. Backup your partition (optional, if you have the diskspace)

# mount -t hfsplus /dev/sda3 /mnt/ipod
# 'cd /mnt/ipod
# tar -cpf ~/backup.tar *
# cd ~
# umount /mnt/ipod

2. Format the partition and name it iPod.

# mkfs.hfsplus -v iPod /dev/sda3

3. If you made a backup, restore your files.

# mount -t hfsplus /dev/sda3```
# cd /mnt/ipod
# tar -xpf ~/backup.tar
# cd ~
# umount /mnt/ipod

(Or, If you have access to a mac you can run the command diskutil disableJournal /dev/diskXs3 to disable the journal without data loss, you can use diskutil list if you need to find what device your ipod is located on)

Kernel And Userland Installation

Consult the normal Linux install guide. The only differences are you mount this as hfsplus, not vfat or ext2. Firmware gets directed to sdb2 NOT 1. You can mount and unpack the userland right to the third partition. Don't touch the first partition, ever.. you will need to restore if you do. Come back and read the end of this guide after you're done unpacking the userland.. there are a few differences.

Finishing Up

Congratulations if you made it this far, lets see what this thing can do!

1. Eject your iPod. The following command will unload the firewire driver for your iPod. Once unloaded your iPod will either reboot automatically or display the "OK to disconnect." message.

# modprobe -r sbp2

2. Reboot your iPod. If the iPod did not automatically reboot hold down the menu and the play/pause buttons for 3 seconds to reboot it.

Your iPod will automatically start the default os you specified above. You should see the Tux logo and then the default os should start.

After a reboot, if you want boot into the other os, hold down the rewind button when the Apple logo appears.

Closing

Everything else is pretty much the same as the regular linux guide.

Links

http://gentoo-wiki.com/HOWTO_hfsplus

Personal tools