Installing and Using Debian on an Openmoko's Neo FreeRunner

You can install Debian on your Openmoko Neo 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.

For a brief showcase of desktop environments to use on your Debian / FreeRunner installation, see the Debian page at the Openmoko wiki.

Instructions for installing on the Neo1973 instead of Neo FreeRunner can be found at DebianOnNeo1973

Subpages: /MovingToFlash, /Tips, /Todo, /WLAN | Teams/DebianFSO

Introduction

Preface: In the early days, one had to install Debian manually (still possible). The current status is what this guide is about, an installation script. Work is progressing on a proper debian-installer support, which will lead to better Debian installation experience for everyone. It depends on getting a proper 2.6.33/2.6.34 kernel, though.

This installer (install.sh) may contain bugs as Debian unstable is kind of a moving target. 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, the freesmartphone.org software stack is packaged and actively maintained for Debian. By default this means frameworkd and zhone. Phone software developed in the SHR project is also available. Illume window management is available, as are most needed dependencies of the Enlightenment 17 environment. Paroli is not packaged but all dependencies are in. The basis of Debian provides a great infrastructure for bringing more mobile-oriented software by packaging it as part of our team.

Current Status of Installation via install.sh

To get a hint of recent work on install.sh, see git history and the comments on the commits there.

Chances of getting Debian installed at the moment is: HIGH (please report at smartphones-userland if you cannot install with the instructions on this page and these notes, and/or ask for help on #openmoko-debian @ Freenode IRC channel)
notes below are old quirks which you may happen to find useful if you run into problems

19.9.2009: Success report with one workaround needed (continue from the apt phase with the instructions in the Examples subsection of Installation Procedure) (note the newly mentioned requirement of installing perl in the "host" system) (This is only required for having the perl-implemented debootstrap substitute cdebootstrap, circumventing the dpkg problem - Steffen)

6.9.2009: install.sh both received an option to use debootstrap instead of cdebootstrap, and dpkg 1.15.4 was uploaded to unstable. Additionally, new E17 and Zhone packages have arrived to Debian "proper" (not just pkg-fso archive). 28.8.2009: (Installation broken while waiting for dpkg 1.15.4 to officially land. Until then, cdebootstrap does not work correctly. More information. Until then, the only way is manual installation with debootstrap (not cdebootstrap), tip) (I like you links since these issues will arise again somewhen in future, but for the very moment this issue is resolved, I think. cdebootstrap should become the default again. Steffen) 22.8.2009: There is an issue with "fdisk" while partitioning. You can continue installation by looking at the examples below, substituting ”all” with the remaining phases after partitioning. (What issue? I have seen a patch in the history. So maybe this is an issue of the past. Steffen) 20.8.2009: Success report, workarounding two bugs: mailing list post (I like the invocation of install.sh, the suggestions in the email, i.e. the s/trayer/stalonetray/ was followed. It seems like trayer is back in the archive, so a switch back to it seems likely).

Before Installation

SD Card

The Debian installation will take up most of the 512 megabytes of the stock MicroSD card that comes with the FreeRunner, leaving little room for installing additional .deb packages. One will soon find oneself purchasing a larger card and doing the Debian installation all over again. Hence one should consider purchasing a larger card first before proceeding. For example, with TASKS="ALL" (see below), 512Mb is not enough, while 1Gb is (~ 30Mb left free).

Troubleshooting

As of 23.11.2009, Neo FreeRunner with SHR kernel is pretty picky about SD cards; 4Gb Transcend and 4Gb Silicon Power didn't work for me, while 1Gb Apacer did. See http://wiki.openmoko.org/wiki/Supported_microSD_cards.

If you do get errors during install, especially I/O error type of thing, there is a good chance your MicroSD card has compatibility problems with Neo and/or the distribution you are running. In that case, you may try the following kind of commands before running install.sh:

echo 5000000 > /sys/module/glamo_mci/parameters/sd_max_clk
echo 3 > /sys/module/glamo_mci/parameters/sd_drive

If that resolves the problem and installation completes, you are that much wiser. However, SD card performance is reduced even from the default, power consumption increases and SD card power could interfere with GPS functionality. Anyway, in order to use the particular SD card and the Debian you just installed on it, you also need to set the same parameters in the Debian partition's /boot directory before booting to Debian. That is, create /boot/append-GTA02 on the Debian partition and put the following one line in it:

glamo_mci.sd_max_clk=5000000 glamo_mci.sd_drive=3

If possible and does not cause additional errors with your card, it would be preferable at least to set the sd_drive to 0 to reduce power consumption.

It is possible that even this troubleshooting does not solve problems with your particular card.

Swap Partition Or File?

Consider a swap partition, some have reported a swap partition is useful. The preparation of such can be performed by the install script by specifying the SD_SWAP_SIZE environment variable.

The user could consider integrating one into the plans below, as it would be much harder to do later when there is no free space left. Also consider where to place it when considering Qi's boot order.

If it's too late to make a swap partition, consider a swap file. See also thread. Another swap file success.

Making Full Backups

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 > sdcard.gz"

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:

zcat sdcard.gz | ssh root@freerunner.address dd of=/dev/mmcblk0

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

Filesystem And Bootloader Choice

The default filesystem created by install.sh for the boot partition is ext2, but U-Boot needs the boot partition to be vfat. You have some options about how to choose bootloader + filesystem combination:

I) Learn about Qi and use eg. QI=true ./install.sh all. This is described below in ”Using Qi”.

OR

II) Set boot partition to be vfat by running eg. SD_PART1_FS=vfat ./install.sh all. Now you do not need to mess with modifying U-Boot's default setup, and can still boot to Debian using NOR boot. (Note this creates a tiny 8MB partition at the front of the card, which will be very hard to increase the size of later. So consider manually increasing the size. Even if not planning to use this partition now, it will be handy for emergency NOR boots later, as it is one of the places the NOR booter knows about.)

OR

III) Modify your NAND uBoot so it can boot straight off ext2. This is described below in ”Using U-Boot”.

NOR Flash is readonly, and the u-boot there can always be accessed. Press aux+power to boot NOR-bootmenu, where there is only the fat+ext2 option available for possibly launching Debian

NAND Flash is writable, and you may use either Qi or U-Boot there. If you do not already know how to use dfu-util to flash boot loader, then follow the instructions given at: http://wiki.openmoko.org/wiki/Flashing_the_Neo_FreeRunner#Flashing_the_boot_loader_to_the_NAND.

Using Qi

Use Qi bootloader (git) – ready made binary 1 (Mar 09), 2 (Jun 09), following this Download_and_installation guide for flashing the downloadable Qi binary.

Qi needs /boot to be on the same partition as / by default. To use more than one partition you have to do the following, although do note that install.sh takes care of it: cd /boot; mkdir boot; ln -s ../uImage.bin boot/uImage-GTA02.bin; echo "root=/dev/mmcblk0p2" >boot/append-GTA02 # OR ;  echo "root=/dev/mmcblk0p2 console=tty0 loglevel=8" >boot/append-GTA02

Using U-Boot

Use U-Boot (git) – ready made binary 1 (Apr 09), 2 (Sep 09). All the programs concerned in this section to change configuration, fso-utils / configure-uboot, are about changing NAND-bootmenu that is flashed from the u-boot binaries.

When using uboot, if you have applied the below uboot configuration, the Debian System from SD-Card is booted by default. To Boot your normal system choose "Boot Flash" from uboot menu. If you did not modify the uboot configuration, but installed your Debian with vfat as the boot partition, enter the NOR (aux + power) or NAND (power + aux) U-Boot menu and select Boot from SD (fat+ext2) to boot Debian. If you are not using vfat + ext2 configuration, 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 a) Debian boots by default, from the MicroSD card, with an ext2 boot partition, b) The image installed in Flash can be booted by entering the NAND uBoot menu and selecting the second entry. To run the script, you need:

Now you can configure your uBoot using these commands 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 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.

Installing

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

To install Debian on your MicroSD card, you need to have any Linux system running already in flash. All official images (Om2007.2, Om2008.8, Om2009) should be fine. Ensure that your FreeRunner is connected to the Internet, either via USB or wireless.

Please make sure you have perl installed (opkg update, opkg upgrade & opkg install perl). When running under SHR, you might also have to install bash before being able to execute the script properly. When running under QtMoko (which is a Debian-based system by itself as well), you need to install rdate (apt-get install rdate).

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

Note: using a local mirror, the installation should take around 30 minutes to complete given an Internet connection of 5MB/s or 50 minutes with a 575kB/s one. You will download approximately 250MB.

$ wget -O install.sh http://pkg-fso.alioth.debian.org/freerunner/install.sh
$ chmod +x install.sh
$ ./install.sh # display usage instructions

install.sh usage instructions (web copy)

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

$ ./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.

Examples

To use a mirror of your choice:

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

Using Qi and only a single SD partition, installing all optional packages right away:

$ TASKS="ALL" QI=true SINGLE_PART=true ./install.sh all

You may want to add BOOTSTRAPPER=debootstrap to the above as cdebootstrap fails as of 23.11.2009 (that's why you need to install perl, see above). Also, install.sh may try to download older version of debootstrap and fail with 404 error; check the download site and correct the script.

Continuing in case of eg. temporary errors (for example network problems), this example continues right after partitioning has been done:

$ TASKS="ALL" QI=true SINGLE_PART=true ./install.sh format mount debian apt fso configuration tasks kernel cleanup unmount 

If you run into errors by using the default cdebootstrap method (phase "debian") you may want to use debootstrap instead, which is slower and requires more memory. It is not generally recommended, but you may try it anyhow:

$ BOOTSTRAPPER="debootstrap" TASKS="ALL" QI=true SINGLE_PART=true ./install.sh debian apt fso configuration tasks kernel cleanup 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. E.g. /mnt/debian/proc may stay mounted, which causes errors during "format" stage.

If you get any input/output errors, you might be having problems with SD card compatibility.

After Installation

Now be patient for a while, as the script downloads, installs and sets up everything it needs. Note that ANY errors probably mean the write failed, despite any final "all done" messages.

At the end of the script it tells you to reboot. Do it by pushing buttons, no just typing reboot, otherwise you will just reboot into the previous non-debian world.

The installation script configures dash as the default shell (i.e. /bin/sh). If you still prefer 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.

Starting to Use Your Debian System

Apart from this page, you may find answers to your questions in openmoko.org:s wiki page Getting Started With Your neo FreeRunner.

Qi:

If using Qi, just press power button to boot from SD card, ie. Debian (alternatively use the red LED indicator light + AUX button to select bootable partition).

U-Boot:

Press power+aux to start NAND Flash U-Boot bootmenu, and select the option you have crafted to boot Debian.

After Booting:

After booting you should see 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 FSO UI Tutorial. Debian, at the moment, does not ship Illume, so you do not have the status bars at the top. See below for alternatives.

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!

Users And Passwords

The default root password is blank. You should change that as soon as possible with passwd command.

Running X as normal user

1. Create a new user

# useradd -m -G audio,dialout,floppy,video,staff,powerdev username
# passwd username

2. Edit /etc/default/nodm (configuration file read by /etc/init.d/nodm) and change NODM_USER=root to NODM_USER=username in it.

3. Edit /etc/X11/Xwrapper.config and change allowed_users=console to allowed_users=anybody (Or use dpkg-reconfigure x11-common)

4. Copy /root/.xsession into ~username/, and change its ownership:

# cp /root/.xsession ~username/
# chown username:username ~username/.xsession

5. Note that, if you ran zhone as root first, you may have to change ownership or remove /tmp/zhone.log, as a normal user is not able to write to a file owned by root.

Suspend Settings

Press the power button or run 'apm -s' to suspend. To change the time for the display to darken/turn off edit or add in ~/.frameworkd.conf or /etc/frameworkd.conf the section

  [odeviced.idlenotifier]
  idle = 10
  idle_dim = 20
  idle_prelock = 12
  lock = 2
  suspend = 20

idle_dim is the time in seconds to dim the display (which adds up to the idle time), idle_prelock is the time to turn it off. You can turn off Suspend completely by commenting out the entire section "Idleness Brightness Handling" in /etc/freesmartphone/oevents/rules.yaml

Setting Time And Date

The default time zone is UTC. Reconfigure it by running

 dpkg-reconfigure tzdata

To set the clock manually do something like

 date -s 00:33

If you have a network connection, do something like

 apt-get install ntpdate
 ntpdate-debian

For more advanced ways like synchronizing from GPS clock, see Tips

Package Management

You can install dselect (~2.2MB) or aptitude (~12MB) to visually inspect the available debian packages using the desktop's console.

Also the GTK-based package-manager synaptic (~15.7MB) is working after installing lsb-release and hicolor-icon-theme.

Finally, on constrained systems, just issue the command:

grep -e Package: -e Description /var/lib/dpkg/available|more

Configuring Hardware Components

Bluetooth

The FreeRunner uses the standard Linux bluez stack, installed with

 apt-get install bluez-utils

The only atypical part of using bluetooth on the FreeRunner is turning it on, which can be done with

 mdbus -s org.freesmartphone.frameworkd  /org/freesmartphone/Device/PowerControl/Bluetooth SetPower 1

Then the device should be visible using

 hcitool dev

More tips at eg. openmoko wiki's Manually using Bluetooth page.

GPRS

See GPRS FSO page at Openmoko wiki.

GPS

GPS should work out-of-the-box "on-demand". Meaning that if you launch TangoGPS, GPS gets turned on etc.

Graphics (Smedia Glamo 3362)

By default debian uses fbdev, but we can use X.org xf86-video-glamo driver to get better performance:

 apt-get install xserver-xorg-video-glamo

after that edit /etc/X11/xorg.conf and change the line

 Driver          "fbdev"

to:

 Driver          "glamo"

You may also want to force the X server to 96 dpi to have the same fonts as with fbdev. Add "-dpi 96" to the X_OPTIONS variable in /etc/defaults/nodm:

 NODM_X_OPTIONS="-nolisten tcp -dpi 96"

An alternative to this is to change the font size, add gtk-font-name = "Sans 4" to /etc/gtk-2.0/gtkrc.

With glamo driver you:

Using glamo you must remember that:

Keyboards And Other Input Methods

As a default the Matchbox keyboard is installed, which you can use to input characters into your neo.

As an alternative you might want to install ?CellWriter. It is a grid-entry natural handwriting input panel. As you write characters into the cells, your writing is instantly recognized at the character level. It also features a full fledged onscreen keyboard. More information can be found on the homepage. Installation:

apt-get install cellwriter

Another alternative is literki transparent keyboard that is easy to bring up and hide with a finger swipe:

apt-get install literki

Sound and Music

Make sure to put your user in the audio group ("adduser <username> audio"), if you are not using the phone as a root user. If there is a problem with phone volumes, see Alsa state a7 @ openmoko.org.

For music playing, try installing intone, which is a finger usable music player providing skip-free audio playback on Neo:

apt-get install intone

WLAN

See main article DebianOnFreeRunner/WLAN.

Additional Software

Web Browser

Arne Anka suggested trying the light-weight webkit-based midori browser: apt-get install midori

Another webkit-based, but much more quick to start and simpler UI is woosh, currently only available in pkg-fso repository: apt-get install woosh

Another light-weight browser is Dillo. It can be easily installed with: apt-get install dillo

If you think the previous options are quite slow on Freerunner try Links2. apt-get install links2

Run as: xlinks2

GPS

Openmoko Freerunner has integrated a good AGPS chip that can be used to know in every moment the phone position. The most known free applications to use gps with graphical maps are:

E-Book reader

To read an E-Book you have diffent possibilities:

PIM

Osmo is a lightweigt pim application. Although you will not be able to make phonecalls right from its adressbook it is still helpful for managing contacts and appointments. apt-get install osmo It reads iCal-files, which you might want to syncronize with your desktop with unison. Start it with the option --tinygui to fit it on the screen. If xfce or other are installed you can start it via the menu with that option by changing in /usr/share/applications/osmo.desktop the according line to Exec=osmo --tinygui Just make sure you have a working swap: it takes quite some memory!

Choosing Kernel

You can provided special packaged versions of Linux kernel from pkg-fso repository, or basically any set of uImage.bin file and modules tar ball (unpacked to /lib/modules).

Debian way

When Debian is installed, the kernel is provided by the package linux-image-2.6.29-openmoko-gta02. Your kernel will be keep updated like the other packages of the system. You should use this way if you are unsure and you need an (almost) stable system.

'Caveat:' This package can be installed only in POSIX compliant filesystems, so it can not be used if your boot partition is a vfat one. The sole reason is that the tool dpkg cannot create the required symlinks from uImage to uImage-kernelversion, since the file system does not know symlinks. To save the situation, it is suggested to install the package anyway, then having /boot directory as a regular subdirectory, the first partition with the vfat not mounted. Once the kernel package was installed, copy the kernel image directly to the root (not a subdirectory) of the SD card's first partition.

Openmoko way

Otherwise you can choose to manual install an OM kernel. But only do this if you know what you are doing. At the moment there is a little problem in the question which kernel to use. Hopefully it will be solved in the near future.

The original openmoko kernel works fine inclusive suspending and supports different really nice usb gadgets (not all working at the moment). :)

Om2009: download stable: http://downloads.openmoko.org/distro/releases/ download testing: http://downloads.openmoko.org/distro/experimental/daily/

FSO: download testing: http://downloads.freesmartphone.org/fso-testing/images/<br> download unstable: http://downloads.freesmartphone.org/fso-unstable/images/

  1. Download a recent kernel and rootfs (tar.gz) from one of the above mentioned sources. It's your decision if you want suspend or usb gadget modules at the moment.

  2. Backup your running kernel like mv /boot/uImage.bin /boot/uImage.bin.old, then copy the downloaded uImage file to the freerunner as /boot/uImage.bin.

  3. Backup your actual modules like mv /lib/modules/2.6.24 /lib/modules/2.6.24.old, then extract the downloaded rootfs tar.gz to a temporary directory and copy lib/modules/2.6.24 from the temp directory to /lib/modules/2.6.24 on the FreeRunner.

  4. Do a chown -R root.root /lib/modules/2.6.24 because the owner from the tar.gz is something else (for me).

  5. Run a depmod -a.

  6. This step is only needed for the OM kernel but it doesn't harm the FSO kernel setup. Add "g_ether" Module to /etc/modules like echo g_ether >> /etc/modules. I read in an email, that the module "ohci-hcd" is also needed for some bluetooth functions, but i don't know this for real. I inserted it to my modules file to be on the safe side.

  7. Reboot and hope everything works as expected. :)

Support And Getting Involved

To have more information about Debian go to Debian homepage.

If you have some problems, you can find support in smartphone mailing list. Report your discovered bugs to this list but remember to put Joachim Breitner in CC.

If you'd like to help the packaging activities, you can join the fso maintainer list.

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

Reporting Bugs

Please always inform the FreeSmartphoneOrg packaging group about issues that you spot.

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 bugtracking system to file bugs against them, preferentially using the reportbug program. We will find them, and eventually the packages will be added to the repository and the bugs will apply to them.

The first time you use reportbug, please configure it with:

reportbug --configure

Be sure to select a working SMTP server, most of the ISPs block outgoing traffic on the port 25, which results in the following error (488417):

Submit this report on reportbug (e to edit) [Y|n|a|c|e|i|l|m|p|q|?]? y
Connecting to bugs.debian.org via SMTP...
SMTP send failure: (111, 'Connection refused')
Wrote bug report to /tmp/reportbug-reportbug-20080628-22940-UXH7BH

Before reporting any bug, please check if it has not been already submitted yet. All known bugs are listed here. It is always better to check each single package page, too. In case you have discovered a new bug, then submit it, but please:

Known Problems

FAQ

Running Debian chroot from within previous installation

If you are interested only in a few applications that Debian provides or if your interest is only cautious temporary, then run the Debian application in a chroot environment. The install.sh script prepares that for you in /mnt/debian. Then make sure, e.g. for the communication of the X server, that the same tmp and other key directories directory are used across the two Linux installations:

for f in dev proc sys tmp
do
        mount -t none -o bind /$f /mnt/debian/$f
done

You can then start your application of interest with the prefix "chroot /mnt/debian", as in

chroot /mnt/debian dpkg -l bash

Developing 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 qemubuilder.

To build packages for armel with qemubuilder, you can use this setup (everything run as root)

Qemubuilder always starts from a clean base image and installs only build dependencies needed by the package that is being built. This is nice for repeatable builds but can be slow if you only need to make test many small changes or want to debug the builds process interactively. For this reason you might want to fetch a complete arm installation from e.g. http://people.debian.org/~aurel32/qemu/armel/.

NOTE: Building with qemubuilder is rather slow; if you are a DD you can use the sid dchroot at agricola.debian.org to prepare packages (thanks to Gismo for the hint). -- ?GregorHerrmann

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

See Also

Derivative Distributions

Several Openmoko/FreeRunner-oriented distributions are sharing Debian's infrastructure. Of the ones below, QtMoko is the most popular according to 2009 Autumn poll at Openmoko community mailing list.

Examples Of How To Use Debian on the FreeRunner

Some ideas what you can do do from here