Home / Projects / Podzilla 2 Compiling Tutorial from Scratch (via Cygwin)

Podzilla 2 Compiling Tutorial from Scratch (via Cygwin)

This is ONLY for compiling Podzilla 2 for the iPod on Windows using Cygwin! (ie, this is not for desktop builds!)

Note for those with slow internet: Some of the files needed (especially the toolchain) require a long time to download. I suggest you skip right down to the download section and start downloading the necessary files (you shouldn’t download the second toolchain file though) before you continue on.

Well, due to much thanks from mike (ichaelmay8), I’ve been able to fully set up a Cygwin compiling environment in Windows XP SP2 without any previous development files. I was able to delete/uninstall everything and completely rebuild that exact working environment and thus am able to narrow down every necessity in this compiling process.

This tutorial will show you how to set up a Cygwin environment complete enough to compile podzilla 2 and basic modules from svn or source. The basic requirements are a computer able to run a Windows version compatible with Cygwin, a good enough internet connection for downloading files, administrative access on the computer, and an hour or so of free time on your hand. Also, basic intelligence is required, meaning, if you don’t really understand a term or is having a bit of trouble with anything, consult other sources first, ie the Search option of the iPL forums, Google, Wikipedia, or even your home dictionary. Also note that info from this tutorial is collected from a variety of sources and is far more accurate than that on the iPL wiki (as far as newbie-friendliness goes). So here’s the tutorial, enjoy! ~Keripo

Setting up Cygwin

Cygwin is basically a program that provides a Linux-like environment for compiling and running things Linux-style. Since iPodLinux is built and compiled primarily on the Linux OS, Cygwin is basically a window’s alternative for compiling things.

1. First thing is installing Cygwin on your computer.
Download Cygwin’s installer file (setup.exe) from Cygwin’s website[/url] or the direct download link >here< . Don't use a download accelerator here as you'll probably get a corrupt file (it happens). 2. Run the setup.exe installer. For the installation directory, choose "C:/Cygwin/Installation" where "C:/" can be replaced with any other valid drive letter. Next, for the packages directory, use "C:/Cygwin/Packages". 3. Select any mirror and wait. After a while, you'll be presented with a list. 4. Open up the "Devel" section and select the following packages: [code]flex (2.5.4a-3) gettext (0.15-1) gcc-core (3.4.4-1) make (3.81-1) perl-ExtUtils-Depends (0.205-1) subversion (1.4.2-1) [/code] The numbers in brackets are just the version numbers that I used but any version for each should work. Also, you'll notice that selecting certain packages will also auto-select a few others. These should be: mktemp (1.5-4), binutils (220060817-1), gcc-mingw-core (20050522-1), mingw-runtime (3.11-1), libxml2 (2.6.26-1) and expat (1.95.8-1). Just keep them selected as they are probably dependencies. If you notice any other packages also selected in the Devel section, leave them selected just in case. Also, because it's important, [b]DO NOT SELECT EVERYTHING!!![/b] The [i]entire[/i] Cygwin installation, if you want everything, will take a day or so and be 4 GB. You [u]don't[/u] need everything in Cygwin nor everything in the Devel section!!! 5. Click next and install. Wait. A long time. At a speed of about an average of 15-20 kb/s (note: downloading speed really depends on the downloading mirror chosen rather than your max downloading speed - my max speed is just over 350 kb/s), the whole process takes about 30 minutes [25 minutes for downloading, 5 minutes for installing]. In the meantime, just chill or do something, [/u]but do not close the window![/u] 6. After you're done, the full installation folder (C:/Cygwin/Installation) will be between 60 and 80 MB depending on the packages you installed. Open the Cygwin bash shell (if you didn't select the option) and wait for it to configure a bit. If you've done everything right, you'll see, in green text, something along the lines of AccountName@ComputerName:~. If you do, congratulations, you now have a good Cygwin environment installed on your computer. If you ever realized that you're missing a package because you're getting a "***: command not found" or other errors, you can check and re/install them by running the setup.exe file, keeping the same install and package directories, and selecting the new packages. Also, since Cygwin installs to "C:/Cygwin/Installation", from now on, the starting "/" or the "root" of your environment will mean "C:/Cygwin/Installation/" For example, the starting location of the bash shell (~ = "/home/") is actually "C:/Cygwin/Installation/home/". Also, to reopen the bash shell at any time, double click the "cygwin.bat" in "C:/Cygwin/Installation/" and your starting directory will be /home ("~"). [size=20][u]Installing the Toolchain[/u][/size] Next, you'll need to install the basic toolchain for compiling things for the iPodLinux kernel (a modified version of uClinux). The one you'll be installing (3.4.3) is for building Podzilla 2 and current iPL applications but not for building Podzilla 0. 1. Download the toolchain file from >here< directly to "/". The file is 32 mb or so, so do the long download with a download accelerator (with ~310 kb/s downloading using Firefox's DownloadThemAll, took about 3 minutes). Rename the file from "arm-uclinux-tools-cygwin-20060116.tar.bz2" to "tc.tar.bz2" for simplicity reasons. 2. Open the Cygwin bash shell. (Don't remember how? Do back to the Cygwin part, last section) Type: [code]cd / tar -C / -xvjf tc.tar.bz2[/code] Wait a while for lots of text to scroll by, installing the toolchain to /usr/local/arm-uclinux-elf-tools The whole process takes about 2 minutes (Pentium 4, 2.79 GHz). Now close the bash shell. 3. Next, you'll need to edit the Cygwin "profile" file using an advanced text editor. The "profile" file can be found in /etc/ but I strongly suggest you first make a few backups of the important file cause here you can majorly screw up. Either way, you'll need an advanced text editor that can read the LF (Linux File) format. I strongly suggest using [url=http://notepad-plus.sourceforge.net/]Notepad++[/url] (direct link >here< ) which is not only fast and far better than Notepad/Wordpad, but can also be used for source file editing, hex editing, as well as opening the LF file we'll be editing. Its a great overall replacement for the crappy Windows Notepad ; P Either way, once you've got Notepad++ installed, open up the "profile" file. 4. Find (Ctrl+F) "PATH=/usr" and replace the entire line ("PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH") with "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/arm-uclinux-elf-tools/bin:$PATH" and save. The file should still be named "profile" with no extensions. 5. Reopen the Cygwin bash and make sure things look the same as before (ie "Name@ComputerName" in Green). If you see weird text and something like "bash-3.2$" and maybe a bunch of errors, all in white, that means you screwed up your profile editing. Take one of the copies of the profile file you made, make another copy of it and rename it to "profile". Then re-edit things properly using Notepad++. If you keep getting stuck here, delete the "profile" file and just run the Cygwin installer again without installing anything and your profile will be re-set up. 6. Type "arm-elf-gcc". If you get the response "arm-elf-gcc: no input files", you've installed the toolchain correctly. Otherwise, delete the /usr/local/arm-uclinux-elf-tools folder and reinstall the toolchain. If you did get the correct response, however, that means the toolchain is basically installed; however, theres a few Cygwin-specific tweaks needed to be made. [size=20][u]Fixing the Toolchain[/u][/size] The Cygwin version of the toolchain has a few problems. First off, it's missing the important library file, "libintl.a". There's two ways of getting this file: 1 a) Download the file from [url=http://ipl.derpapst.org/wiki/Image:Libintl.zip]here[/url] [b]OR[/b] 1 b) Install the basic Linux-version toolchain ( http://www.so2.sys-techs.com/ipod/toolchain/linux-x86/arm-uclinux-elf-tools-base-gcc3.4.3-20050722.sh ) to / and rename it to tc2.sh (for simplicity). Install the toolchain by typing: "sh ./tc2.sh". Wait for it to full install to /usr/local/arm-uclinux-tools2. Now copy the libintl.a file from /usr/local/arm-uclinux-tools2/arm-uclinux-elf/lib/ to /usr/local/arm-uclinux-elf-tools/arm-uclinux-elf/lib amoung a list of other lib*.a files. (Note that the first method is far easier but the second method is where the original file comes from.) The second problem is the short-cutting of the "asm" folder. Cygwin treats symbolic links (symlinks) as Windows shortcuts but the toolchain has a problem understanding that. So, instead of keeping a shortcut, the whole directory must be duplicated. 2. You can fix this problem by typing (in the Cygwin bash): [code]cd /usr/local/arm-uclinux-elf-tools/arm-uclinux-elf/include rm asm ln -s asm-armnommu asm[/code] Alternatively, you can just duplicate the asm-armnommu folder by deleting the asm link and making a copy of the asm-armnonnu folder, renaming it to "asm" (you can do this via Windows Explorer or Cygwin's rm and cp). Either way, once these two changes are done, you've got a filed toolchain ready for compiling. Hopefully you'll never have to touch it again. Test it one more time by typing in the bash shell "arm-elf-gcc" and hope for the "arm-elf-gcc: no input files" response. If you've got that, its time to set up things for building Podzilla 2. [size=20][u]Setting up Podzilla 2[/u][/size] Podzilla 2, like almost everything that you'll ever compile, also has a few dependencies and libraries needed when compiling. For image-ing and GUI, ttk and hotdog is needed. For modules, podfile is needed. 1. First, get all files from svn. These files will be saved in a general "iPodLinux" folder for organization. In the bash shell, type: [code]cd / mkdir iPodLinux cd iPodLinux svn co https://ipodlinux.svn.sourceforge.net/svnroot/ipodlinux/libs/hotdog/ hotdog svn co https://ipodlinux.svn.sourceforge.net/svnroot/ipodlinux/libs/ttk/ ttk svn co https://ipodlinux.svn.sourceforge.net/svnroot/ipodlinux/apps/ipod/podzilla2 podzilla2[/code] Do each command one by one and after everything is svn'd, you will have the folder /iPodLinux containing the hotdog, ttk and podzilla2 folder. Note: If you are getting the error "svn: command not found", that means you don't have subversion installed! Go back to the Cygwin installation section and reinstall the subversion package. 2. Now each of these things need to be compiled. Start with hotdog: [code]cd hotdog make IPOD=1[/code] 3. Next, ttk: [code]cd .. cd ttk make NOMWIN=1 NOX11=1 NOHDOG=1[/code] Note: You'll probably get the error "rm: cannot remove 'lndir': No such file or directory" but you can ignore that. Now that everything's all set up, its time to actually compile Podzilla 2 and its modules. Yay! [size=20][u]Building Podzilla 2[/u][/size] Finally, if hotdog and ttkcompiled successfully, you'll hopefully never need to touch them again. Now onto Podzilla 2 compiling. 1. If you just want the binary and not the modules, delete all the folders in the podzilla2/modules folder. You can do this by typing: [code]rm -r /iPodLinux/podzilla2/modules[/code] ... and pressing "y" a lot of times, or you can do it by GUI through selecting everything and deleting. ^ [Do this only if you just want the Podzilla 2 binary and are too lazy to wait for the long module-compiling time ; P] 2. Now you can compile Podzilla 2: [code]cd /iPodLinux cd podzilla2 make IPOD=1[/code] Wait a bit as everything gets compiled. Hopefully, if all went right, it'll compile and you'll get a binary called "podzilla" in /iPodlinux/podzilla2/ ; D (If you get the error "cannot find -lintl", you didn't do the toolchain's "libintl.a" fixing correctly! Go back to the "Fixing the Toolchain" section!) Now to recompile from svn any time: [code]cd /iPodLinux rm -r podzilla2 svn co https://ipodlinux.svn.sourceforge.net/svnroot/ipodlinux/apps/ipod/podzilla2 podzilla2 cd podzilla2 make IPOD=1[/code] [~End of Tutorial~] [size=20][u]Downloads[/u][/size] Here's the entire list of files that you'll need to download at one point or another. All links are direct downloads so that you can download them when you have free time before you start the tutorial.

Check Also

Beats 1.7.5b and Android Fragmentation

Android: The Story of A Fragmented Platform (src) So even though I wasn’t planning on …