User:AndreasJellinghaus/GetStarted

From Openmoko

< User:AndreasJellinghaus(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
= Start developing applications for OpenMoko! =
+
== Start developing applications for OpenMoko! ==
 +
 
 +
Warning: this is my writeup from yesterday. I couldn't verify it today, because buildhost.openmoko.org is down.
  
 
Here is what you need to do.
 
Here is what you need to do.

Revision as of 19:45, 15 November 2007

Start developing applications for OpenMoko!

Warning: this is my writeup from yesterday. I couldn't verify it today, because buildhost.openmoko.org is down.

Here is what you need to do.

First, you need to have a recent image on your moko. Beware: this can brick your hardware, don't do any of this unless, you know what you are doing, and willing to take the risk.

In this example I don't update the uboot bootloader - you should do so only if you need to. Mine is fine. Also always only use tested versions of the bootloader - you can fix everything else if the bootloader is still working (as far as I know). But if the bootloader is broken, you need a debug board to fix the issue.

Warning: The URL below points to the images of the day. Sometimes they work, sometimes they don't. It would be much better to point to some tested release that is at least somehow stable, but I don't know where to find such a thing.

BASE=http://buildhost.openmoko.org/OM2007.2/tmp/deploy/glibc/images/neo1973/

wget $BASE/dfu-util
wget $BASE/uImage-neo1973-latest.bin
wget $BASE/openmoko-devel-image-fic-gta01.jffs2

chmod +x dfu-util

sudo bash
# ./dfu-util -a u-boot -R -D uboot-gta01bv4-latest.bin  # not needed
./dfu-util -a kernel -R -D uImage-neo1973-latest.bin
./dfu-util -a rootfs -R -D openmoko-devel-image-fic-gta01.jffs2

Next you need to get network access over USB to work for you. On my Ubuntu 7.10 I don't need to patch the kernel, load modules or anything like that, all I need to do is:

ifconfig usb0 192.168.0.200 netmask 255.255.255.0
route add -host 192.168.0.202/32 dev usb0

Now I can SSH to my Moko with

ssh root@192.168.0.202
Password is "root"

and now I can create a simple hello world application:

cat > hello_world <<EOF
#!/usr/bin/python

# Load in pygtk and gtk
 
import pygtk
pygtk.require('2.0')
import gtk
 
# Define the main window
 
class Whc:
    def __init__(self):
        # Window and framework
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
 
        # A Button, with an action
        # Add it to the geometry
        # show the button
        self.button = gtk.Button("First Button")
        self.button.connect("clicked", self.hello, None)
        self.window.add(self.button)
        self.button.show()
 
        # Show the window
        self.window.show()
 
# Callback function for use when the button is pressed
 
    def hello(self, widget, data=None):
        print "Hello World"
 
# Destroy method causes appliaction to exit
# when main window closed
 
    def destroy(self, widget, data=None):
        gtk.main_quit()
 
# All PyGTK applicatons need a main method - event loop
 
    def main(self):
        gtk.main()
 
if __name__ == "__main__":
    base = Whc()
    base.main()
EOF
chmod 0755 ./hello_world

and start it

DISPLAY=:0 ./hello_world

Issues not handled yet:

  • menu files so it can be started via the launcher
  • packaging of a new application
  • submitting of a new application to the openmoko team for inclusion
Personal tools

Start developing applications for OpenMoko!

Warning: this is my writeup from yesterday. I couldn't verify it today, because buildhost.openmoko.org is down.

Here is what you need to do.

First, you need to have a recent image on your moko. Beware: this can brick your hardware, don't do any of this unless, you know what you are doing, and willing to take the risk.

In this example I don't update the uboot bootloader - you should do so only if you need to. Mine is fine. Also always only use tested versions of the bootloader - you can fix everything else if the bootloader is still working (as far as I know). But if the bootloader is broken, you need a debug board to fix the issue.

Warning: The URL below points to the images of the day. Sometimes they work, sometimes they don't. It would be much better to point to some tested release that is at least somehow stable, but I don't know where to find such a thing.

BASE=http://buildhost.openmoko.org/OM2007.2/tmp/deploy/glibc/images/neo1973/

wget $BASE/dfu-util
wget $BASE/uImage-neo1973-latest.bin
wget $BASE/openmoko-devel-image-fic-gta01.jffs2

chmod +x dfu-util

sudo bash
# ./dfu-util -a u-boot -R -D uboot-gta01bv4-latest.bin  # not needed
./dfu-util -a kernel -R -D uImage-neo1973-latest.bin
./dfu-util -a rootfs -R -D openmoko-devel-image-fic-gta01.jffs2

Next you need to get network access over USB to work for you. On my Ubuntu 7.10 I don't need to patch the kernel, load modules or anything like that, all I need to do is:

ifconfig usb0 192.168.0.200 netmask 255.255.255.0
route add -host 192.168.0.202/32 dev usb0

Now I can SSH to my Moko with

ssh root@192.168.0.202
Password is "root"

and now I can create a simple hello world application:

cat > hello_world <<EOF
#!/usr/bin/python

# Load in pygtk and gtk
 
import pygtk
pygtk.require('2.0')
import gtk
 
# Define the main window
 
class Whc:
    def __init__(self):
        # Window and framework
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
 
        # A Button, with an action
        # Add it to the geometry
        # show the button
        self.button = gtk.Button("First Button")
        self.button.connect("clicked", self.hello, None)
        self.window.add(self.button)
        self.button.show()
 
        # Show the window
        self.window.show()
 
# Callback function for use when the button is pressed
 
    def hello(self, widget, data=None):
        print "Hello World"
 
# Destroy method causes appliaction to exit
# when main window closed
 
    def destroy(self, widget, data=None):
        gtk.main_quit()
 
# All PyGTK applicatons need a main method - event loop
 
    def main(self):
        gtk.main()
 
if __name__ == "__main__":
    base = Whc()
    base.main()
EOF
chmod 0755 ./hello_world

and start it

DISPLAY=:0 ./hello_world

Issues not handled yet:

  • menu files so it can be started via the launcher
  • packaging of a new application
  • submitting of a new application to the openmoko team for inclusion