# 2.6 6kernel + iPod

## morsatrit

Hope everyone had a happy holidays!!!

After scouring the forums and google for hours, I'm beginning to wonder does the iPod( 3rd Gen) work under the 2.6.0 kernel? Everywhere I read talks about 2.4.xx kernels etc. Has anyone been able to get their iPod working under 2.6? If so what steps did you take in order to get it working??? ( kernel configs, mounting sequences, etc ).  I cant figure out what im doing wrong and would love to get some tunes on my pod!!! Oh by the way.. Im using a firewire version on my laptop. 

--Mors--

----------

## xr31Daisy

Xmas gift ? groovy.

I've got a 3rd Gen iPod, a 2.6 kernel, and everythings working fine. I first installed it using a 2.4 kernel, and didn't do anything special the day I switched to 2.6.

Here are some bits of my kernel config

```
# SCSI device support

#

CONFIG_SCSI=y

# CONFIG_SCSI_PROC_FS is not set

...

#

# IEEE 1394 (FireWire) support (EXPERIMENTAL)

#

CONFIG_IEEE1394=y

#

# Subsystem Options

#

# CONFIG_IEEE1394_VERBOSEDEBUG is not set

# CONFIG_IEEE1394_OUI_DB is not set

#

# Device Drivers

#

#

# Texas Instruments PCILynx requires I2C bit-banging

#

CONFIG_IEEE1394_OHCI1394=y

#

# Protocol Drivers

#

# CONFIG_IEEE1394_VIDEO1394 is not set

CONFIG_IEEE1394_SBP2=m

# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set

#

# DOS/FAT/NT Filesystems

#

CONFIG_FAT_FS=y

# CONFIG_MSDOS_FS is not set

CONFIG_VFAT_FS=y

# CONFIG_NTFS_FS is not set

```

To sum it up, I've activated firewire, sbp2 ( as a module, this is important), SCSI, and VFAT.

I've also emerged hotplug.

Step 1: Plug the iPod in. The sbp2 module gets loaded, and a corresponding scsi device is created.

Step 2 : Mounting the filesystem (mount /mnt/ipod) Here's the fstab line.

```
I /dev/sda2               /mnt/ipod       vfat            rw,user,noauto,noatime,shortname=winnt 0 0
```

Step 3 : Do whatever I need to do on the iPod ( I'm using gktpod to get my Tunes on it )

Step 4 : unmount the iPod. But at this time, the iPod still displays the 'do not disconnect' logo.

Step 5 : unload the sbp2 module. ( and now, the 'do not disconnect' logo disappears )

Step 6 : disconnect the iPod.

Now, I must admit I've been having some troubles at first. So I tried to see if everything was working fine by pluging the device to a windows box, with the software provided by Apple. And it looked like it's been doing some sort of initialisation sequence, maybe configuring the iPod for VFAT use ?

Maybe you could try to make it work on a windows box first ?

----------

## morsatrit

Ok that was rock solid response!! Thx so much.. Ok so i did all that, I can get the ipod to display the "do not disconnect" but when i try to mount it, it says it doesn't doesn't like the filesystem. So do you think it would be safe to assume that it isn't configured for Vfat? And that when i finally get back to a windows box with firewire that Ill have to format it ?  Does anyone know anything about hfsplus support under linux? I believe that is the other FS that the ipod supports.

Thanks again for that great response. Very clear and to the point!! 

--Mors--

----------

## The Mountain Man

Unless you can get Linux to recoginze the native Apple filesystem, you'll have to format your iPod in FAT32.  The easiest way to do this is plug your iPod into a Windows box and run Apple's iPod updater software (you'll have to do this on a Win2k or XP box as Apple, in their wisdom, won't allow the software to run on any other versions of Windows even though older version are perfectly capable of running the software.  Check here for information on how to do it in Win98SE).  It is also possible to create a WiniPod purely in Linux, but I'm not exactly sure how.  Run a Google search for it.

As for hooking mine up to Linux, I compiled ohci1394, ieee1394, and sbp2 as modules.  ohci1394 and ieee1394 are loaded at boot time and sbp2 is loaded when I plug in my iPod.  After unmounting my iPod, I have to "rmmod sbp2" before I get the "O.K. to disconnect" message.

Also, you might have to run the following script to get your iPod to be recognized:

```
#!/bin/bash

# Skript to rescan SCSI bus, using the 

# scsi add-single-device mechanism

# (w) 1998-03-19 Kurt Garloff <kurt@garloff.de> (c) GNU GPL

# (w) 2003-07-16 Kurt Garloff <garloff@suse.de> (c) GNU GPL

# $Id: rescan-scsi-bus.sh,v 1.11 2003/10/24 21:15:22 garloff Exp $

setcolor ()

{

  red="\e[0;31m"

  green="\e[0;32m"

  yellow="\e[0;33m"

  norm="\e[0;0m"

}

unsetcolor () 

{

  red=""; green=""

  yellow=""; norm=""

}

# Return hosts. /proc/scsi/HOSTADAPTER/? must exist

findhosts ()

{

  hosts=

  for driverdir in /proc/scsi/*; do

    driver=${driverdir#/proc/scsi/}

    [ $driver = scsi -o $driver = sg -o $driver = dummy ] && continue

    for hostdir in $driverdir/*; do

      name=${hostdir#/proc/scsi/*/}

      [ $name = add_map -o $name = map -o $name = mod_parm ] && continue

      num=$name

      driverinfo=$driver

      if [ -r $hostdir/status ]; then

   num=$(printf '%d\n' `sed -n 's/SCSI host number://p' $hostdir/status`)

   driverinfo="$driver:$name"

      fi

      hosts="$hosts $num"

      echo "Host adapter $num ($driverinfo) found."

    done

  done

}

# Test if SCSI device $host $channen $id $lun exists

# Outputs description from /proc/scsi/scsi, returns new

testexist ()

{

  grepstr="scsi$host Channel: 0*$channel Id: 0*$id Lun: 0*$lun"

  new=`cat /proc/scsi/scsi | grep -e"$grepstr"`

  if test ! -z "$new"; then

    cat /proc/scsi/scsi | grep -e"$grepstr"

    cat /proc/scsi/scsi | grep -A2 -e"$grepstr" | tail -n2 | pr -o4 -l1

  fi

}

# Perform search (scan $host)

dosearch ()

{

  for channel in $channelsearch; do

    for id in $idsearch; do

      for lun in $lunsearch; do

        new=

   devnr="$host $channel $id $lun"

   echo "Scanning for device $devnr ..."

   printf "${yellow}OLD: $norm"

   testexist

   if test ! -z "$remove" -a ! -z "$new"; then

     # Device exists and we're in remove mode, so remove and readd

     echo "scsi remove-single-device $devnr" >/proc/scsi/scsi

     echo "scsi add-single-device $devnr" >/proc/scsi/scsi

     printf "\r\x1b[A\x1b[A\x1b[A${yellow}OLD: $norm"

     testexist

     if test -z "$new"; then 

       printf "\r${red}DEL: $norm\r\n\n\n\n"; let rmvd+=1; 

          fi

   fi

   if test -z "$new"; then

     # Device does not exist, try to add

     printf "\r${green}NEW: $norm"

     echo "scsi add-single-device $devnr" >/proc/scsi/scsi

     testexist

     if test -z "$new"; then

       # Device not present

       printf "\r\x1b[A";

         # Optimization: if lun==0, stop here (only if in non-remove mode)

       if test $lun = 0 -a -z "$remove" -a $optscan = 1; then 

         break;

       fi  

     else 

       let found+=1; 

     fi

   fi

      done

    done

  done

}

 

# main

if test @$1 = @--help -o @$1 = @-h -o @$1 = @-?; then

    echo "Usage: rescan-scsi-bus.sh [options] [host [host ...]]"

    echo "Options:"

    echo " -l activates scanning for LUNs 0-7    [default: 0]"

    echo " -w scan for target device IDs 0 .. 15 [default: 0-7]"

    echo " -c enables scanning of channels 0 1   [default: 0]"

    echo " -r enables removing of devices        [default: disabled]"

    echo "--remove:        same as -r"

    echo "--nooptscan:     don't stop looking for LUNs is 0 is not found"

    echo "--color:         use coloured prefixes OLD/NEW/DEL"

    echo "--hosts=LIST:    Scan only host(s) in LIST"

    echo "--channels=LIST: Scan only channel(s) in LIST"

    echo "--ids=LIST:      Scan only target ID(s) in LIST"

    echo "--luns=LIST:     Scan only lun(s) in LIST"  

    echo " Host numbers may thus be specified either directly on cmd line (deprecated) or"

    echo " or with the --hosts=LIST parameter (recommended)."

    echo "LIST: A[-B][,C[-D]]... is a comma separated list of single values and ranges"

    echo " (No spaces allowed.)"

    exit 0

fi

expandlist ()

{

    list=$1

    result=""

    first=${list%%,*}

    rest=${list#*,}

    while test ! -z "$first"; do 

   beg=${first%%-*};

   if test "$beg" = "$first"; then

       result="$result $beg";

       else

           end=${first#*-}

       result="$result `seq $beg $end`"

   fi

   test "$rest" = "$first" && rest=""

   first=${rest%%,*}

   rest=${rest#*,}

    done

    echo $result

}

# defaults

unsetcolor

lunsearch="0"

idsearch=`seq 0 7`

channelsearch="0"

remove=""

optscan=1

findhosts;

# Scan options

opt="$1"

while test ! -z "$opt" -a -z "${opt##-*}"; do

  opt=${opt#-}

  case "$opt" in

    l) lunsearch=`seq 0 7` ;;

    w) idsearch=`seq 0 15` ;;

    c) channelsearch="0 1" ;;

    r) remove=1 ;;

    -remove)      remove=1 ;;

    -hosts=*)     arg=${opt#-hosts=};   hosts=`expandlist $arg` ;;

    -channels=*)  arg=${opt#-channels=};channelsearch=`expandlist $arg` ;; 

    -ids=*)   arg=${opt#-ids=};         idsearch=`expandlist $arg` ;; 

    -luns=*)  arg=${opt#-luns=};        lunsearch=`expandlist $arg` ;; 

    -color) setcolor ;;

    -nooptscan) optscan=0 ;;

    *) echo "Unknown option -$opt !" ;;

  esac

  shift

  opt="$1"

done    

# Hosts given ?

if test @$1 != @; then 

  hosts=$*; 

fi

echo "Scanning hosts $hosts channels $channelsearch for "

echo " SCSI target IDs " $idsearch ", LUNs " $lunsearch

test -z "$remove" || echo " and remove devices that have disappeared"

declare -i found=0

declare -i rmvd=0

for host in $hosts; do 

  dosearch; 

done

echo "$found new device(s) found.               "

echo "$rmvd device(s) removed.                 "
```

Just copy and past it and save it as "rescan-scsi-bus.sh".  This will rescan your SCSI bus for any new devices that may have been connected.  Sometimes I have to run this to kickstart my Linux box into recognizing my iPod and other times I don't.  (Perhaps that's why firewire support is listed as "EXPERIMENTAL" in the kernel config?  Incidentally, I'm using the firewire port on my Sound Blaster Audigy board.)

I also recommend gtkpod for managing your iPod music library.

----------

## second_exodous

I don't think that you can change a mac ipod to a win ipod, but can't you just put the file system support that the ipod has into the kernel?  I have an ibook and when I use a livecd to run linux on it I can change things on my ibook, isn't it the same file system?

I need to know this stuff to, I'm getting a new notebook, an HP, and running nothing but linux on it.  Giving my ibook to my dad.  I own an ipod and worry about the AAC files I bought on itunes, gtkpod says this in its features list:

 *Quote:*   

> Add mp3 and m4a (non-protected AAC) files (single files, directories or existing playlists) to the iPod. You can choose the charset the ID3 tags are encoded in from within gtkpod. The default is the charset currently used by your locale setting.

 

Ah crap, I guess I'll need to burn an audio DVD and re-rip it to my notebook.  I still really like itunes (mainly to buy music, not rip or manage) so I'll have to try to get it running with wine, maybe in that endeavor I'll get protected AAC files onto my ipod through linux.

But from my understanding a mac ipod can't be turned into a win ipod, apple doesn't want you switching from apple to win, and my mac ipod is a device that I would use for an excuse not to use win.  Of course, I'm a linux user mainly and have no desire to use MS win.

Thanx,

Stan

----------

## xr31Daisy

 *second_exodous wrote:*   

> I don't think that you can change a mac ipod to a win ipod,

 

3rd Generation iPod aren't sold as Mac- or Win-specific. So it has to be converted one way or another. Pluging it on a win2k box did the trick for me ( although I didn't really understand what I'm doing at the time. )

----------

## The Mountain Man

Actually, the new 3G's come pre-formatted for Mac.  When you plug it into a Windows box and run the update software, it basically reformats the drive to FAT32.  I understand that 2.6 offers some Mac file support, but I don't think it's totally stable at the moment.

This site tells you how to convert your Mac iPod to FAT32 using only Linux, though the process seems a bit complicated.  Your best bet is to find a Windows box and do the coversion there or take your chances with the (potentially buggy) 2.6 Mac filesystem support.

----------

## second_exodous

I checked a few sources and my ipod (2nd gen, not the new 3rd) won't go back.  My ipod started out win then I got a ibook, the ultimate ipod accessory.  Now, I realize OS X is really nice, but I'm a gnome/linux kinda guy, and my ibook doesn't run them as well as I hoped.  I'll try the mac file systems in the kernel, and if that doesn't work I guess I'll need to get a new ipod.

If Steve Jobs is reading this I'll definitely get a new ipod if a black or bright green 40 gig+ version comes out.  Please note that I said 'or' between back and green, and not 'and'.  Please no black and green ipods.  Oh yes, and a linux iTunes release would be nice.  C'mon, really, what do you possibly have to loose?

Thanx,

Stan

----------

