Debian on APF

From ArmadeusWiki
Revision as of 19:59, 13 January 2012 by FrancoisG (Talk | contribs) (Tweaking the filesystem)

Jump to: navigation, search

Page under construction... Construction.png Informations on this page are not guaranteed !!

This page details how to install Debian on an APF51.

Requirements

  • an APF51 board
  • a development PC running linux
  • the debootstrap program installed on the development PC
  • the qemu-user ARM statically linked on the development PC
  • about an hour of free time

Preparing the development PC

  • In this tutorial, we have used Ubuntu 11.10 on the development PC. Any other distribution can be used with some adjustments but of course, Debian based distributions are recommended.
  • Let's first install all the packages that will be used :
$ sudo apt-get install debootstrap qemu-user-static
  • then get in a root shell and prepare a work folder:
$ sudo su
# mkdir /root/apf51_debian
# cd /root/apf51_debian

Bootstrapping the Debian filesystem

  • The debootstrap command is generating a base debian filesystem by downloading all debian base packages and unpacking them in a folder, in order to build a fresh debian root filesystem.
  • Installing deb packages is not only extracting archive files, it also consists in running scripts after unpacking the files. Running these scripts is handled by the script interpreters that have been unpacked in the generated folders. Therefore generating an ARM debian filesystem on an x86 based computer requires to do this in two steps.
  • Let's run the first step. That one consists in downloading all the deb packages and unpacking the files, but without running the scripts :
# debootstrap --foreign --arch=armel squeeze rootfs http://ftp.debian.org/debian 
  • The foreign option makes debootstrap stop right after unpacking. The arch option specifies the architecture we want to make a rootfs for, armel is the name of the ARM port of debian. Then in order we have squeeze, which is the name of the debian version we want to get, currently squeeze is the stable version. Then rootfs is the name of the subfolder where debootstrap will work. Finally the URL of the debian mirror we want to use (you can use another one which sits in your country, to make it faster).
  • This process takes a while, it will download all the debian base packages from the mirror and unpack them in the rootfs folder.
  • The next step is to run the second stage of debootstrap. That stage consists in finalizing the installation of the package by running the scripts I mentionned. Since these scripts will be executed using the interpreter who is in the new filesystem, and not by the interpreter from your development PC, we are now facing a problem : The interpreter in that new filesystem is an ARM program, and won't run on an x86 system. To overcome this, we will make use of qemu, who allows to run foreign architecture linux programs by doing emulation.
  • First, we need to copy the qemu binary into the new filesystem :
# cp /usr/bin/qemu-arm-static rootfs/usr/bin
  • Then we can launch the second stage of debootstrap, qemu will automatically let it run the ARM binaries through qemu :
# DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot rootfs debootstrap/debootstrap --second-stage
  • This process also takes a while, it will run the scripts of each package, in order to finalize the packages installation.

Tweaking the filesystem

  • After the filesystem has been generated by debootstrap, some adjustments need to be done.
  • First, we need to have debian run a getty on the console serial port (ttymxc2), otherwise no login prompt will be available on the console port :

Copying the filesystem on the APF

TODO