Building a Debian rootfs for gen8

Some general info:

This guide will probably work for other distros. You will need to install SDE angstrom which can be retained from archos and atleast booted angstrom one time. To get me started I used some guidelines from  http://www.dev.katlea-studio.com/. To make this guide complete I am using some copy/paste from his guide. I am running Ubuntu 10.04 so commands or dependencies that need to be installed are based on that. Also note that I own an A101IT so all the tests are done on that. I am using qemu with a virtual machine to install the distro. I know it isn't perfect, but it is a very easy way to get started.

If you want to test the rootfs build with this guide you can skip these step and goto step 15. 15) Things todo after first boot

1) Creating a work directory

We need a place on or host PC where we can get our work done. I am using /usr/src/debian. First make the dir and then make run the chown command so you get full read/write access as normal user. If it isn't stated otherwise in this guide I assume you run the commands that are mentioned in this directory.

$ sudo mkdir /usr/src/debian
$ sudo chown <your login> /usr/src/debian
$ cd /usr/src/debian

2) Installing Qemu on your host PC

$ sudo apt-get install qemu
$ sudo apt-get install qemu-kvm-extras

3) Create an image disk to use with qemu

First we will have to create an image disk where we can later install debian on. The command below will create a 2 Gb image which will be enough for debian with lxde desktop. If you want a bigger image just adjust the count accordingly. For example making a 3Gb image use count=3072. This is however not so important right now, you can also do it later when we make the final rootfs.img that we put on the archos. The only thing you have to think about is that your image will be large enough for your emulator and the things you want to install to get an initial image to get it working on the archos.

$ dd if=/dev/zero of=debianlxde.img bs=1M count=2048

We don't need to format the image, this will be done by the debian installer.

4) Download boot image and kernel for your virtual machine

You can find the following kernel (vmlinuz-2.6.32-5-versatile) and initrd (initrd.img-2.6.32-5-versatile) on  http://people.debian.org/~aurel32/qemu/armel/

$ wget http://people.debian.org/~aurel32/qemu/armel/initrd.img-2.6.32-5-versatile
$ wget http://people.debian.org/~aurel32/qemu/armel/vmlinuz-2.6.32-5-versatile

Then we also need the net installer from debian (initrd.gz).  http://ftp.de.debian.org/debian/dists/squeeze/main/installer-armel/current/images/versatile/netboot/

$ wget http://ftp.de.debian.org/debian/dists/squeeze/main/installer-armel/current/images/versatile/netboot/initrd.gz

5) Installing debian on our debianlxde.img

Now we are going to install debian on our earlier created debianlxde.img. Like mentioned above we are using the net installer, so you should be connected through the internet.

$ sudo qemu-system-arm -M versatilepb -kernel ./vmlinuz-2.6.32-5-versatile -initrd ./initrd.gz -hda ./debianlxde.img -m 256 -append "root=/dev/ram"

Before you will open a window in which will appear the debian net installer. Follow the onscreen instructions and install debian. The installer is idiot proof :) so if in doubt use the default option. Important is that you make a note of your username, password and the root password you use. In my case I used the following:

user: debian password: debian root password: debianroot

This all will take some time, so please be patient. It takes about 2 hours on my intel dual core (P7350). When the installer is completed it will reboot in the emulator, that is the moment you can close your qemu window and move on to the next step.

6) Installing the GUI and some basic apps

We now start qemu with the normal initrd.

$ sudo qemu-system-arm -M versatilepb -kernel ./vmlinuz-2.6.32-5-versatile -initrd ./initrd.img-2.6.32-5-versatile -hda ./debianlxde.img -m 256 -append "root=/dev/sda1 m=256M"

Qemu will start again and now with a debian command prompt. Login with the credentials you used in the installer, in my case user debian with password debian. Get root to install a GUI.

$ su

Enter your root password, in my case it was debianroot. Update the installer and install the lxde GUI, or whatever you want. Note the rest of the guide is based on lxde GUI.

$ aptitude update
$ aptitude install lxde

Please note this will take some time to complete, so again be patient.

After that I installed the following apps that I think are usefull in a first startup. ssh server, onscreen keyboard, battery monitor, the network manager wicd, alsa utils, omap video driver.

$ aptitude install openssh-server
$ aptitude install matchbox-keyboard
$ aptitude install xbattbar
$ aptitude install wicd
$ aptitude install alsa-utils
$ aptitude install xserver-xorg-video-omap3
$ shutdown now

I don't recommend installing more apps, because that can also easily be done on your archos. After the "shutdown now" debian will shutdown and you can close the qemu window.

7) Adjusting the debianlxde.img

Because we installed debian with a different kernel then we have on our archos to run angstrom we need to adjust the image a bit. Before we can modify the image we have to mount it to a directory so we can access the files. We also need some old files from the angstrom image so we need to mount that to.

First we create two directories so we can mount the images in them.

$ mkdir ./debianlxde
$ mkdir ./angstrom

Connect shutdown your archos and connect it to your PC. Start it up in recovery by holding the minus button and shortly press the power button. Keep the minus button presses until the white recovery screen appears. Go to recovery --> repair system and then start USB.MSC The A101IT mounts under /media/A101IT on ubuntu. Change this path to what yours needs to be in the following commands.

Because we are going to replace the rootfs.img from angstrom, we will rename it first so we don't overwrite it in the next steps.

$ mv /media/A101IT/rootfs.img /media/A101IT/rootfs.angstrom

Now we mount the image to our directory.

$ sudo mount -o loop /media/A101IT/rootfs.angstrom ./angstrom

We also have to mount our debianlxde.img, but that is a bit more work, because the net installer in debian creates also a swap partition in the image file. So we need to determine wich partition we need to mount in the image. I found a nice tutorial for this here  http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux

$ parted ./debianlxde.img

and we get the following

parted debian_2G_first.img
WARNING: You are not superuser.  Watch out for permissions.
Warning: Unable to open /usr/src/debian/debianlxde.img read-write (Permission denied).  /usr/src/debian/debianlxde.img has been opened read-only.
Warning: Unable to open /usr/src/debian/debianlxde.img read-write (Permission denied).  /usr/src/debian/debianlxde.img has been opened read-only.
GNU Parted 2.2
Using /usr/src/debian/debianlxde.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Now type the following at the prompt "unit" --> "B" --> "print" and the last "quit" to exit parted. You should see something like this

Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit                                                             
Unit?  [compact]? B                                                       
(parted) print                                                            
Model:  (file)
Disk /usr/src/android/debian_2G_first.img: 2147483648B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start        End          Size         Type      File system     Flags
 1      1048576B     2003828735B  2002780160B  primary   ext3            boot
 2      2004876288B  2146435071B  141558784B   extended
 5      2004877312B  2146435071B  141557760B   logical   linux-swap(v1)

(parted) quit 

The biggest is the ext3 partition and that is the one that we want. Notice the start offset "1048576B" which we need to declare in the mount loop command. To mount the debianlxde.img we do the following

$ sudo mount -o loop,offset=1048576B ./debianlxde.img ./debianlxde

8) Making the final image file

Like we did before

$ dd if=/dev/zero of=debianlxdefinal.img bs=1M count=2048

But now we have to format the image to ext3

mkfs.ext3 -F debianlxdefinal.img

Make a directory to mount and mount it

mkdir ./debianlxdefinal
sudo mount -o loop ./debianlxdefinal.img ./debianlxdefinal

Copy all the files from the mounted debianlxde.img to the new debianlxdefinal.img

$ sudo cp -rp ./debianlxde/* ./debianlxdefinal

Copy over some files we need from angstrom use -p option to preserve attributes.

$ sudo cp -p ./angstrom/boot/* ./debianlxdefinal/boot
$ sudo cp -rp ./angstrom/lib/modules/2.6.29-omap1 ./debianlxdefinal/lib/modules

9) Getting the wifi driver to work and load at startup

Well I assume you have build your driver according to General developers notes for gen8, but we will also need tiwlan_loader to load the firmware, ini file and calibration file. I compiled that from  http://omappedia.com/index.php?title=Wilink_Linux&redirect=no If someone knows a way to build it from archos sources please add the info to the wiki. The firmware.bin is obtainable from TI.

Also if you are using the driver from archos, only root has access to the internet. This is because of CONFIG_ANDROID_PARANOID_NETWORK see the following bug report for angstrom gen7 http://dev.openaos.org/ticket/59 To get the user to access the internet, we have to add a few groups to debian and make the user a member of it. Following command is to run on the archos booted in debian

$ sudo addgroup --gid 3001 bt
$ sudo addgroup --gid 3002 bt-net
$ sudo addgroup --gid 3003 inet
$ sudo addgroup --gid 3004 net_raw

And now adding the user to the groups supposing your user is "debian":

$ sudo adduser debian bt
$ sudo adduser debian bt-net
$ sudo adduser debian inet
$ sudo adduser debian net_raw

We are going to add a folder in the root of the rootfs where we will copy our needed files for the wlan. To succesfully load the firmware we will also need the tiwlan.ini and wlanconf.nvs (calibration file). However we will use a shortcut and copy them over from archos android on startup. We could do that for the rest of the files too, but it is more fun building stuff yourself :). Assuming your files are in the work directory (in my case /usr/src/debian), we will do the following.

$ sudo mkdir ./debianlxdefinal/wifi
$ sudo cp ./firmware.bin ./debianlxdefinal/wifi
$ sudo cp ./tiwlan_loader ./debianlxdefinal/wifi
$ sudo cp ./tiwlan_drv.ko ./debianlxdefinal/wifi

The wifi can then be loaded on your device as follows. Following command is to run on the archos booted in debian

$ sudo cp /media/data/misc/wifi/tiwlan.ini /wifi
$ sudo cp /media/data/misc/wifi/wlanconf.nvs /wifi
$ sudo insmod /wifi/tiwlan_drv.ko
$ sudo /wifi/tiwlan_loader -i /wifi/tiwlan.ini -f /wifi/firmware.bin -e /wifi/wlanconf.nvs

But we will make a startup script for that later, because we are not done yet with our rootfs.img (debianlxdefinal.img).

Some other things we have todo is checking the interfaces file, because we will use wicd.

$sudo gedit ./debianlxdefinal/etc/network/interfaces

Make sure there is nothing else in the file then the following. If there is comment it out with # in front of it or remove the lines. wicd will take care of everything else.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

Then I had a few problems with wicd. I got some errors while connecting through my network.

One error was the one here below. It doesn't seem to get the max_strength from the driver.

/usr/lib/pymodules/python2.6/wicd/wnettools.py
line 1442 integer division by zero (int max_strength) wnettools.py

I did a quick and dirty fix see below, I just edited the file and put in the line max_strength=1, better would be to put in a check if max_strength is 0 then ... Still have todo that, but this was for now the easiest way.

$ sudo gedit ./debianlxdefinal/usr/share/pyshared/wicd/wnettools.py

Put in the line max_strength=1 at line 1441 the # aren't needed, but is for my own convenience to find the fix quickly

        if strength in ['', None]:
            try:
                [(strength, max_strength)] = altstrength_pattern.findall(output)
            except ValueError:
                # if the pattern was unable to match anything
                # we'll return 101, which will allow us to stay
                # connected even though we don't know the strength
                # it also allows us to tell if 
                return 101
###############################################################################################################
        max_strength = 1 # Temp fix
###############################################################################################################
        if strength not in ['', None] and max_strength:
            return (100 * int(strength) // int(max_strength))
        elif strength not in ["", None]:
            return int(strength)

Then I had also the following error expecting string or unicode. It seems wicd can't get the correct bitrate from the driver.

connection.py 620 string or unicode
Traceback (most recent call last):
  File "/usr/share/wicd/daemon/monitor.py", line 52, in wrapper
    ret = func(self, *__args, **__kargs)

This I have also fixed the quick and dirty way.

$ sudo gedit ./debianlxdefinal/usr/share/wicd/daemon/monitor.py

Put in "1"] and comment out or remove wireless.GetCurrentBitrate(iwconfig)]

                info = ["wireless", str(wireless.GetCurrentNetwork(iwconfig))]
        elif state == misc.WIRELESS:
            self.reconnect_tries = 0
            info = [str(wifi_ip), str(wireless.GetCurrentNetwork(iwconfig)),
                    str(self._get_printable_sig_strength()),
                    str(wireless.GetCurrentNetworkID(iwconfig)),
                    "1"]#wireless.GetCurrentBitrate(iwconfig)]
        ######################## temp fix ########################
        elif state == misc.WIRED:
            self.reconnect_tries = 0
            info = [str(wired_ip)]
        else:
            print 'ERROR: Invalid state!'
            return True

Configure the wicd manager, we will do that by editing manager-settings.conf

$ sudo gedit ./debianlxdefinal/etc/wicd/manager-settings.conf

Make it look like below

[Settings]
wireless_interface = tiwlan0
pref_width = 449
prefer_wired = False
flush_tool = 0
use_global_dns = False
global_dns_dom = None
always_show_wired_interface = False
global_dns_1 = None
global_dns_2 = None
global_dns_3 = None
backend = external
should_verify_ap = 1
netprop_width = 414
link_detect_tool = 0
main_height = 400
dhcp_client = 0
sudo_app = 0
wired_connect_mode = 1
wired_interface = None
debug_mode = 0
pref_height = 383
netprop_height = 450
signal_display_type = 1
global_search_dom = None
auto_reconnect = True
main_width = 512
wpa_driver = wext

In ./debianlxdefinal/etc/wicd/wireless-settings.conf are the wireless settings like your ssid, key etc this can however be done in the wicd GUI when you first start debian.

10) Battery monitor

I have chosen for xbattbar monitor, because you can make a script for it to pass the right values to xbattbar. I made the following little script xbattbar.sh to read the values.

#!/bin/sh
#
# xbattbar.sh
#
# This script will get the right values for the battery status and send it to xbattbar
# xbattbar should be started as follows to use this script:
# xbattbar -a -t 6 -s /usr/bin/xbattbar.sh
# -a means always on top -t <#> specifies the thickness of the bar
ACONLINE="off"
AC=$(cat /sys/class/power_supply/ac/online)
#echo "ac = $ac"
if [ $AC = "1" ]; then
ACONLINE="on"
fi
BAT=$(cat /sys/class/power_supply/battery/capacity)
echo "battery=$BAT"
echo "ac_line=$ACONLINE"

We copy this script to /usr/bin in the debianlxdefinal.img and make it executable.

$ sudo cp ./xbattbar.sh ./debianlxdefinal/usr/bin
$ sudo chmod +x ./debianlxdefinal/usr/bin/xbattbar.sh

Then we also make sure it starts automaticly when X is started so we will make a file named "xbattbar.desktop" with the following inside.

[Desktop Entry]
Encoding=UTF-8
Name= Xbattbar
Comment=run battery monitor xbattbar
Exec=xbattbar -a -t 6 -s /usr/bin/xbattbar.sh

Then we copy this file to /etc/xdg/autostart/ assuming your username is debian else you have to replace it with the username you used.

sudo cp ./xbattbar.desktop ./debianlxdefinal/etc/xdg/autostart/

We have one problem with this, because capacity values aren't updated in /sys/class/power_supply/battery/capacity on debian. We need to run the batteryd from archos android to do that, more on this when we get to the startup script.

Some more commandline options for batteryd thanks to alex@debi

alex@archos:~$ /system/bin/batteryd -h
usage: batteryd [-dn] [-i interval] [-f file] [-v voltage]
	-d increase debug level,
	-i specify a mesurement interval (in seconds),
	-f output file for debug messages,
	-n dry run mode,
	-s no shutdown mode,
	-v get the battery level for the specified idle voltage.

11) Enable autologin

Because I have my USB host port broken on my A101IT and I haven't figured out how to start the onscreen keyboard at the login screen yet. I am using for now automatic login. To enable that we copy /usr/share/defaults.conf to /etc/gdm/gdm.conf and edit that file.

$ sudo cp ./debianlxdefinal/usr/share/gdm/defaults.conf ./debianlxdefinal/etc/gdm/gdm.conf
$ sudo gedit ./debianlxdefinal/etc/gdm/gdm.conf

Now we change at line 48 AutomaticLoginEnable=false to AutomaticLoginEnable=true and at line 49 we fill in our username, in my case debian.

gdm.conf

...
[daemon]
# Automatic login, if true the first attached screen will automatically logged
# in as user as set with AutomaticLogin key.
AutomaticLoginEnable=true
AutomaticLogin=debian
...

12) Sound on debian

Before we already have installed alsa-utils, we need that to get sound on our archos. We need to make an asound.conf to configure alsa in /etc. Create the following asound.conf I think this can be improved, so if you have any ideas please edit this wiki.

####################
# /etc/asound.conf #
####################
pcm.ossmix {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:0,0"            # make sure this matches the actual device
       period_time 0          # not necessary since ALSA 1.0pre
       period_size 4096       # Use a power of 2
       buffer_size 4096       # must be a multiple of period_size
       rate 44100             # not necessary; let alsa-lib handle this
   }
   bindings {
       0 0
       1 1                     # bind only the first 2 channels
   }
}
pcm.duplex
{
   type asym
   playback.pcm "ossmix"
   capture.pcm "dsnoop"
}
# Everything shall be dmixed, so redefine "default":
# Note that this is _not_ a good idea, since dmix doesn't allow mmap access currently
pcm.!default {
   type plug
   slave.pcm "duplex"
}
# OSS via aoss should d(mix)stroyed:
pcm.dsp0 {
   type plug
   slave.pcm "duplex"
}
ctl.ossmix {
   type hw
   card 0
}

Then copy the file to our mounted debian image in /etc

$ sudo cp ./asound.conf ./debianlxdefinal/etc/asound.conf

After the first start of debian on your archos you should run alsamixer from the command line and enable the speaker or headphone.

$ alsamixer

We will insmod the necessary modules from the mounted android squashfs in our startup script.

13) Omap video driver and xorg.conf

We also want debian to use the X11 omap driver, so we will have to make a xorg.conf to load it as default. We already installed the driver xserver-xorg-video-omap3 in paragraph 6 Create the following xorg.conf

Section "Module"

EndSection

Section "Monitor"
        Identifier      "Builtin Default Monitor"
EndSection

Section "Device"
        Identifier      "Builtin Default fbdev Device 0"
        Driver  "omapfb"
        Option "fb" "/dev/fb0"
EndSection

Section "Screen"
        Identifier      "Builtin Default fbdev Screen 0"
        Device  "Builtin Default fbdev Device 0"
        Monitor "Builtin Default Monitor"
EndSection

Section "ServerLayout"
        Identifier      "Builtin Default Layout"
        Screen  "Builtin Default fbdev Screen 0"

EndSection

Then copy it to /etc/X11 in your debian image

$ sudo cp ./xorg.conf ./debianlxdefinal/etc/X11

The log file when loading xorg.conf can be found at /var/log/Xorg.0.log look here if you have problems or want to try some things.

14) Startup script

We are going to make a startup script to automate some of the tasks and to be able to use some modules from archos android. The script will be started from rc.local, in the future it is probably better to use a /etc/init.d script, but for now it will do. Edit the script and then use chmod to make it executable.

$ sudo gedit ./debianlxdefinal/etc/rc.local
$ sudo chmod +x ./debianlxdefinal/etc/rc.local
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Start loading script and log it
/etc/startup.sh 1> /var/log/startup.log 2>&1
exit 0

I also added a log file which will appear in /var/log/ as startup.log, so we can see if something goes wrong.

Now the actual startup.sh

#!/bin/sh
#
# startup.sh
#
######################################################
# Script to do get some stuff done before logging in.#
######################################################


echo "mount /dev/mmcblk0p2 on /media/squashfs"
if [ -d "/media/squashfs" ]; then
 echo "squashfs exists"
else
mkdir /media/squashfs
fi
mount /dev/mmcblk0p2 /media/squashfs

echo "Mount the android squashfs to steal some modules and other stuff :)"
if [ -d "/android" ]; then
 echo "android exists"
else
mkdir /android
fi
mount -o loop,offset=256 /media/squashfs/androidmerged.squashfs.secure /android
if [ -d "/media/data" ]; then
 echo "/media/data exists"
else
mkdir /media/data
fi

echo "mount /dev/mmcblk0p4 on /media/data"
mount /dev/mmcblk0p4 /media/data
echo "copy the ini file and calibration file needed for wifi"
if [ -f "/wifi/wlanconf.nvs" ]; then
 echo "/wifi/wlanconf.nvs exists"
else
cp /media/data/misc/wifi/wlanconf.nvs /wifi
fi
if [ -f "/wifi/tiwlan.ini" ]; then
 echo "/wifi/tiwlan.ini exists"
else
cp /media/data/misc/wifi/tiwlan.ini /wifi
fi

echo "Make a symlink system in root because batteryd must be run from /system/bin, because archos probably used hardlinks in it"
if [ -L "/system" ]; then
 echo "system exists"
else
ln -s /android/system /system
fi

echo "alsa sound"
insmod /android/lib/modules/snd-soc-omap-mcbsp.ko
insmod /android/lib/modules/snd-soc-wl1271.ko
insmod /android/lib/modules/snd-soc-wm8988.ko
insmod /android/lib/modules/snd-soc-tda19989.ko
insmod /android/lib/modules/snd-soc-archos.ko

echo "run battery daemon at 10 seconds interval"
/system/bin/batteryd -i 10 &

echo "load the module and firmware for wifi"
insmod /wifi/tiwlan_drv.ko
/wifi/tiwlan_loader -i /wifi/tiwlan.ini -f /wifi/firmware.bin -e /wifi/wlanconf.nvs
echo "End this script :)"

Now copy the startup.sh to /etc in the debianlxdefinal.img and make it excutable.

$ sudo cp ./startup.sh ./debianlxdefinal/etc/
$ sudo chmod +x ./debianlxdefinal/etc/startup.sh

Finally we can umount our image and transfer it to the archos for a first start. Like always adjust the path to where your device is mounted. Also umount the other images because we are done.

$ sudo umount ./debianlxdefinal
$ sudo umount ./debianlxde
$ sudo umount ./angstrom
$ cp ./debianlxdefinal.img /media/A101IT/rootfs.img
$ sudo umount /media/A101IT

Reboot your archos in to SDE.

15) Things todo after first boot

If you didn't build the rootfs yourself download it here  http://www.openaos.org/wp-upload/gen8/debian/2011-05-23/ untar it, copy and rename it to rootfs.img in the root directory on your archos. The rootfs.img is debian with lxde desktop.

Working things:

- wifi

- sound

- battery monitor

Todo:

- alot

User name: debian

User password: debian

Root password: debianroot

Well if all goes well you should see before you a lxde desktop. On the bottom there will be your battery monitor, if you move your cursor over it it will display the status in the middle of the screen. We need todo a few things to get everything working ok. Open the networkmanager wicd by clicking on the icon in the right bottom and setup your wifi. Once we have that done notice the ip address it uses when you use dhcp. Note: onscreen keyboard can be found under Menu -> Accessoiries -> Keyboard

Now that we have our network up and running we can use ssh from our host computer to connect to the archos and enter the commands from there. Alot easier then using the os keyboard.

$ ssh YourArchosIp -l debian

First we will give our user sudo rights and reboot the archos to affect the changes.

$ su
$ adduser debian sudo
$ reboot

When your archos is rebooted in debian again. Use ssh to connect to the device like said above. Make now the following groups and add your user to it. Again, to affect those changes reboot the archos.

$ sudo addgroup --gid 3001 bt
$ sudo addgroup --gid 3002 bt-net
$ sudo addgroup --gid 3003 inet
$ sudo addgroup --gid 3004 net_raw
$ sudo adduser debian bt
$ sudo adduser debian bt-net
$ sudo adduser debian inet
$ sudo adduser debian net_raw

To enable sound run alsamixer on the command line and turn speakers or headphone on. See 12) Sound on debian

Some nice programms to install:

midori --> light weight webbrowser

$ sudo aptitude install midori

Searching the packages:

$sudo aptitude search "mplayer"

16) Bluetooth (Work In Progress)

It is possible to enable Bluetooth by using some files from the stock Android filesystem. You must first mount /media/system/androidmerged.squashfs.secure to /android (if you haven't done so already with the startup script).

$sudo mount -o loop,offset=256 /media/system/androidmerged.squashfs.secure /android

Then, create a symbolic link to /android/system (also covered by startup script)

$sudo ln -s /android/system /system

Copy modules st_drv.ko, bt_drv.ko, and fm_drv.ko from /lib/modules/2.6.29-omap1 to /lib/modules

$sudo cp /lib/modules/2.6.29-omap1/st_drv.ko /lib/modules
$sudo cp /lib/modules/2.6.29-omap1/bt_drv.ko /lib/modules
$sudo cp /lib/modules/2.6.29-omap1/fm_drv.ko /lib/modules

Copy firmware file from Android to /lib/firmware. The file is named TIInit...bts (forget the version number)

$sudo cp /android/lib/firmware/* /lib/firmware

Start the uim daemon that runs the ST driver and allows Bluetooth and FM to work

$sudo /system/xbin/uim /dev/ttyS0 3000000 1 /sys/uim/pid 19

At this point, Bluetooth should be enabled. You may now use the Debian GUI to pair devices. Do note, it is unstable and I have not been able to successfully pair a keyboard (did pair with my desktop just fine though). If it doesn't start, try installing rfkill (not sure if it's needed or not).

Update: I was able to pair a Bluetooth mouse (Microsoft Bluetooth Notebook Mouse 5000) and it worked perfectly! However, trying to pair my keyboard failed again (but did not actually shut down the Bluetooth device as the mouse still worked, I figured out it was just the Bluetooth menu that crashes). To restart the Bluetooth menu if you "crash" it,

$sudo /etc/init.d/bluetooth restart

should bring it back without shutting down any active Bluetooth devices. I think the issue may have to do with passkeys, the mouse did not require a passkey but the keyboard does, and trying to pair the keyboard fails right after it displays the passcode to enter (before you have a chance to enter it on the device). I have yet to try with other devices, the only two successful ones are my Windows 7 desktop and my mouse.

Custom rc.local script for Bluetooth (replaces the above one)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

if [ -d "/media/system" ]; then
 echo "system exists"
else
mkdir /media/system
fi
mount /dev/mmcblk0p2 /media/system

if [ -d "/android" ]; then
 echo "android exists"
else
mkdir /android
fi
mount -o loop,offset=256 /media/system/androidmerged.squashfs.secure /android

if [ -d "/media/data" ]; then
 echo "/media/data exists"
else
mkdir /media/data
fi
mount /dev/mmcblk0p4 /media/data

if [ -L "/system" ]; then
 echo "system exists"
else
ln -s /android/system /system
fi

/system/bin/batteryd -i 10 &
/system/xbin/uim /dev/ttyS0 3000000 1 /sys/uim/pid 19 &

cd /wifi
./ti-load

exit 0

17) Additional info for improving your debian img

Enable usb access for sdcard:

With thanks to sifourquier a little info on how to access the sdcard from your PC on your archos. Commands need to be executed on your archos.

$ sudo rmmod musb_hdrc
$ sudo modprobe musb_hdrc mode_default=3
$ sudo modprobe g_file_storage file=/dev/mmcblk2p1 stall=0

Enjoy and play around :)

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

Attachments