Aphasia Development Tutorial

From Openmoko

Revision as of 10:10, 17 July 2009 by Skvamme (Talk | contribs)

Jump to: navigation, search

Contents

Installation

OpenWrt

Aphasia sits on the OpenWrt platform. It's very configurable, and light on system resources. There's a great forum at [1]

Go to OpenWrt, section Build custom image and follow the instructions. When you are at the point Configure target and packages you have to do some choises. Here is the minimum installation for Aphasia:

make menuconf

OpenWrt Kamikaze (r16871) Configuration

Target System (Samsung S3C24xx [2.6])  --->    Samsung S3C24xx [2.6]
Target Profile (Openmoko GTA-02 (minimal))  --->   Openmoko GTA-02 (minimal)

[*] Image configuration  ---> (192.168.0.202) LAN IP Address 

Xorg  --->    app  ---> <*> xauth
Xorg  ---> driver  ---> <*> xf86-input-tslib
Xorg  ---> driver  ---> <*> xf86-video-glamo
Xorg  --->   font  ---> <*> dejavu-fonts-ttf

Network  ---> <*> gpsd
Network  ---> <*> ser2net

Phone  ---> <*> freerunner-alsa-scenarios

Utilities  ---> <*> alsa-utils
Utilities  ---> <*> bash

Extra packages  --->  <*> zoneinfo-europe

Sound  --->   <*> lame
Sound  --->   <*> madplay

Languages  ---> <*> erlang


Install the GUI package ex11

Take a look at this example of what you can do with ex11 [2] Download from http://projects.openmoko.org/frs/?group_id=59 It is sufficient if you take the file at http://projects.openmoko.org/frs/download.php/753/ex11_lib.tgz and unzip it in your source directory.

In file /root/.profile

export DISPLAY=:0

In file /etc/hosts remove . (dot) at the end of line localhost.

127.0.0.1 localhost

In file /root/.erlang

io:format("Running Erlang from root~n").
code:add_patha("/root/trunk").

I keep my erlang source in /root/trunk

Copy Xauthority from host

scp .Xauthority phone:/root

Add localhost to it with xauth

xauth
add OpenWrt/unix:0 MIT-MAGIC-COOKIE-1  cfcc5ef98f9718f90154f355c0ae9f62
exit
cp .Xauthority /

Runtime Environment

Include erlang VM in the boot process, simply add a line to /etc/init.d/x11 right after sleep 1:

start() {
  export DISPLAY=":0"
  config_load x11
  Xorg $ARGS &
  sleep 1 # give the xserver some time get initialized
  erl -setcookie SFEWRG34AFDSGAFG35235 -name neo@192.168.0.202 -noshell -pa /root/trunk -s main start > debug.txt
}

Graphics

I'm using vector graphics to produce new widgets. Vector graphics is lightweight and programmable, easy to scale and rotate, and the Byte-Size is small. Use any vector-capable drawing application. I happen to use AutoCAD LT on Wine, but please suggest an open source alternative and I will be happy to create another small conversion program to translate the new drawing file to erlang source. If you have access to AutoCAD, take dxf2erl.erl from here

Drawing a widget in AutoCAD LT

Screencast here

Convert drawing to erlang source

Screencast here

Personal tools

Installation

OpenWrt

Aphasia sits on the OpenWrt platform. It's very configurable, and light on system resources. There's a great forum at [1]

Go to OpenWrt, section Build custom image and follow the instructions. When you are at the point Configure target and packages you have to do some choises. Here is the minimum installation for Aphasia:

make menuconf

OpenWrt Kamikaze (r16871) Configuration

Target System (Samsung S3C24xx [2.6])  --->    Samsung S3C24xx [2.6]
Target Profile (Openmoko GTA-02 (minimal))  --->   Openmoko GTA-02 (minimal)

[*] Image configuration  ---> (192.168.0.202) LAN IP Address 

Xorg  --->    app  ---> <*> xauth
Xorg  ---> driver  ---> <*> xf86-input-tslib
Xorg  ---> driver  ---> <*> xf86-video-glamo
Xorg  --->   font  ---> <*> dejavu-fonts-ttf

Network  ---> <*> gpsd
Network  ---> <*> ser2net

Phone  ---> <*> freerunner-alsa-scenarios

Utilities  ---> <*> alsa-utils
Utilities  ---> <*> bash

Extra packages  --->  <*> zoneinfo-europe

Sound  --->   <*> lame
Sound  --->   <*> madplay

Languages  ---> <*> erlang


Install the GUI package ex11

Take a look at this example of what you can do with ex11 [2] Download from http://projects.openmoko.org/frs/?group_id=59 It is sufficient if you take the file at http://projects.openmoko.org/frs/download.php/753/ex11_lib.tgz and unzip it in your source directory.

In file /root/.profile

export DISPLAY=:0

In file /etc/hosts remove . (dot) at the end of line localhost.

127.0.0.1 localhost

In file /root/.erlang

io:format("Running Erlang from root~n").
code:add_patha("/root/trunk").

I keep my erlang source in /root/trunk

Copy Xauthority from host

scp .Xauthority phone:/root

Add localhost to it with xauth

xauth
add OpenWrt/unix:0 MIT-MAGIC-COOKIE-1  cfcc5ef98f9718f90154f355c0ae9f62
exit
cp .Xauthority /

Runtime Environment

Include erlang VM in the boot process, simply add a line to /etc/init.d/x11 right after sleep 1:

start() {
  export DISPLAY=":0"
  config_load x11
  Xorg $ARGS &
  sleep 1 # give the xserver some time get initialized
  erl -setcookie SFEWRG34AFDSGAFG35235 -name neo@192.168.0.202 -noshell -pa /root/trunk -s main start > debug.txt
}

Graphics

I'm using vector graphics to produce new widgets. Vector graphics is lightweight and programmable, easy to scale and rotate, and the Byte-Size is small. Use any vector-capable drawing application. I happen to use AutoCAD LT on Wine, but please suggest an open source alternative and I will be happy to create another small conversion program to translate the new drawing file to erlang source. If you have access to AutoCAD, take dxf2erl.erl from here

Drawing a widget in AutoCAD LT

Screencast here

Convert drawing to erlang source

Screencast here