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.

For more general Debian on Mobile Devices, user interface etc. topics, see Mobile wiki page.

In addition to scarcity of suitable packaged UI:s (see Mobile above), the main "to do" item regarding FreeRunner is the remaining kernel work. See Kernel/Upstreaming page on the Openmoko wiki for details of current patches. The kernel is the only package that is installed from the external pkg-fso repository.

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 was started as a GSoC 2010 project on a proper debian-installer support, which, if finished, would lead to better Debian installation experience for everyone.

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 (FSO) software stack is packaged and actively maintained for Debian. By default this means fso-deviced and friends, while the previous zhone phone software is abandoned since it only works with FSO1. The phoneui-apps from SHR works with the FSO2 now in Debian. Illume window management is available, as are most needed dependencies of the Enlightenment 17 environment. Paroli phone UI 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.

Slightly off-topic: your Openmoko is a complete computer with some hardware (accelerometers, wifi, bluetooth, usb, gsm) that is exceptional. Please do not feel alienated if that mobile computing aspect is of importance for you - it also is to us. And since there is so much that you can do with this little device, we cannot cover it all, and certainly we embrace your helping hands or stimulating ideas.

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 - 03/2012 - is: HIGH


some old quirks/fixes available in appendix a: troubleshooting

Before Installation

There are a few things to consider before installation.

SD Card

2GB MicroSD card or bigger is recommended. See the "New list" at Supported MicroSD Cards (wiki.openmoko.org).

Swap Partition Or File?

Consider a swap partition or a swap file, some have reported it is useful. The preparation of a swap partition 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.

Filesystem And Bootloader Choice

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

I) Learn about a small and fast bootloader, Qi, now in Debian as package qi, and use eg. QI=true ./install.sh all. This is described below in ”Using Qi”.

OR

II) Read Appendix C: Alternative Boot Choices.

Using Qi

Qi is the simplest bootloader to use.

Preferred: use the qi packaged in Debian, flashable from host computer. Read the README.Debian.

(random old links for history preservation purposes 1, 2, 3, 4, 5, 6.

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

Which distro to install from?

There is a problem related to install.sh's usage of fdisk and the wide variety of fdisk versions in the Neo FreeRunner distributions. Since install.sh requires something to run from, ie a distribution on the NAND flash, this may hit you easily. Known problems include the ones with fdisk version in SHR. Problems may be fixed by doing partitioning by hand and giving install.sh the other steps as parameters as shown in instructions below.

QtMoko is Debian based distribution, is NAND flashable and has a known good fdisk version (ie. similar to what install.sh has been developed with).

A proper solution would be to detect various fdisks and calculate the partition values taking the fdisk version into account.

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 via 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 and binutils (apt-get install rdate binutils).

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

Usage instructions (web copy)

You need a working network connection on Neo. Most FreeRunner distributions already have a default gateway over USB and should work, provided you allow network forwarding from your USB connected computer to Neo:

iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
echo 1 | tee /proc/sys/net/ipv4/ip_forward 
iptables -P FORWARD ACCEPT

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

(Recommended 03/2012) In case of troubles, a minimal installation after which you can apt-get on your own:

$ QI=true SINGLE_PART=true ./install.sh all

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 log 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 changeme. 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

And then, to set manually the date (eg. 9 Oct 2010):

date +%Y%m%d -s "101009"

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

First of all, a tremendous help to any Openmoko hardware configuring is the omhacks package. Use the om command from command line when in doubt, and use in scripts et cetera as you like.

Bluetooth

For more tips and for having more update infos please visit openmoko wiki's Manually using Bluetooth page.

The FreeRunner uses the standard Linux bluez stack, installed with

 apt-get install bluetooth

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

GPRS

See GPRS FSO page at Openmoko wiki.

GPS

GPS worked out-of-the-box "on-demand" with fso-gpsd, meaning that if you launch FoxtrotGPS, GPS gets turned on etc. Currently though gpsd is used, which means you need to turn GPS on with for example omhacks (official Debian repositories) or openmoko-panel-plugin (pkg-fso repository). For more infos see the Openmoko's wiki.

Graphics (Smedia Glamo 3362)

By default debian uses xf86-video-glamo X.org driver, but we can use X.org fbdev driver to get rid of possible problems:

 apt-get install xserver-xorg-video-fbdev

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

 Driver          "glamo"

to:

 Driver          "fbdev"

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

The default 2.6.34 kernel from pkg-fso repository does not support KMS. pkg-fso repository has an alternative version of x86-video-glamo that is compiled with KMS support, meaning that if you put a self-compiled 2.6.34 FreeRunner kernel with KMS support in, you get kernel mode-setting support.

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

Custom kernel

If you need to customize the Debian Openmoko kernel you can get the git url from gitweb. If you need to only change kernel configuration, the config file to change is stored in debian/config.gta02.

To build the kernel on armel a dpkg-buildpackage is enough, if you want to cross compile (and you want to) this works:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dpkg-buildpackage -aarmel

If your build fail because of a weird warning about a directory that already exists you can workaround the issue by adding -p option to the relevant mkdir in debian/rules.

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. :)

Kernel Branches in Autumn 2011

FreeRunner kernel development is sporadic and not very well organized. Here is a summary:

Distribution kernels (these more suitable for real use)

git.openmoko.org kernels

Some bugs that have patches but not in git.openmoko.org kernels: 2344, 2349, 2367, 2368. If you want to help on orchestrating kernel work at git.openmoko.org (other places fine as well), see information about getting write access at openmoko wiki.

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

Appendix A: Troubleshooting

Historical Installer Problems

You might be interested in these notes if the problems ever re-appear.

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

SD Cards, I/O Errors...

Neo FreeRunner with any kernel is somewhat picky about SD cards. 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. An important parameter to look at is the class of the SDHC: it goes from 2 to 6 as the I/O speed increases.

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

Low-level Bootloader Troubleshooting

You can use

$ sudo strings /dev/mtdblock0 | grep -E "^(U-Boot|Qi)" | head -n1
U-Boot 1.3.2-moko12 (May  9 2008 - 10:28:48)

to see what boot loader you have in NOR and

$ sudo strings /dev/mtdblock1 | grep -E "^(U-Boot|Qi)" | head -n1
Qi Bootloader s3c2442  fomalhaut lindi_9ef7754b8243457c

to see what boot loader you have in NAND. You can also use

$ sudo cat /dev/mtdblock2 | tr '\0' '\n'|sort|uniq

baudrate=115200
boot_menu_timeout=65000
bootargs_base=rootfstype=jffs2 root=/dev/mtdblock6 console=ttySAC2,115200 console=tty0 loglevel=8
bootcmd=setenv bootargs ${bootargs_base} ${mtdparts}; nand read.e 0x32000000 kernel; bootm 0x32000000
bootdelay=3
mtdids=nor0=physmap-flash,nand0=neo1973-nand
pcb_rev=0x000
pcf50633_int1=0x80
pcf50633_int2=0x03
stderr=usbtty
stdin=usbtty
stdout=usbtty
usbtty=cdc_acm
³pbootargs=

to see what U-boot environment variables you have set in NAND. Finally,

$ sudo file -sL /dev/mmcblk0p*
/dev/mmcblk0p1: Linux rev 1.0 ext2 filesystem data, UUID=c8e54a43-2b8e-4961-a581-b38c757f5359
/dev/mmcblk0p2: Linux rev 1.0 ext3 filesystem data, UUID=33be1de7-c16f-4c78-b089-2fb931fd4ede, volume name "openmoko" (needs journal recovery) (large files)
$ sudo file -sL /dev/mtdblock*
/dev/mtdblock0: data
/dev/mtdblock1: data
/dev/mtdblock2: data
/dev/mtdblock3: DOS executable (device driver)
/dev/mtdblock4: gzip compressed data, from Unix, last modified: Mon Mar 10 13:15:21 2008, max compression
/dev/mtdblock5: Linux rev 1.0 ext2 filesystem data, UUID=5fa9f6db-c615-40db-8b3d-731cc5e161ac
/dev/mtdblock6: Linux jffs2 filesystem data little endian

is a handy way to see what partitions and filesystems you are using.

Appendix B: 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'.

Appendix C: Alternative Boot Choices

I) Use Qi as in the main part of the guide

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.

---

Alternative: Using U-Boot

If you don't use Qi, read this section.

Use U-Boot (git) – ready made binaries 1 (Apr 2009), 2 (Sep 2009), 3 (Dec 2010, 2-4-2 timings + few fixes, read here). 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.