Version 1 (modified by ObKo, 3 years ago)

--

The openAOS Debian project

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.

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.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 root@192.168.0.202 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=<path_to_image> bs=1M count=1024

Format it to ext3:

mke2fs -j <path_to_image>

Mount:

mkdir /mnt/debian
mount -o loop <path_to_image> /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

Add to autostart

update-rc.d g_ether defaults

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
update-rc.d atmega defaults

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

Remove debootstrap:

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

Install locales:

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.

Later there will be tutorial about Xorg and some DEs.