Debian on Archos gen(6?)7

Debian is a universal operating system used on many other embedded devices, and also on home computers. Using Debian on the Archos 5 gen7 gives access to the huge army of software packaged in the Debian repositories, already compiled for the arm processor.

For an existing Debian/Ubuntu? user, using Debian on Archos makes unit a very familiar, trustworthy and flexible place to hack in.

/!\ I wrote a big script to install a full debian on gen6 (will probably work on gen7/gen8 with minor tweaks), more info:  http://www.bawab.ch/archos5/debian -- imc

A guide on how to get Debian on Gen8 devices is availible at Debian gen8

Requirements

For debian installing, we need:

1) Archos gen7 device (gen6 not tested) with OpenAOS boot menu and at least 1G free space on disk.

2) Linux distribution (SDE, for example) already installed on Archos, or some arm-eabi based device with linux.

3) Computer with Linux - "host" - if you doesn't have direct internet connection on archos, or want to use normal shell (SSH).

4) And of course, the Internet!

Enable SSH and share the internet on SDE

If you have direct internet connection on your archos, you can skip this part.

1) In SDE root shell type:

rmmod musb_hdrc
modprobe musb_hdrc mode_default=2
modprobe g_ether

This will enable usb networking.

2) Connect the USB cable on the host machine and to configure the new network USB (as root):

ifconfig usb0 192.168.0.200 netmask 255.255.255.0

3) Enable Internet sharing

on host machine (as root):

iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1

on Archos:

echo nameserver XXX.XXX.XXX.XXX > /etc/resolv.conf

where XXX.XXX.XXX.XXX - your DNS ip (use 192.168.0.200 if you have an dns relay on host)

4) Test connecction on Archos:

# ping google.com
PING google.com (74.125.232.19) 56(84) bytes of data.
64 bytes from 74.125.232.19: icmp_seq=1 ttl=56 time=78.7 ms
64 bytes from 74.125.232.19: icmp_seq=2 ttl=56 time=78.3 ms
64 bytes from 74.125.232.19: icmp_seq=3 ttl=56 time=78.9 ms
64 bytes from 74.125.232.19: icmp_seq=4 ttl=56 time=79.5 ms

Installing Debian

Login to Archos using ssh (ssh on host) or just open root terminal in SDE (bad idea).

Prepare image and fs

Create image file (be careful with dd!!!):

dd if=/dev/zero of= bs=1M count=1024

Format it to ext3:

mke2fs -j 

Mount:

mkdir /mnt/debian
mount -o loop  /mnt/debian

Install debootstrap

wget http://ftp.de.debian.org/debian/pool/main/c/cdebootstrap/cdebootstrap-static_0.5.6_armel.deb
ar -x cdebootstrap-static_0.5.6_armel.deb data.tar.gz
tar -xz -C / -f data.tar.gz
rm data.tar.gz cdebootstrap-static_0.5.6_armel.deb

Note: You can change  http://ftp.de.debian.org to your prefered debian mirror.

Install base system using debootstrap

cdebootstrap-static --flavour=minimal --allow-unauthenticated --include=ifupdown,udev,procps,netbase,vim-tiny,module-init-tools,wget,openssh-server,screen,apmd squeeze /mnt/debian/ http://ftp.de.debian.org/debian/

Note: You can change  http://ftp.de.debian.org to your prefered debian mirror.

You can change squeeze (testing) to sid (unstable) or lenny (stable), but there might be a problems.

Debootstrap will download 100-200 MB of packages and install it to /mnt/debian.

Now you have debian-armel rootfs, but it not ready to work propely on Archos.

Configuration

Install modules

cp -R /lib/modules/* /mnt/debian/lib/modules

Configure network and hostname

echo "archos" > /mnt/debian/etc/hostname
cat > /mnt/debian/etc/network/interfaces <<__END__
auto lo
iface lo inet loopback
auto usb0
iface usb0 inet static
    address 192.168.0.202
    netmask 255.255.255.0
    network 192.168.0.0
    gateway 192.168.0.200
    up echo nameserver XXX.XXX.XXX.XXX >/etc/resolv.conf
__END__

Where XXX.XXX.XXX.XXX - you DNS (see above)

This runscript will start USB networking:

cat > /mnt/debian/etc/init.d/g_ether <<__END__
#!/bin/sh -e
. /lib/lsb/init-functions

case "\$1" in
  start)
    /sbin/modprobe g_ether
    sleep 2
    ifup usb0
    log_end_msg 0
    exit 0
    ;;

  stop)
    ifdown usb0
    /sbin/rmmod g_ether
    log_end_msg 0
    exit 0
    ;;

  restart)
    ifdown usb0
    /sbin/rmmod g_ether
    /sbin/modprobe g_ether
    ifup usb0
    ;;

  *)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 3
    ;;
esac
exit 0
__END__
chmod +x /mnt/debian/etc/init.d/g_ether

Atmega issue

Atmega pinger:

cat > /mnt/debian/sbin/ping_atmega <<__END__
#!/bin/sh
while true; do
   echo 1 > /sys/devices/platform/atmegag7-io/charge_rate
   sleep 60
done
__END__
chmod +x /mnt/debian/sbin/ping_atmega

Atmega pinger runscript:

cat > /mnt/debian/etc/init.d/atmega <<__END__
#!/bin/sh -e
. /lib/lsb/init-functions

case "\$1" in
  start)
        /sbin/ping_atmega &
        ;;
  stop)
        killall ping_atmega
        ;;

  *)
        echo "Usage: /etc/init.d/ping_atmega {start|stop}"
        exit 1
esac
exit 0
__END__
chmod +x /mnt/debian/etc/init.d/atmega

APT config

cat > /mnt/debian/etc/apt/apt.conf.d/99no-install-recommends << __END__
APT::Install-Recommends "0";
__END__

/etc/fstab

mkdir /mnt/debian/media/data
cat > /mnt/debian/etc/fstab << __END__
rootfs     /                ext3    defaults,errors=remount-ro,noatime 0 1
/dev/sda1  /media/data      ext3    defaults,noatime                   0 0
__END__

Your data will mount to /media/data in Debian.

Finalazing

Chroot to debian:

chroot /mnt/debian /bin/bash

Change root password:

passwd

Remove debootstrap:

apt-get --yes --purge remove cdebootstrap-helper-rc.d

Add our scripts to autostart:

update-rc.d g_ether defaults
update-rc.d atmega defaults

Install locales:

apt-get update
apt-get install locales

Edit /etc/locale.gen file and uncomment needed locales, than execute

locale-gen
exit
umount /mnt/debian

Congratulations!!! You have a debian on your Archos! Don't forget to add debian to menu.lst. After reboot you'll able to connect Debian throught SSH.

Now you can install a thousands of programs from Debian repositories using apt-get.

GUI

All commands below must be run at target debian after reboot and login throught ssh as root

X server

Install Xorg and touchscreen module:

apt-get install xorg xserver-xorg-input-tslib libts-bin nodm

Configure Xorg:

cat > /etc/X11/xorg.conf <<__END__
Section "Device"
       Identifier      "Configured Video Device"
       Driver          "fbdev"
EndSection

Section "InputDevice"
       Identifier "Touch"
       Driver "tslib"
       Option "TslibDevice"    "/dev/input/event2"
EndSection
__END__

Calibrate you touchscreen:

TSLIB_TSDEVICE=/dev/input/event2 ts_calibrate

XFCE + Matchbox

My preferred variant. Install XFCE and matchbox:

apt-get install xfce4 matchbox

Configure you X session:

cat > ~/.xsession <<__END__
#!/bin/sh
exec matchbox-window-manager -use_titlebar no -use_cursor no &
xfce4-session
__END__

Start GUI:

/etc/init.d/nodm start

Enjoy!

Index of Debian wiki pages:

Note: This will list all pages with Debian as prefix.


Recent wiki additions/changes:

01/29/13

05/13/12

08/22/11