Installing and Using Debian on an OpenMoko FreeRunner

You can install Debian on your [http://wiki.openmoko.org/wiki/Neo_FreeRunner ?OpenMoko FreeRunner], and use that system to fulfill your telephone needs. You can then use almost all of the packages available for Debian, with just one call to apt-get install. It’s still the same full featured Distribution that you know from your desktop or server.

Notes

This installer is relatively new and probably contains bugs. You use it at your own risk.

If you want to learn something about your new Debian system, you can read the installation script and do the steps by hand. This also allows you to be more flexible with regard to partitioning, package selection and configuration.

At the moment, only the [http://wiki.openmoko.org/wiki/FSO freesmartphone.org] software stack is packaged for Debian, this means: frameworkd and zhone. Illume will be available once the next Enlightment snapshot is packaged. But this does not mean that you will not be able to use your favourite stack (e.g. SHR) on Debian, it just needs to be packaged by someone.

Instructions for installing on the Neo1973 can be found at DebianOnNeo1973

Backup

If you do not have a card reader to backup your MicroSD card, you can copy the contents of the card including partition data over a network. You will need a booted Freerunner with network access (USB, Wireless etc.) and a *nix-based machine. Make sure power management is not set to suspend on the FreeRunner.

If you wish to take a backup of your MicroSD card to restore from later, run the following from your Freerunner:

dd if=/dev/mmcblk0 | ssh user@backup.server "gzip -9 | dd of=sdcard.tgz"
#why .tgz (tar archive) and not .gz? --jidanni

This will create a compressed backup of your card performing the compression on the backup server (assuming that it's more powerful than 400MHz). To restore, run the following from your backup server:

dd if=sdcard.tgz | gzip -d | ssh root@freerunner.address dd of=/dev/mmcblk0

As always, double check you have used the correct syntax for 'dd'.

Installation

To install Debian on your MicroSD card, you need to have any Linux system running already in flash. All official images (2007.2, 2008.8, FSO Milestone 2) should be fine. So far, the installation has only been tested with an up-to-date uBoot (from 2008-08-05), so it is recommended to upgrade that. Ensure that your FreeRunner is connected to the Internet, either via USB or wireless.

Log into your FreeRunner and download and run the installation script:

(Note: the installation should take around one hour to complete, but depending on your Internet connection more time can be required.)

$ wget http://pkg-fso.alioth.debian.org/freerunner/install.sh
$ chmod +x install.sh
$ ./install.sh
Auto-Installer for Debian on the Openmoko FreeRunner (GTA02) v1.0
-----------------------------------------------------------------
Copyright 2008 Joachim Breitner <nomeata@debian.org>
Copyright 2008 Luca Capello <luca@pca.it>
This program is licensed under the terms of GNU General Public
License either version 2, or (at your option) any later version.
Usage: [variable1 variable2 ...] ./install.sh stage1 [stage2 ...]
Variables:
  HOSTNAME         the name of the machine (default to debian-gta02)
  SD_DEVICE        the character device to access the microSD card
                   (default to /dev/mmcblk0)
  SD_PART1_FS      the filesystem for the first microSD card partition,
                   i.e. the one containing the uImage.bin (default to
                   ext2, possible values are ext2/vfat)
  INST_DIR         the directory where the microSD card partitions
                   will be mounted to (default to /mnt/debian)
  INST_MIRROR      the Debian mirror used during installation, it
                   should be set to a mirror nearby that carries armel
                   binaries for unstable and experimental (default to
                   http://ftp2.de.debian.org/debian)
  APT_RECOMMENDS   control if APT should install recommends by default
                   (default to false, possible values are false/true)
  DASH_BINSH       configure dash as default /bin/sh (default to true,
                   possible values are true/false)
Stages:
  all              Runs all the stages in the following order:
                   testing time partition mount debian apt fso
                   configuration kernel unmount
  testing          Verifys that everything is in place for this
                   installer to work
  time             Fetches the current time from ntp.fu-berlin.de via rdate
  partition        Partitions and formats the microSD card found
                   in /dev/mmcblk0 (WARNING, this will destroy all the
                   data on the microSD card)
  mount            Mounts microSD card partitions under /mnt/debian
  debian           Installs a basic Debian system, including an SSH
                   server
  apt              Sets up APT repositories
  fso              Installs packages required to use the Zhone GUI
  configuration    Configures various parts of the system, such as
                   the X server
  kernel           Downloads and installs kernel image and modules
  unmount          Unmounts the Debian filesystem mounted at /mnt/debian
Unsupported or buggy stages, use at your own risk:
  uboot            Configures the U-Boot environment to boot Debian
                   (it needs to run between the debian and the unmount
                   stage)
For more information, go to http://wiki.debian.org/DebianOnFreeRunner

Please read these introductions to get an overview about what is going to happen. You can then run the installer with

$ ./install.sh all

or, to use a [http://www.debian.org/mirror/list mirror of your choice]. Mirrors might be unreliable and give E: Couldn't download Release! errors.

$ INST_MIRROR=http://ftp.cc.debian.org/debian ./install.sh all

Note that running 'all' involves the 'partition' action mentioned above, which destroys all information on the uSD card. You have been warned.

The default filesystem created by install.sh for the boot partition is ext2, but U-Boot needs the boot partition to be fat. You have two options:

I) Modify your uBoot (as described below) so it can boot straight off ext2,

OR

II) Set boot partition to be vfat by running SD_PART1_FS=vfat ./install.sh all. Now you do not need to mess with modifying U-Boot's default setup.

Now be patient for a while, as the script downloads, installs and sets up everything it needs. Once it finishes without an error, you have to adjust your uBoot environment:

In case of temporary errors (for example network problems), you can re-enter the installation by specifying the stages you want to run:

./install.sh  debian apt fso configuration kernel unmount

It is your responsibility to make sure that the installer finds a setup that equals that provided by previous stages, especially with regard to mounted filesystems.

With newer (bigger) SD cards, there is a known issue which prevents them from working properly. If the installer stops at the partitioning or formating stage or right after it, it's probable that you are bitten by it. There is a workaround setting sd_max_clk to a lower value in U-Boot. To do this:

setenv menu_6 Boot from flash sd_max_clk: setenv bootargs \${bootargs_base} \${mtdparts} glamo_mci.sd_max_clk=5000000  rootdelay=5 \; foofoo \; barbar

You'll have to copy foofoo and barbar from the entry in menu_1, as I'm right now installing debian and cannot get to uBoot to see it. The rest i'm writing out of my head. What is important is that you prefix $ and ; with \, as otherwise they would be interpreted as special chars (the variables would be expanded and it would begin booting).

saveenv

Next time you boot to NAND uBoot you should see a new menu at the bottom called "Boot from flash sd_max_clk". Select it and try installing debian per this instructions again.

The installation script configures [http://gondor.apana.org.au/~herbert/dash/ dash] as the default shell (i.e. /bin/sh). If you still prefer [http://www.gnu.org/software/bash/ bash] as /bin/sh, either do this by running DASH_BINSH=false ./install.sh all at installation time or, once Debian is running, with dpkg-reconfigure dash.

At this point, if you want to run Debian from the FreeRunner's internal flash instead of the uSD card, see /MovingToFlash

Adjusting your uBoot environment

If you have installed your Debian with vfat as the boot partition file system, you can use the standard "Boot from SD (fat+ext2)" entry from the NAND uBoot and skip reading this chapter. If not, you need to modify your uBoot environment. You are welcome to do this manually, and set it up to your liking. We do however provide a script that configures uBoot so that:

To run the script, you need:

Now you can configure your uBoot using these commands, run as root:

wget http://pkg-fso.alioth.debian.org/freerunner/configure-uboot.sh
chmod +x configure-uboot.sh
./configure-uboot.sh

Instead of this configure-uboot.sh script you can also take this one [http://paste.ubuntuusers.de/391456/ configure-uboot.sh] which will speed up the booting by using the quiet-mode. It also adds an additional boot-parameter for booting without quiet-mode for debugging purpose.

Do not use this script with a device other than the FreeRunner!

Using your Debian system

Once the installation is complete the Debian System from SD-Card is booted by default. To Boot your normal system choose "Boot Flash" from uboot menu. After booting you should see [http://wiki.openmoko.org/wiki/Zhone Zhone] running, and you should (theoretically) be able to make and accept Phonecalls, send and receive SMS, access the on-SIM phonebook and use the GPS (more details at [http://wiki.openmoko.org/wiki/FSO_UI_Tutorial FSO UI Tutorial].

If you are still using the factory uBoot image, then you may not be able to boot successfully. (For example, you may see the openmoko splash screen followed by bright white screen recursively.) Please get the newest uboot image from: http://downloads.openmoko.org/daily/gta02v5_and_up-u-boot.bin and if you do not already know how to use dfu-util, then follow the instructions given at:http://wiki.openmoko.org/wiki/Flashing_the_Neo_FreeRunner#Flashing_the_boot_loader_to_the_NAND.

There is no Illume running, but you can pop up (and down) the matchbox keyboard using the AUX button. From the keyboard, you can run an xterm using the key combination Alt-Ctrl-x, and then switch between these two applications with Alt-Tab. From there on, there is nothing special about your telephone any more – it’s a Debian system!

Some ideas what you can do do from here:

Reporting bugs

When something is not working, please help us by first checking if it works with the official FSO image. If it does not work there, it is likely not a Debian specific bug, and should be reported at http://trac.freesmartphone.org/.

Although some packages are not yet in the official Debian repository, you can use the [http://bugs.debian.org/ bugtracking system] to file bugs against them, preferentially using the [http://packages.debian.org/stable/utils/reportbug reportbug] program. We will find them, and eventually the packages will be added to the repository and the bugs will apply to them.

When you submit a bug, please:

Known Problems

Installing the FSO applications on your desktop

For development reasons, you might want to have the FSO applications available on your desktop. For that, add these lines to your sources.list:

deb http://pkg-fso.alioth.debian.org/debian unstable main
deb-src http://pkg-fso.alioth.debian.org/debian unstable main

and install the keyring:

apt-get update
apt-get install pkg-fso-keyring

Develop Applications for and on Debian

You can develop and test your applications for Debian on your desktop (just as you can run Zhone on your desktop, if you like). If the application is architecture-independent (such as a python application), you can just install that package on your FreeRunner. For architecture-dependent packages, you can compile clean packages using [http://packages.debian.org/sid/qemubuilder qemubuilder].

To build packages for armel with qemubuilder, you can use this setup:

Getting involved

Debian on the FreeRunner was brought to you by the pkg-fso team. We provide the phone-specific packages and created the installation script. If you have questions, you can contact us at

FAQ