iPod Linux

download iPod Linux

of 6

Transcript of iPod Linux

  • 7/28/2019 iPod Linux

    1/6

    Development of Linux Based PDA-Like Applications

    on Modern mp3 Players

    Abstract- This paper presents a critical investigation intofeatures of some ultra modern music players that are similar to

    those of a Personal Digital Assistant (PDA). In particular, the

    work presented in this paper is centered upon a family of digital

    music players called iPods developed by Apple Computers. Due

    to the availability of almost perfect hardware & software systems

    on these devices, modern music players like iPods are very

    efficient computing devices. The paper also highlights various

    subtleties in architectures & features of iPod and the traditional

    devices like Sonys Walkman. The work presented in this paper

    involved a customized version of Linux, which was run on iPod.

    With the Linux as operating system and the complete hardware

    system of iPod, the player provides an excellent opportunity to

    develop applications on it & enhance its PDA-like features. A

    thorough investigation of embedded systems in general and of

    iPods in particular has been carried out in this work. Theprocedure to develop applications on iPod is discussed in this

    paper, starting from running Linux on iPods hardware. Many

    complex and new applications then can be programmed on iPod

    keeping in mind some basic rules and facts about the hardware

    and firmware involved.

    I. INTRODUCTION

    Music has always been a favorite and easily available

    source of enjoyment for people across the globe for several

    generations now. The technological advancements have led to

    the development of several types of music players. Like other

    electronic gadgets, music players have also greatly benefitedfrom transistors; the building block of all electronic systems.

    The use of transistors resulted in miniaturization of the player,

    giving listeners wide range of choices to enjoy music

    anywhere anytime from the handheld devices. This started

    setting up a new stage for business in a relatively new sphere.

    The first Sony Walkman stereo (model TPS-L2) was sold in

    1979 [1]. The trademark Walkman became so popular that it

    evolved into a generic term, and lost its own identity. Sonycontinues to use the "Walkman" brand name for all kinds of

    portable audio devices.

    The recent surge in the VLSI and Embedded Systems has

    created tremendous growth in media player industry. The

    advent of flash memory and hard drives memoryrevolutionized the world of music lovers by reducing the size

    of the device to that of a matchbox, and providing memory

    space as large as 120 GB [2]. Listeners can now store

    thousands of songs, hundreds of movies, photographs etc and

    listen/watch or see the stored contents anywhere, anytime.These devices mainly deal with digital audio data. With no

    mechanical part inside these players, there is no need to worry

    about the wear and tear issues which were earlier involvedwith traditional music players like Walkman.

    While modern research in the field of Error Correcting

    Codes has resulted in a greater protection against scratches or

    any other source of data corruption on CD, a similar

    advancement in Information Theory has helped manufacturers

    pack huge amount of data in a comparitively smaller space.

    This means the players can now hold more music than everbefore and can deliver excellent quality sound at a relatively

    higher intensity.

    Being digital in nature, modern music players deliver high

    fidelity sound over a wider frequency spectrum and at a very

    high intensity level. Apple Computer iPod, shown in Fig. 1,

    for example, can deliver high fidelity sound quality atintensity level as high as 120 dB [3]. Recently its ability to

    deliver high intensity music has triggered a debate in thescientific community, regarding its role in causing Noise

    Induced Hearing Loss (NIHL) [4-6].

    The iPod, being one of the latest music players in the

    market, is a result of tremendous research efforts made by the

    professionals engaged in Research & Development activities

    of the company. Due to enough hardware and software

    resources, modern music players like iPod bear excellent

    PDA-like features, in addition to the superior music quality.The existing hardware and software resources on the iPod may

    also provide an opportunity to develop more PDA-likeapplications. Thus the same device, which is used as a music

    player, can thus, be used as a multipurpose gadget. However it

    becomes a tough job for third party embedded systems

    professionals to seriously indulge in computing on these

    devices. The reason is that the internal details of the player are

    often obscured from the general public and may be available

    only to the professionals of the company itself. It may,

    however, be possible to access a lot of the resources of theplayer by rigorous reverse engineering. For example, some

    serious reverse engineering and discussion within the

    electronics industry unearthed unusual details of Apple's iPod

    development process [7-9]. As a result of this it is now

    possible to run a customized version of Linux kernel onto the

    iPod hardware [10]. With full access to the operating system

    and the hardware resources, the stage gets set for the nextlevel of challenge i.e. enhancing already included features anddeveloping newer ones.

    Traditional research on modern music players most of the

    time focuses on the quality of the audio itself. The work

    presented in this paper is however concerned with the PDA-

    like features of iPod

    The organization of this paper is as follows: Section II

    presents an overview of architecture of some modern music

  • 7/28/2019 iPod Linux

    2/6

    players such as iPod. The section also highlights some of thefeatures of the iPod that ranks this player on top. Section III

    explores the other face of the coin; the PDA-like features ofthe player and highlights the fact that modern audio players

    are very good embedded computing platforms. Section IV

    describes in detail, the steps one would take to run Linux on

    the iPod & start programming on the player. Section V

    presents some of the conclusions drawn so far from the

    research. Although not much literature is available on thesubject, the authors have provided a list of references, which

    can immensely help anyone thinking of seriously indulging iniPod based computing.

    II. ARCHITECTURE OF SOME MODERN MUSIC PLAYERS

    The introduction of Apple Computer's iPod coupled with

    iTunes software in 2001 was a big success. Since then Apple

    has almost captured the whole market. Although Apple is

    facing fierce competition with other companies, latest beingMicro-Star International's MSI MEGA 540 [11], the first solar

    powered player, still there is no synonymous of iPod's

    popularity. iPod has become so popular that the term "iPod"translated into a generic term. People now prefer calling any

    portable audio player "iPod" instead of the company's

    assigned name of the device. Basically the player consists of

    the following unit:

    LCD Driver/Controller

    Video Decoder and Processor

    Figure 1 iPod Nano

    Figure 2. General architecture of modern music players

    Power Management and Battery Charger

    Battery

    Audio Processor

    Memory

    Hard Drive Unit

    Audio Codec

    Fig. 2 shows a general block diagram of a portable audioplayer.

    As a result of rigorous reverse engineering and disscussions

    among embedded computing professionals, iPods internaldetails have been revealed [12]. The iPod uses two ARM7

    TDMI-derived CPUs running at 90 MHz, 1.8 inch or 46 mm

    ATA hard drives (with a proprietary connector) made by

    Toshiba, a dedicated MP3 decoder and controller chip from

    PortalPlayer, a stereo digital-to-analog converter from

    Wolfson Microelectronics Ltd, a flash memory chip from

    Sharp Electronics Corp., and a power management and batterycharging IC from Linear Technologies Inc. Generally the iPod

    also has 32 MB of RAM (except the 60 GB 5 th generation iPod

    which has 64 MB). A portion of the RAM is used to hold the

    iPod OS loaded from firmware, but the vast majority of it

    serves to cache songs loaded from the storage medium. For

    example, an iPod could spin its hard disk up once and copyabout 30 MB of upcoming songs into RAM, thus saving

    power by not having the drive spin up for each song

    separately.

    The current iPod models use internal Lithium-ion batteries

    while 1st and 2nd generations of iPod used Lithium polymer

    batteries. The larger models use audio circuitry provided by

    Wolfson Micro-electronics and use touch wheels provided by

    Synaptics. The iPod shuffle uses the SigmaTel STMP3550

  • 7/28/2019 iPod Linux

    3/6

    chip which handles both the music decoding and the audiocircuitry.

    When power is first applied to the iPod the hardware startsexecution of code located at the ARM boot location that is

    0x0. This location normally maps to the flash [17]. The first

    flash sector contains the ARM reset vectors with the reset

    vector pointing to the location where the bootloader is stored.

    The bootloader then executes and in the simplest caseloads

    operating system from the HDD and then executes that.

    In its race to beat all the players in the market, the computermaker has faced some lawsuits as well. In 2005, for example,

    the company faced two lawsuits claiming patent infringement

    by the iPod and its associated technologies:[13], Advanced

    Audio Devices claimed the iPod breached its patent on a

    "music jukebox",[14] while a Hong Kong-based IP portfolio

    company called Pat-rights filed a suit claiming that Apple's

    FairPlay technology breached a patent [15] issued to inventor

    Ho Keung Tse. The later case also includes the online musicstores of Sony, RealNetworks, Napster, and Musicmatch as

    defendants [16].

    III. AN INSIGHT INTO PDA-LIKE FEATURES OF iPOD

    Audio player manufacturers are putting their best mind and

    money to get a bigger share of the market. Sometimes it is justa marketing gimmick to attract consumers, and at other times

    it is a real innovation. The incorporation of PDA-like features

    into iPod is an example of an innovation, which helped the

    computer maker get rid of the crises from which it was

    suffering before the introduction of iPod. People can now

    listen to the music while watching the photographs as slide

    show. The iPod bundles a lot of PDA like features such as

    Photo viewer, games, calendar, address book, notepad etc. Theplayer like iPod also has adequate embedded computing

    environment to set the stage for newer application

    development so as to compete with a dedicated PDA. With

    some rigorous reverse engineering, embedded professionals

    have successfully ported a customized version of Linux kernel

    and played video on iPod Nano, which was not possible earlier

    with the proprietary OS provided by Apple. The exact method

    to install Linux is described in detail in section IV.

    The biggest hurdle one faces in developing applications on

    iPod is the black box appearance of the player. The companyhas always been tight lipped when it comes to releasing

    secretes of iPod. So it is a challenging task for the application

    designers to interact with the hardware of iPod. It is expected

    that in near future manufacturers will be more open towards

    releasing chip details following the line of open source

    software supporters. This will definitely generate a new waveof interest among the embedded computing professionals for

    programming any device consisting of a CPU, memory and acouple of input output interfacing etc.

    The iPod, for example boosted the diminishing market shareof Apple Computer and is now becoming famous for its PDA-

    like features, apart from the excellent sound quality. With the

    Linux kernel loaded onto the players hard disk one can

    develop innovative applications suiting the need of the time &

    money. Following are some of the examples of these

    applications, which have been developed with Linux loadedonto the player [10]:

    1. Make an iPod work with Linux machines and runLinux applications.

    2. Remove volume caps (iPod sold in Europe, cap the

    volume at 100 decibels; uncapped iPods can reach

    more than 115 decibels.)

    3. Turn the iPod into a universal remote.

    4. Attach an external hard drive to the iPod to increase

    its storage capacity.

    5. Change the iPod's font and graphics.6. Watch movies on iPod in full-screen mode.

    7. Plug iPod into any computer (even without iTunes)

    and listen to music from the hard drive.8. Transfer photos to iPod without using iTunes.

    9. Replace iTunes all together as the iPod's main

    jukebox.

    IV. PROGRAMMING THE iPOD

    This section focuses on the programming issues on the

    iPod. The programming has been done in C language on

    SUSE LINUX operating system. This section describes step

    by step procedure for developing a program to display the text

    Aligarh Muslim University on the iPod screen. The authors

    assume that the intended audiences are familier with the

    general comand-line operations on Linux terminal.

    Nevertheless, one may type man or info on Linux termnal,followed by the command to know exact details of the

    command.

    A. Step 1. Downloading necessary files

    Following files will be needed to install Linux kernel on the

    iPod:

    1. Official Boot loader (for the 1st, 2nd, and 3rd

    generation iPod) which can be downloaded from:

    http://sourceforge.net/project/showfiles.php?

    group_id=73079&package_id=101451&release_id=226112

    2. The latest kernel from the nightly build can be

    downloaded from: http://www.ipodlinux.org/builds/

    3. For userland installation download iPodLinux FS

    which is available at http://168.234.106.10/linuxos-2005-08-28-+extras.tar.bz2

  • 7/28/2019 iPod Linux

    4/6

    4. The cross-compiler for uclinux from:

    http://www.uclinux.org/pub/uClinux/arm-elf-tools/.This compiler is necessary because iPod uses an

    ARM processor, the architecture of which is quite

    different from the one provided by Intel. Since the

    intention is to execute the program on iPod, the

    binary file generated on the PC must be in

    accordance with the instruction set of ARMprocessor.

    5. If programming is to be done with Windows, Cygwin

    will be needed which is available at

    http://www.cygwin.com/.

    Cygwin (see screen shot in Fig. 3) consists of a

    library that implements the POSIX (Portable

    Operating System Interface) system call API in terms

    of Win32 system calls a GNU development toolchain

    (such as GCC and GDB) to allow basic softwaredevelopment tasks, and a large number of application

    programs equivalent to common programs on the

    Unix system [18]. But it is strongly recommended touse Linux instead.

    6. TTKfor graphical applications

    (http://ipodlinux.org/TTK). TTK is a GUI library for

    the iPod, which may be used for developing graphicalapplications.

    7. Podzilla2 API

    (http://www.getlinux.org/~oremanj/t/pz2-api.pdf).

    Podzilla 2 is a modular user interface for the iPod

    based on TTK.

    B. Step 2. Determining iPod Connection The example to demonstrate programming of iPod has been

    done on Linux (SUSE 9.3) platform. Before programming first

    of all it is determined what Linux device the iPod is connected

    as. Simply connecting the iPod to the USB and typing the cat

    Figure. 3 Screen-shot of Cygwin

    command at the terminal can do this:

    # cat /proc/scsi/scsiAttached devices:

    Host: scsi0 Channel: 00 Id: 00 Lun: 00

    Vendor: Apple Model: iPod Rev: 1.50

    Type: Direct-Access ANSI SCSI revision: 02

    Here scsi0 denotes that the iPod is connected to /dev/sda

    For more details on cat command one may refer to Linux man

    pages.

    C. Step 3. Mounting the iPod

    To explore the content of iPod it is first mounted. For this, a

    new directory is created using mkdir command and, then it

    is mounted using the command mount:# mkdir /mnt/iPodSongs

    # mount -t vfat /dev/sda2 /mnt/iPodSongs

    Once the player is mounted its contents can be browsed as a

    normal file system.

    To unmount the iPod the command umount can be used:# umount /dev/sda2

    More help regarding these commands can be found in manpages or typing info followed by the command name on Linux

    terminal.

    D. Step 4. Backing up important files

    Basically we have to port a customized version of uClinux.uClinux (pronounced as mu c Linux) is a version of Linux

    designed for devices that lack a memory management unit

    (MMU) [19]. The iPod has some MMU-type capabilities, they

    are, however, not sufficient to support the Linux kernel.

    Because it is quite possible to accidentally remove thevaluable data already present in the iPod, it is recommended

    that before installing Linux, one must backup all the files

    including the iPod boot loader and OS. Typing the following

    commands on the Linux-terminal can do this:

    # dd if=/dev/sda of=ipod_boot_sector_backup count=1

    # dd if=/dev/sda1 of=ipod_os_partition_backup

    E. Step 5. Creating a new partition

    This partition will hold the root file system for Linux. Usingthe following command, one can create a partition:

    # fdisk /dev/sda

    F. Step 6. Creating a file system

    Using the following commands creates the file system:

    # mke2fs -j /dev/sda3

    It is recommended to set the maximal mount count betweentwo filesystem checks to zero to prevent fsck being run on it:

  • 7/28/2019 iPod Linux

    5/6

    # tune2fs -c 0 /dev/sda3

    G. Step 7. Installing LINUX The downloaded Linux kernel and the bootloader areextracted into a directory. Next, extract the Apple image from

    the boot loader and create a new image including Linux and

    Apple OS (the kernel is named uclinux-2.4.24-ipod2.bin):

    #./make_fw -3 -o apple_os.bin -e 0 ipod_os_partition_backup#./make_fw -3 -o my_sw.bin -i apple_os.bin -l uclinux-2.4.24-

    ipod2.bin loader.bin

    NOTE: -3 is required in make_fw only for 4th generation

    iPods.

    Once this is done, the new image and kernel modules can be

    copied to the iPod:

    # dd if=my_sw.bin of=/dev/sda1

    # mkdir /mnt/ipod# mount -t ext3 /dev/sda3 /mnt/ipod

    # cp -r lib /mnt/ipod

    # umount /mnt/ipod

    If every thing goes fine till this step, it means that the Linux

    is now successfully loaded on iPod. To boot into Linux simply

    detach iPod from USB and reboot by holding down the menu

    and the play buttons for 3 seconds to reboot it. Afterrebooting, keep the back button pressed to boot Linux,

    otherwise the default interface will be loaded.

    H. Step 8. Programming the iPod

    For programming, a cross compiler is needed as describedabove in Step 1. The compiler for uclinux is available from

    http://www.uclinux.org/pub/uClinux/arm-elf-tools/. Once the

    compiler is installed, one can compile simple programs. Thefollowing program, for example, displays the text Aligarh

    Muslim University

    #include

    int main(void){ puts("Aligarh Muslim University "); return(0);}

    The program is saved as display.c. The next step is to compile

    the program:

    # arm-elf-gcc -o display display.c -elf2flt

    Once the binary is generated it is copied to the iPod:

    # mount-t vfat /dev/sda2 /mnt/iPodSongs# mkdir /mnt/iPodSongs/myprogs

    # cp display /mnt/iPodSongs/myprogs

    After unmounting the partition one has to reboot the iPod in

    podzilla, and scroll down to "File browser->/mnt/myprogs".

    The option display" will appear at this stage. Clicking the

    display option, one can see the program output on iPod screen.

    For more complex GUI based programming it is

    recommended to use TTK GUI library [20]. TTK is a library

    for creation of graphical user interfaces on the iPod, alongwith a few other things

    Figure. 4 iPod displaying the text Aligarh Muslim University

    The other option is Nano-X/SDL, but TTK has some

    advantages over these options. For example TTK is a higher-

    level library and has intelligent event handling etc.

    V. CONCLUSIONS& SCOPE FORFUTURE WORK

    The aim of this paper is to highlight the ongoing research by

    the authors involving some ultra modern mp3 players. As

    presented in this paper, the popularity of modern musicplayers is not just the result of a superior sound quality, but

    also because of the applications they can support. These

    applications resemble to a large extent to those available on a

    PDA. Moreover with the mutual growth in semiconductor

    industry and embedded computing, it can now be anticipated

    that the general trend of developing the newer applications

    would continue to grow in future as well. These facts, coupled

    with the hope that in near future the mnufacturers will be more

    transparent as far as the internal chip detail is concerned,would mean easier access to the resources on the player. This

    in turn would provide a platform for developing novel PDA-

    like applications on the players; which would be a

    breakthrough in the consumer electronics industry involovingmusic players. The users will just have to download the

    application from internet in order to install it on the player.

    Thus theplayer which is traditionally used for listening to the

    music would turn out to be a multi-purpose gadget. The basicidea is to make use of the available resources of the player as

    much as possible.

    In particular, due to its unique features and some critical

    issues and criticism associated with the Apple Computers

    iPod, the authors have chosen iPod for this research. The

  • 7/28/2019 iPod Linux

    6/6

    authors have presented an example to illustrate a way todevelop a simple Linux-based application on the iPod. Various

    complex PDA-like applications can then be developedfollowing the same line.

    Furthermore, Linux, being an effort of Open-Source

    Software Supporters, does not involve any kind of copyright

    violation or patent infringement. This will provide a greater

    freedom & flexibility to small-scale embedded computing

    industry, especially in a developing country like India, toexperiment on the player and enhance its PDA-like features.

    REFERENCES

    [1] The story behind the Sony Walkman,

    http://lowendmac.com/orchard/06/0915.html

    [2] Seagate to Launch 120GB iPod drives,http://www.macnn.com/articles/06/08/14/120gb.18.hdds.in.2006/

    [3] Squeezing Apple Juice, A time line of iPOds lawsuits,

    http://dfire.org/x2231.xml

    [4] Play it by the ear,

    http://www.hindu.com/thehindu/mp/2006/12/06/stori

    es/2006120600400100.htm[5] M. Salim Beg, Heshsham F.Abdul Basit, Narayan Gehlot, Role of

    Modern Music Players in Noise Induced Hearing Loss, All India

    Seminar on Biomedical Engg. & Bio-Informatics, AEC, Agra, 24-25

    March 2007.[6] Noies-Induced Hearing Loss,

    http://www.hearinglossweb.com/Medical/Causes/nihl/nihl.htm

    [7] Reverse Engineering of the iPod Stuns Apple, http://www.out-

    law.com/page-4762

    [8] Inside the Apple iPOD design triumph,http://www.designchain.com/coverstory.asp?issue=summer02

    [9] Apple trying to keep iPod Nano chip manufacturers a

    secret? http://www.tuaw.com/2006/09/18/apple-trying-to-

    keep-ipod-nano-chip-manufacturers-a-secret/

    [10] Linux on iPod, www.ipodlinux.org[11] MSIs Solar Mega Player 540,

    http://www.engadget.com/2006/03/12/msis-solar-mega-

    player-540/[12] Next-Generation iPod Details Unveiled

    http://www.mobilemag.com/redirect.php?content=3802[13] Channel Register. Apple faces patent lawsuits over its

    iPod,2005-03-10,

    http://www.channelregister.co.uk/2005/03/10/apple_ipod_patent_lawsuit

    s/

    [14] U.S. Patent 6,587,403 Advanced Audio Devices'"music jukebox" patent. http://www.google.com/patents?

    vid=USPAT6587403&id=oawMAAAAEBAJ&dq=6,587,43

    [15] U.S. Patent 6,665,797 "Protection of software again

    against unauthorized use" (corrected to "Computer

    Apparatus/Software Access Control"),http://www.google.com/patents?

    vid=USPAT6665797&id=QrR2AAAAEBAJ&dq=6,665,797

    [16] AppleInsider. Apple, Sony among those named in new

    DRM lawsuit, 2005-08-16,http://www.appleinsider.com/article.php?id=1235

    [17] Firmware, http://ipodlinux.org/Firmware

    [18] http://x.cygwin.com/

    [19] Embedded Micro Controller Project, www.uclinux.org/

    [20] TTK, An iPod GUI Library, www.get-

    linux.org/~oremanj/t/ttk-api.pdf