Experimental Userland

From wikiPodLinux

Table of contents

Overview

The goal of this page is to build a userland from scratch which works as good as or better than the default userland. The core of the userland is going to be built with busybox due to its compact design intended for embedded applications like iPodLinux.

There are some obstacles which need be overcome when building userland applications for the iPod. Because the iPod has no MMU and requires uClinux, programs which rely on fork() or daemon() don't work. uClinux does has MMUless friendly replacements for fork() and daemon(), they are vfork() and clone() respectively.

Download

If you would like to download a prebuilt experimental useland, follow the link below. The current experimental userland should run on all iPods. All you need to do is install the bootloader and uncompress the userland archive onto the root linux partition of your iPod. The userland comes prepackages with the following:

  • Kernel Version 2.4.32-ipod0
  • Preconfigured Loader2 configuration file
  • Latest podzilla2 (with minimal modules)
  • Latest ttk fonts and schemes

NOTE: The kernel (vmlinux) and the config for loader2 (loader.cfg) can be found in /boot.

Prepare the root filesystem

Format

  • We are starting from scratch so reformat your root partition.
mkfs.ext2 /dev/sda3
tune2fs -c 0 /dev/sda3

Mount

  • Mount your root partition.
mount /dev/sda3 /mnt/ipl

Create directory skeleton

cd /mnt/ipl
install -dv {sbin,dev,home,lib,etc,boot,mnt,proc,sys,usr/share/fonts,var/lock,var/log,var/run,var/tmp}
ln -s sbin bin
ln -s var/tmp tmp

Busybox

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.

Download

To grab a copy of the latest version of BusyBox using anonymous svn access:

svn co svn://busybox.net/trunk/busybox

Fixes

  • The init in busy box used to use vfork but recently they switch to fork since most machines have an MMU and can fork. Anyway, to get init to use vfork insert the lines below into busybox/init/init.c after the includes:
#if defined(__UCLIBC__) && !defined(__ARCH_HAS_MMU__)
#define fork    vfork
#endif
  • This needs to be done to use init. If you don't init will hang once it starts.


  • If you try to compile any daemon application like inetd you will get an error like this:
busybox_unstripped.elf2flt(.text+0x271c0): In function `inetd_main':
resolv.c: undefined reference to `daemon'
  • It cant be fixed by adding the lines below to the file in need after the includes. In this case its networking/inetd.c.
#if defined(__UCLIBC__) && !defined(__ARCH_HAS_MMU__)
#define daemon    clone
#endif

Configure

Select the packages you wish to include in your userland. The init in busybox does not support runlevels. If you want to experiment with runlevels you need sysvinit. If you are planning on using sysvinit then do not build init into busybox. Also note that you have the option to build in a shell; it is recommended to use msh (minix). You can try this .config (http://www.rit.edu/~rmh3093/.config) to get you started. Copy the .config to your busybox directory.

cd busybox
make menuconfig

Build

LDFLAGS="-Wl,-elf2flt" make busybox_unstripped

Install

  • If you set the target install directory to the mount point for your ipod you can install busybox directly:
LDFLAGS="-Wl,-elf2flt" make busybox_unstripped install
  • You might get a warning:
make[1]: `busybox_unstripped' is up to date.
  STRIP busybox
/usr/local/arm-uclinux-tools2/bin/arm-uclinux-elf-strip: busybox: File format not recognized
make[1]: *** [busybox] Error 1
make: *** [install] Error 2
  • So just enter the command a second time and it will install.
LDFLAGS="-Wl,-elf2flt" make busybox_unstripped install
  • A better solution for this is under investigation.

ipodinfo

Download

svn co https://ipodlinux.svn.sourceforge.net/svnroot/ipodlinux/libs/libipod/

Build

cd libipod
make IPOD=1

Install

install ipodinfo /mnt/ipl/bin

sysvinit (optional)

Navigation



  • Google Search (http://www.google.com/custom?sa=Google+Search&cof=S%3Ahttp%3A%2F%2Fwww.ipodlinux.org%3BVLC%3Apurple%3BAH%3Acenter%3BBGC%3Awhite%3BLH%3A141%3BLC%3Ablue%3BL%3Ahttp%3A%2F%2Fipodlinux.org%2Fstylesheets%2Fimages%2Fwiki.png%3BALC%3Ablue%3BLW%3A128%3BT%3Ablack%3BAWFID%3A70a74ab66f4d59ae%3B&domains=ipodlinux.org&sitesearch=ipodlinux.org)