Automatic emulation in Ubuntu

From Openmoko

Revision as of 02:05, 27 March 2008 by BioGeek (Talk | contribs)

Jump to: navigation, search

This is a tutorial for getting an emulation environment on an Ubuntu system. For other systems see the Installation_guide

Contents

Installation

You have to know that there is a great tool to get it running on a linux system, namely the MokoMakefile. This is a sort of wrapper round several instructions, so it is easy to set up and maintain a development environment. If you build the whole MokoMakefile, you will need approximately 12GB, a swap+ram memory of about 1GB and minimum 5 hours time. But we will only build it for Qemu (the emulator that I will use) and that needs (on my system) only 890mb and a 15 min of your time.

To get it running, you will have to tweak your ubuntu a little bit (This will not damage other programs, everything will work as before).

  • Open your terminal (Applications->Accessories->Terminal).
  • Enter following command and select NO if it ask to install dash as /bin/sh.
   sudo dpkg-reconfigure dash
  • Install the needed programs (You will have to enter your password):
   sudo apt-get install monotone git-core cogito python-dev ccache m4 sed bison make cvs gawk libc6-dev g++ subversion sharutils docbook openjade quilt libmpfr-dev libpcre3-dev texinfo texi2html libboost-date-time-dev libboost-filesystem-dev libboost-regex-dev libboost-test-dev libboost-dev zlib1g-dev build-essential dh-make debhelper devscripts gcc-3.4 lynx netpbm libsdl1.2-dev dosfstools help2man python-psyco lynx

Voila your system is ready to get the install the openmoko.

Now we will install Openmoko in a directory by downloading the MokeMakefile in it and build it.

  • Create a directory and go into the directory:
   mkdir openmoko
   cd openmoko
  • Get the MokoMakefile:
   wget http://www.rwhitby.net/files/openmoko/Makefile
  • Make the MokoMakefile and tell it, you want to install it for qemu:
   make qemu

This will download the necessarily files of the lastest release and build them following the MokoMakefile. After that it will start into the emulator for the first time. Voila your have now successfully installed openmoko onto your ubuntu system.

Help with running OpenMoko in Qemu

If OpenMoko is not already running in Qemu, you can start it by:

  • Open your terminal (Applications->Accessories->Terminal).
  • Go to the directory:
   cd openmoko
  • starting with the MokoMakefile
   make run-qemu

The first screen of OpenMoko will show a nice picture of the OpenMoko logo which will be followed almost immediately by the BOOT MENU, this is done by the bootloader.

In the BOOT MENU you can choose different options. To select an option you have to press enter (=aux) and to execute it, hit space (=power). The default selection will boot OpenMoko. Thus if the BOOT MENU shows, you just have to hit the space bar and the phone software will load.

While booting OpenMoko the progress will be shown in text mode. Depending on your computer's performance it might take a while (some minutes even) to complete the boot. When complete you will see the graphical interface as will be shown on the phone itself (but slightly larger due to the larger pixelsize of your screen).

A few pointers on using OpenMoko:

  • You can select the icon that looks like "+" for a list of applications you can run.
  • You can select the icon that looks like "three gears" for a list of applications that are running now. Here you can also terminate unwanted applications when you are unable to do so from within the application itself.
  • You can select the icon that looks like a "house" to get back to the first home screen.
  • The statusbar at the top is always shown and by clicking on the top-left corner you can switch to another application that is already running. The "Home" application is always running and clicking on it will bring you back to the home screen.

See Qemu for more advanced information on running OpenMoko in Qemu.

Installing ipk packages

First you need a xxx.ipk package, see toolchain on how to compile an application for the ARM CPU and create the package.

Note that if at this point you have the OpenMoko Qemu running, it is probably wise to terminate it first. Then you can install the xxx.ipk package for access by the Qemu emulator with:

cd openmoko
mkdir -p build/tmp/deploy/glibc/ipk/a
cp xxx.ipk build/tmp/deploy/glibc/ipk/a/xxx_a.ipk
make qemu-copy-package-xxx

Note: for some reason qemu-copy-package-xxx looks for above source file. Maybe this part can be improved, or a different command can overcome the problem of creating this directory.

When above make command was succesful the next time you start OpenMoko Qemu, you still need to make the installed application available in the application list. For this you can select from within OpenMoko the terminal application (Select icon that looks like "+" for the list of available applicaitons, select "Applications" and select the "Terminal"). In this terminal double-click, so you can type in the commands:

ipkg install /media/mmcblk0/xxx_a.ipk
exit

After the "exit" command you should return to the Task list, in which the newly added application should be listed under a name which was choosen when building the ipk package.

Update Openmoko

  • Open your terminal (Applications->Accessories->Terminal).
  • Go to the directory:
   cd openmoko
  • Update with the MokoMakefile
   make qemu

Extra

Create a menu item for openmoko

cd ~/openmoko gedit moko.sh

add the following

  1. !/bin/bash

cd ~/openmoko make run-qemu

then run chmod +x moko.sh alacarte

and add a menu item with the following values Name: OpenMoko Command: ~/openmoko/moko.sh

Problems

If you have any problems, just add it here

When trying flash-qemu-local, following error occurs:

   Create BBT and erase everything ? <y/N>
   Skipping bad block at  0x03ff0000
   Skipping bad block at  0x03ff4000
   Skipping bad block at  0x03ff8000
   Skipping bad block at  0x03ffc000
   
   Creating BBT. Please wait ...Bad block table not found for chip 0
   Bad block table not found for chip 0
   Bad block table written to 0x03ffc000, version 0x01
   Bad block table written to 0x03ff8000, version 0x01
   
   GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 88:  4153 Terminated              
   $qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic 
   -usb -monitor null 0<&0
   
   U-boot failed to finish writing in 300 seconds, giving up.
   
   make: *** [flash-qemu-local] Błąd 255

--mav 08:37, 9 October 2007 (CEST)

Same problem here. I'm trying to find a solution. Are you also using ubuntu gutsy?
Dolfje 00:46, 11 October 2007 (CEST)

I've got the Same Problem and i'm not able to find a workaround. Can anyone help?
Elessar 17 October 2007

I got the problem too, again on gusty (beta)
xuedi 17 October 2007

Same here, Gutsy, using MokoMakefile (but flash-qemu-official).
Gwicke 10:16, 18 October 2007 (CEST)

I've asked it into the bugzilla, maybe we will have an answer soon
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=937
Dolfje 21:07, 17 October 2007 (CEST)

Same problem, also using gutsy --Jestin 07:54, 31 October 2007 (CET)
I also have this exact problem, using Debian Lenny.
--Ericyyz 17:19, 07 November 2007 (EST)

This should be solved by the new qemu images.
Dolfje 18:47, 19 November 2007 (CET)

When trying run qemu, following error occurs:

   make run-qemu
   ( cd build/qemu && arm-softmmu/qemu-system-arm \
       -M neo -m 130 -usb -show-cursor \
       -usbdevice keyboard \
       -mtdblock openmoko/openmoko-flash.image \
       -sd openmoko/openmoko-sd.image \
       -kernel openmoko/openmoko-kernel.bin )
   Could not allocate physical memory
   make: *** [run-qemu] Fehler 1

update: before running make qemu, type /bin/bash and then it works
tomilee 14:32, 25 November 2007 (CET)

After issuing the command 'make qemu' in Gutsy, the installation eventually borks with

   make[2]: Leaving directory `/usr/local/src/openmoko/build/qemu/arm-softmmu'
   make[1]: Leaving directory `/usr/local/src/openmoko/build/qemu'
   [ -e images/openmoko ] || mkdir -p images/openmoko
   ln -sf `pwd`/openmoko/trunk/src/host/qemu-neo1973/openmoko/env images/openmoko/env
   ( cd images && ../openmoko/trunk/src/host/qemu-neo1973/openmoko/download.sh )
       Retrieving available builds list...
       Kernel is... not found
   make: *** [download-images] Error 255

BioGeek 02:03, 27 March 2008 (CET)

Personal tools

This is a tutorial for getting an emulation environment on an Ubuntu system. For other systems see the Installation_guide

Installation

You have to know that there is a great tool to get it running on a linux system, namely the MokoMakefile. This is a sort of wrapper round several instructions, so it is easy to set up and maintain a development environment. If you build the whole MokoMakefile, you will need approximately 12GB, a swap+ram memory of about 1GB and minimum 5 hours time. But we will only build it for Qemu (the emulator that I will use) and that needs (on my system) only 890mb and a 15 min of your time.

To get it running, you will have to tweak your ubuntu a little bit (This will not damage other programs, everything will work as before).

  • Open your terminal (Applications->Accessories->Terminal).
  • Enter following command and select NO if it ask to install dash as /bin/sh.
   sudo dpkg-reconfigure dash
  • Install the needed programs (You will have to enter your password):
   sudo apt-get install monotone git-core cogito python-dev ccache m4 sed bison make cvs gawk libc6-dev g++ subversion sharutils docbook openjade quilt libmpfr-dev libpcre3-dev texinfo texi2html libboost-date-time-dev libboost-filesystem-dev libboost-regex-dev libboost-test-dev libboost-dev zlib1g-dev build-essential dh-make debhelper devscripts gcc-3.4 lynx netpbm libsdl1.2-dev dosfstools help2man python-psyco lynx

Voila your system is ready to get the install the openmoko.

Now we will install Openmoko in a directory by downloading the MokeMakefile in it and build it.

  • Create a directory and go into the directory:
   mkdir openmoko
   cd openmoko
  • Get the MokoMakefile:
   wget http://www.rwhitby.net/files/openmoko/Makefile
  • Make the MokoMakefile and tell it, you want to install it for qemu:
   make qemu

This will download the necessarily files of the lastest release and build them following the MokoMakefile. After that it will start into the emulator for the first time. Voila your have now successfully installed openmoko onto your ubuntu system.

Help with running OpenMoko in Qemu

If OpenMoko is not already running in Qemu, you can start it by:

  • Open your terminal (Applications->Accessories->Terminal).
  • Go to the directory:
   cd openmoko
  • starting with the MokoMakefile
   make run-qemu

The first screen of OpenMoko will show a nice picture of the OpenMoko logo which will be followed almost immediately by the BOOT MENU, this is done by the bootloader.

In the BOOT MENU you can choose different options. To select an option you have to press enter (=aux) and to execute it, hit space (=power). The default selection will boot OpenMoko. Thus if the BOOT MENU shows, you just have to hit the space bar and the phone software will load.

While booting OpenMoko the progress will be shown in text mode. Depending on your computer's performance it might take a while (some minutes even) to complete the boot. When complete you will see the graphical interface as will be shown on the phone itself (but slightly larger due to the larger pixelsize of your screen).

A few pointers on using OpenMoko:

  • You can select the icon that looks like "+" for a list of applications you can run.
  • You can select the icon that looks like "three gears" for a list of applications that are running now. Here you can also terminate unwanted applications when you are unable to do so from within the application itself.
  • You can select the icon that looks like a "house" to get back to the first home screen.
  • The statusbar at the top is always shown and by clicking on the top-left corner you can switch to another application that is already running. The "Home" application is always running and clicking on it will bring you back to the home screen.

See Qemu for more advanced information on running OpenMoko in Qemu.

Installing ipk packages

First you need a xxx.ipk package, see toolchain on how to compile an application for the ARM CPU and create the package.

Note that if at this point you have the OpenMoko Qemu running, it is probably wise to terminate it first. Then you can install the xxx.ipk package for access by the Qemu emulator with:

cd openmoko
mkdir -p build/tmp/deploy/glibc/ipk/a
cp xxx.ipk build/tmp/deploy/glibc/ipk/a/xxx_a.ipk
make qemu-copy-package-xxx

Note: for some reason qemu-copy-package-xxx looks for above source file. Maybe this part can be improved, or a different command can overcome the problem of creating this directory.

When above make command was succesful the next time you start OpenMoko Qemu, you still need to make the installed application available in the application list. For this you can select from within OpenMoko the terminal application (Select icon that looks like "+" for the list of available applicaitons, select "Applications" and select the "Terminal"). In this terminal double-click, so you can type in the commands:

ipkg install /media/mmcblk0/xxx_a.ipk
exit

After the "exit" command you should return to the Task list, in which the newly added application should be listed under a name which was choosen when building the ipk package.

Update Openmoko

  • Open your terminal (Applications->Accessories->Terminal).
  • Go to the directory:
   cd openmoko
  • Update with the MokoMakefile
   make qemu

Extra

Create a menu item for openmoko

cd ~/openmoko gedit moko.sh

add the following

  1. !/bin/bash

cd ~/openmoko make run-qemu

then run chmod +x moko.sh alacarte

and add a menu item with the following values Name: OpenMoko Command: ~/openmoko/moko.sh

Problems

If you have any problems, just add it here

When trying flash-qemu-local, following error occurs:

   Create BBT and erase everything ? <y/N>
   Skipping bad block at  0x03ff0000
   Skipping bad block at  0x03ff4000
   Skipping bad block at  0x03ff8000
   Skipping bad block at  0x03ffc000
   
   Creating BBT. Please wait ...Bad block table not found for chip 0
   Bad block table not found for chip 0
   Bad block table written to 0x03ffc000, version 0x01
   Bad block table written to 0x03ff8000, version 0x01
   
   GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 88:  4153 Terminated              
   $qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic 
   -usb -monitor null 0<&0
   
   U-boot failed to finish writing in 300 seconds, giving up.
   
   make: *** [flash-qemu-local] Błąd 255

--mav 08:37, 9 October 2007 (CEST)

Same problem here. I'm trying to find a solution. Are you also using ubuntu gutsy?
Dolfje 00:46, 11 October 2007 (CEST)

I've got the Same Problem and i'm not able to find a workaround. Can anyone help?
Elessar 17 October 2007

I got the problem too, again on gusty (beta)
xuedi 17 October 2007

Same here, Gutsy, using MokoMakefile (but flash-qemu-official).
Gwicke 10:16, 18 October 2007 (CEST)

I've asked it into the bugzilla, maybe we will have an answer soon
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=937
Dolfje 21:07, 17 October 2007 (CEST)

Same problem, also using gutsy --Jestin 07:54, 31 October 2007 (CET)
I also have this exact problem, using Debian Lenny.
--Ericyyz 17:19, 07 November 2007 (EST)

This should be solved by the new qemu images.
Dolfje 18:47, 19 November 2007 (CET)

When trying run qemu, following error occurs:

   make run-qemu
   ( cd build/qemu && arm-softmmu/qemu-system-arm \
       -M neo -m 130 -usb -show-cursor \
       -usbdevice keyboard \
       -mtdblock openmoko/openmoko-flash.image \
       -sd openmoko/openmoko-sd.image \
       -kernel openmoko/openmoko-kernel.bin )
   Could not allocate physical memory
   make: *** [run-qemu] Fehler 1

update: before running make qemu, type /bin/bash and then it works
tomilee 14:32, 25 November 2007 (CET)

After issuing the command 'make qemu' in Gutsy, the installation eventually borks with

   make[2]: Leaving directory `/usr/local/src/openmoko/build/qemu/arm-softmmu'
   make[1]: Leaving directory `/usr/local/src/openmoko/build/qemu'
   [ -e images/openmoko ] || mkdir -p images/openmoko
   ln -sf `pwd`/openmoko/trunk/src/host/qemu-neo1973/openmoko/env images/openmoko/env
   ( cd images && ../openmoko/trunk/src/host/qemu-neo1973/openmoko/download.sh )
       Retrieving available builds list...
       Kernel is... not found
   make: *** [download-images] Error 255

BioGeek 02:03, 27 March 2008 (CET)