Contact Us
EnglishRussianGreek
Home Wiki

Building G155 Android

From GizmoForYou Wiki

Jump to: navigation, search

Contents

Overview

In this documentation we shall be describing how to setup and build GizmoForYou Android environment for the Latest Gumstix based FLOW G1.55 At the time of this writing this process has been tested on Ubuntu 9.10 through VMware although the same process can be also accomplished on other platforms.

You will find that we have moved away from the default Gumstix build process and mostly support the Android environment our selves. Only few components will actually be needed from the Gumstix repositories and we shall describe them here.

Prerequisites

Your build machine should be running a fairly recent Linux distribution. The distribution we are using for this documentation is Ubuntu 9.10 but other distributions should also work. Most common of which are:

  • Ubuntu 7.04, 7.10, 8.04, 9.04, 9.10
  • Debian
  • SuSe
  • Gentoo
  • Centos 5
  • Fedora 11

Gumstix OE Requirements

Depending on your distribution, it is likely you will need to install additional software. If while installing Ubuntu 9.10 you have selected the packages for a Development Machine then the only additional packages you should need are: texi2html and help2man If not then likely you might need to install the packages from the following list which includes most of the necessary ones:

  • git
  • subversion
  • gcc
  • patch (this and gcc are often bundled with other developer tools in the build-essential package)
  • help2man (Centos 5 package available from atrpms repository)
  • diffstat
  • texi2html (texinfo on SUSE)
  • makeinfo (texinfo on Ubuntu)
  • ncurses-devel (libncurses5-dev on Ubuntu)
  • cvs
  • gawk
  • python-dev
  • python-pysqlite2 (python-sqlite2 on SUSE)


The easiest way to install these packages is to issue the command:

sudo apt-get install git subversion gcc patch help2man diffstat
sudo apt-get install texinfo libncurses5-dev cvs git-core texi2html
sudo apt-get install gawk python-dev python-pysqlite2 g++

If there are any missing packages not mentioned here then OE (Open Embedded) will tell you which ones to install

Android Requirements

In order to be able to build android and it's components you will also need to install some additional packages and make some tweaks to your Ubuntu setup.

Add the following lines to your /etc/apt/source_list or for Ubuntu 9.10 /etc/apt/sources.list and save:

deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

Then issue the following commands:

sudo apt-get update
sudo apt-get install sun-java5-jdk
sudo update-alternatives --config java

Select the 1.5 Java version when prompted, our terminal looked like this:

  Selection    Path                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-sun/jre/bin/java       63        auto mode
* 1            /usr/lib/jvm/java-1.5.0-sun/jre/bin/java   53        manual mode
  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode

Press enter to keep the current choice[*], or type selection number:

In the above case select 1

Building MLO & U-Boot

Before we can put Android on FLOW we first need to build the Gumstix MLO and U-Boot images. These images are well supported by Gumstix and we shall be taking files from their repository.

Gumstix OE Setup

Note 1: If you are using a Ubuntu distribution, it is likely that /bin/sh is linked to /bin/dash. If this is the case, then you will need to change /bin/sh to link to /bin/bash. Neglecting to do this will cause target system init file corruption and your build image will not boot!

Run the following command:

sudo dpkg-reconfigure dash

Answer NO when asked whether you want to install dash as /bin/sh.

Note 2: If you are using Ubuntu 8.04 you will also need to edit /etc/sysctl.conf and set vm.vdso_enabled = 0 and vm.mmap_min_addr = 0. In Ubuntu 9.04 you will only need to set vm.mmap_min_addr = 0. Afterward run:

sudo sysctl -p

Build system Checkout

These instructions will assume that you are installing the build system in your home directory under "overo-oe". If you decide to put it elsewhere you will need to make appropriate alterations.

First we will create the "overo-oe" directory and cd into it:

mkdir -p ~/overo-oe
cd ~/overo-oe

Now we will install the OE metatdata, and check out the Overo branch (you can safely ignore the warnings you will get from the git commands):

git clone git://gitorious.org/gumstix-oe/mainline.git org.openembedded.dev
cd org.openembedded.dev
git checkout --track -b overo origin/overo

If you have an error like:

fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Add this command before the first command:

git clone git://gitorious.org/gumstix-oe/mainline.git

Install Bitbake:

cd ~/overo-oe
git clone git://git.openembedded.net/bitbake bitbake
cd bitbake
git checkout 1.8.18

Create a profile script and the configuration files required to tailor OE to our needs:

cd ~/overo-oe
cp -r org.openembedded.dev/contrib/gumstix/build .

OpenEmbedded requires some environment setup in order to function properly:

cp ~/.bashrc ~/bashrc.bak
cat ~/overo-oe/build/profile >> ~/.bashrc

Building the images

After all is setup we recommend that you close the terminal window and reopen it for the changes to take effect. Even better would be for you to restart the computer :)

Now let's build the images:

cd ~/overo-oe
bitbake x-load

Now let's build the u-boot:

bitbake u-boot-omap3

Building Android File-system & Kernel

Since the only 2 images we need from Gumstix are MLO & U-Boot, the rest we shall take from our own Git repository. Below are the instructions to successfully get and build Android as well as the Kernel.

Install Repo

Create a private bin directory and get the repo script:

mkdir ~/bin
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo

You need to include the private bin directory in your PATH environment variable:

echo export PATH=$PATH:$HOME/bin >> ~/.bashrc

For the changes to take effect restart Terminal or enter:

source ~/.bashrc

Download & Build Android

Let's first create our Android directory next to our overo-oe. They don't need to be persuasive essays next to each other but this makes things more organized.

mkdir ~/android
cd ~/android

Let's Checkout Android:

repo init -u git://gitorious.org/flow-g1-5/flow_platform_manifest.git
repo sync

Before we begin compiling we need to install some additional packages:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip 
sudo apt-get install curl zlib1g-dev gcc-multilib g++-multilib 
sudo apt-get install libc6-dev-i386 lib32ncurses5-dev ia32-libs 
sudo apt-get install x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
sudo apt-get install liblzo2-dev
sudo apt-get install uboot-mkimage

Checking out a stable repository

Before we compile there is one last thing we must do. We have to sync to the stable version of the repository. Download the script and the txt file below.


Copy the 2 files into your Android directory.

In order to build the repository with OpenGL support for fast Android UI as well as other new features untar omap-sgx into the Android folder.

repo sync

Checkout the repository using the Script. If you have already built this before then you need to also do the following

rm out/target/product/flow1/system/build.prop

Then do

make TARGET_PRODUCT=flow1
cd omap-sgx
make clean
make
make install OMAPES=3.x
cd ..
make TARGET_PRODUCT=flow1

There is another thing you must do until it is fixed by Android, in order for WiFi to work correctly. Before doing the microSD

chmod +x android/out/target/product/flow1/system/etc/dhcpcd/dhcpcd-run-hooks

Using the micro-SD

To setup the necessary partitions on a new microSD please read the Setting up a microSD' section of this WiKi. After everything compiles use the following script to upload everything to your microSD:

#!/bin/bash

# Project DIR
PRJROOT=~/Projects/FLOW-Dev/G1.55
# Where I can find the images
OUTDIR=$PRJROOT/android/out/target/product/flow1
# Where I can find the Overo OE directory
OVERODIR=~/Projects/FLOW-Dev/G1.55/overo-oe

# Where the rootfs has to be made. (MicroSD)
TARGETDIR=/media/0e30469a-c33e-4b2c-8720-27a0d8e54196
TARGETBOOTDIR=/media/FAT

#Is the environment correctly initialized?
case $PRJROOT in 
	'') echo "PRJROOT unknown, please setup your environment."
	exit;; 
esac


#[ -e ARG ] equals test -e ARGS
if ! [ -e $OUTDIR ]; then
	echo "SYSTEMDIR = \"$SYSTEMDIR\" do not exist."
	exit
fi

if ! [ -e $TARGETDIR ]; then
	echo "TARGETDIR = \"$TARGETDIR\" do not exist."
	exit
fi

if ! [ -e $PRJROOT/tmp ]; then
	echo "I will create the support dir: $PRJROOT/tmp"
	mkdir $PRJROOT/tmp
fi

case $1 in
	'')
	echo "Cleaning: $TARGETDIR $TARGETBOOTDIR and tmp"
	sudo rm -rf $TARGETDIR/*
	sudo rm -rf $PRJROOT/tmp/*
	sudo rm -rf $TARGETBOOTDIR/*

	cd $TARGETBOOTDIR

	echo "Inslall MLO, U-boot and Kernel Images"
	cp $OVERODIR/tmp/deploy/glibc/images/overo/MLO-overo MLO
	cp $OVERODIR/tmp/deploy/glibc/images/overo/u-boot-overo.bin u-boot.bin
	cp $OUTDIR/kernel.img uImage	

	cd $PRJROOT	

	echo "Install the root"
	sudo cp $OUTDIR/ramdisk.img $TARGETDIR/ramdisk.cpio.gz
	cd $TARGETDIR
	sudo gzip -d ramdisk.cpio.gz
	sudo cpio -i -F ramdisk.cpio
	sudo rm ramdisk.cpio
	cd $PRJROOT

	sudo cp -r $OUTDIR/data/* $TARGETDIR/data


	echo "Install System to $TARGETDIR"
	sudo cp -r $OUTDIR/system/* $TARGETDIR/system
	;;
esac

sync

umount $TARGETDIR

Change the PRJROOT to your project directory (Android directory should be in it) as well as the TARGETDIR for you memory card. OUTDIR is the directory of you android files. also change the OVERODIR and TARGETBOOTDIR accordingly.

Things to do Next

When you complete the Android build there are few other things to do in order to get FLOW G1.55 running everything correctly. Below is the list of those things.

Provisioning the Device

After all is working there is one more thing to do in order to be able to work the GSM correctly. So type:

sqlite3 /data/data/com.android.providers.settings/databases/settings.db

You should see a reply like this:

sqlite3 /data/data/com.android.providers.settings/databases/settings.db
SQLite version 3.5.9
Enter ".help" for instructions

Type:

sqlite> INSERT INTO secure (name, value) VALUES ('device_provisioned', 1);
sqlite> .exit

GSM should be working fine now along with other things.

Did you know?

Banner