Differences between revisions 125 and 126
Revision 125 as of 2009-05-06 14:16:14
Size: 26008
Comment: update qemu bugreport number
Revision 126 as of 2009-05-06 14:17:59
Size: 26054
Comment: fix signature
Deletions are marked like this. Additions are marked like this.
Line 288: Line 288:
  * With {{{MEMORY_MEGS=512}}}, qemu-system-arm may segfault and qemubuilder hang. See [[http://bugs.debian.org/503091|#503091]] and [[http://bugs.debian.org/527264|#527264]]. @SIGN@   * With {{{MEMORY_MEGS=512}}}, qemu-system-arm may segfault and qemubuilder hang. See [[http://bugs.debian.org/503091|#503091]] and [[http://bugs.debian.org/527264|#527264]]. -- StephaneGlondu <<DateTime(2009-05-06T14:17:59Z)>>

Installing and Using Debian on an OpenMoko FreeRunner

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

Card size

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.

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 > 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'.

Swap partition

Some have reported a swap partition helps. 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.

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: 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
Auto-Installer for Debian on the Openmoko FreeRunner (GTA02) v1.1
-----------------------------------------------------------------
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)
  FSO_MIRROR       the Debian FSO repository (default to
                   http://pkg-fso.alioth.debian.org/debian)
  FSO_DEVICE       the device the installation is being performed on
                   (default to gta02, possible value is gta02 only)
  QI               if you use Qi bootloader set this to true
                   (default to false)
  QI_VERBOSE_BOOT  set this to true if you want to see the kernel messages
                   do this only when QI=true (default to false)
  SINGLE_PART      set this to true if only one partition should be created
                   this is true by default for QI=true and false if SD_PART1_FS=vfat
Stages:
  all              Runs all the stages in the following order:
                   testing time partition format 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 $RDATEHOST via rdate
  partition        Partitions the microSD card found in $SD_DEVICE
                   (WARNING, this will destroy all the data on the
                   microSD card unless the partioning is the same as
                   used before; this can be used to recover a broken
                   partiton table due to the suspend/resume problem)
  format           Formats the microSD card found in $SD_DEVICE
                   (WARNING, this will destroy all the data on the
                   microSD card)
  mount            Mounts microSD card partitions under $INST_DIR
  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 the Debian kernel package
                   (only when $SD_PART1_FS is set to ext2)
  unmount          Unmounts the Debian filesystem mounted at $INST_DIR
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, only when $SD_PART1_FS is set to ext2)
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 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 some options:

I) Modify your NAND 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, 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.)

III) Instead learn about Qi , which however needs /boot to be on the same partition as / .

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 some larger SD cards, there is a known issue which prevents them from working properly. There is a workaround that involves modifying the uboot environment.

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

Booting Freerunner

NOR is readonly. Press aux+power to boot NOR-bootmenu, there are fat+ext2. (This works very badly with debian, because debian wants boot from ext. But this has worked!)

NAND is writable. Press power+aux to boot NAND-bootmenu. All these fso-utils and configure-uboots are about changing NAND-bootmenu.

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 NOR 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:

  • Debian boots by default, from the MicroSD card, with an ext2 boot partition.

  • The image installed in Flash can be booted by entering the NAND uBoot menu and selecting the second entry.

(Note that we're talking about modifying the NAND boot, not the NOR boot (which one reaches via pressing AUX then POWER)!)

To run the script, you need:

  • fso-utils, available from the pkg-fso apt source mentioned further down on this page installed on your local machine, not on your Freerunner (Section "Installing the FSO applications on your desktop")
  • dfu-util installed, available from the regular Debian archive
  • FreeRunner booted into NOR-Flash and connected via USB. (See the OpenMoko Wiki for more information)

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 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.You need to install the package dfu-util, despite the script's request to install dfo-util. Simple spelling mistake.

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

(Note that ANY errors probably mean the write failed, despite any final "all done" messages.)

Note that 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.

Using your Debian system

If you have applied the above 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, enter the NAND uboot menu and select Boot from SD (fat+ext2) to boot Debian.

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.

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/testing/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:

  • /UsbKeyboard: Use a USB keyboard.

  • Mount your partitions with relatime instead of noatime, if you use applications like mutt.

  • Install apmd. Then, zhone suspends the phone when you press POWER-BUTTON for more than a second. If it does not work, make sure that the apmd daemon is not started, there seems to be a strange bug with Xorg, apmd and the kernel

  • If you have fast internet connection "apt-get update" can spend considerable time applying pdiffs. You can skip pdiff processing with this command: apt-get update -o Acquire::PDiffs=false, or change the preference permanently by adding the line Acquire::PDiffs "false"; to the file /etc/apt/apt.conf (possibly by creating that file)

  • You might want to grab http://svn.openmoko.org/trunk//src/target/audio/om-gta02/voip-handset.state so you can start playing with voip.

  • Install some of the following FreeRunner-targetted packages available in Debian:

    • fso-gpsd gpsd-compatibility daemon, for example for !TangoGPS

    • openmoko-panel-plugin to add FreeRunner-specific information and control to your XFCE- or whatever-panel. You can use this also with matchbox if you install and run trayer in your X session.

    • pypennotes record notes on the touchscreen. (Start with pyPenNotes.py on the command line.)

    • remoko control your Desktop with your FreeRunner (read the /usr/share/doc/remoko/README.Debian, though!)

    • Adjust the timezone to your own, using dpkg-reconfigure tzdata.

    • Free up some space by installing localepurge which delets unused locales and manpages.

      • Alternatively add some dpkg filtering (once that is supported).
  • Use Qi bootloader

    • debian-gta02:~# cd /boot

    • debian-gta02:/boot# mkdir boot

    • debian-gta02:/boot# ln -s ../uImage.bin boot/uImage-GTA02.bin

    • debian-gta02:/boot# echo "root=/dev/mmcblk0p2" >boot/append-GTA02

    or
    • debian-gta02:/boot# echo "root=/dev/mmcblk0p2 console=tty0 loglevel=8" >boot/append-GTA02

    then following this Download_and_installation

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

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 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 (bug #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:

  • CC pkg-fso-maint@lists.alioth.debian.org . If you use the reportbug program, please use the X-Debbugs-CC header instead.

  • mention that the package is not yet in the archive, to prevent confusion for the bugtracker admins, something like This package is not yet in Debian but it will be soon, please see http://wiki.debian.org/pkg-fso.

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

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

  • Get qemubuilder v0.48 or newer (otherwise qemubuilder does not know the armel architecture)
  • Get a kernel from http://ftp.us.debian.org/debian/dists/sid/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.26-1-versatile

  • Create a configuration file armel-rc with this content (adjust paths to your liking):

    KERNEL_IMAGE=/var/cache/pbuilder/armel/vmlinuz-2.6.26-1-versatile
    ARCH=armel
    BASEPATH=/var/cache/pbuilder/armel/base.qemu
    MEMORY_MEGS=256
    MIRRORSITE=http://the-mirror-of-your-choice/debian
  • Run qemubuilder --configfile armel-rc  --create

  • Run qemubuilder --configfile armel-rc  --login --save-after-login and adjust the apt-sources (see above)

  • Run qemubuilder --configfile armel-rc  --update

  • Build packages with qemubuilder --configfile armel-rc  --build package.dsc

  • Extra tip: If you copy armel-rc as ~/.pbuilderrc you don't need to specify "--build armel-rc" every time you use qemubuilder.
  • NOTE: If you are getting a kernel panic with an error like Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0), then you may want to try using an older kernel version at http://people.debian.org/~aurel32/qemu/armel/.

  • NOTE: after having some trouble with setting up qemubuilderr, i've put working instructions and a working kernel image to http://yoush.homelinux.org:8079/tech/setting-up-armel-qemubuilder -- ?NikitaYoushchenko 2009-01-03 15:37:00

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

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

  • During the "debian" stage of the install, what does "E: Internal error: install" mean and how do I fix it?
    • One possible cause is a problem with the armel packages in Debian. Check /mnt/debian/var/log/bootstrap.log for dependency problems or the like.

    • If corrupt packages appear, then it might be related to the microSD card used in the installation, as explained in the discussion at the smartphones-standards. Other information are available in the upstream bug.

  • Problems booting the image could also be microSD related. See this mail for one possible fix.

  • If you get error messages like unknown type 255 when accessing SMS or the contact book, you can add the number in question to /var/lib/python-support/python2.5/framework/subsystems/ogsmd/gsm/const.py, line 805, to the list in

    phonebookTupleToNumber assert ntype in ( 129, 145, 208 ), "unknown type %i" % ntype
  • lindi from the irc channel has a nice script located at http://iki.fi/lindi/openmoko/energy-logger2 to get battery information.

  • It wold be helpful if you then find out what kind of number that is and suggest at http://trac.freesmartphone.org/ that this number is added to the list. Note that at the moment this issue has been worked around in a patch to the debian package so that it only gives an error message but does not exit the program.

See also

  • Hackable1 is a community distribution for hackable devices like the Neo Freerunner. It is based on Debian and implements the GNOME mobile platform.

  • DebianOnFreeRunnerTips for tips