LeMaker Guitar:How to use Android SDK

From BananaPro/Pi
Jump to: navigation, search
Translate this page; This page has changes since it was last marked for translation.

Other languages:

Configure compiling environment

Step 1: Set shell

A) Set bash to shell

 $ rm –rf /bin/sh     // Note: do not restart after the completion of this setup
 $ ln -s bash /bin/sh

B) Test

 $ ls -l /bin/sh

The correct results should be:

lrwxrwxrwx 1 root root 4 OCT 9 17:44 /bin/sh -> bash

Step 2: Install the compiler environment

You can refer to the official website: http://source.android.com/source/initializing.html for descriptions and details.

 $ sudo apt-get install git gnupg flex bison gperf build-essential\ 
                        zip curl libc6-dev libncurses5 libncurses5-dev x11proto-core-dev\
                        libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386\
                        libgl1-mesa-dev g++-multilib mingw32 tofrodos\
                        python-markdown libxml2-utils xsltproc zlib1g-dev:i386
 $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Install other necessary tools:

 $ sudo apt-get install vim tmux bootchart lrzip expect wine uboot-mkimage device-tree-compiler u-boot-tools gawk wput bc

Step 3: Install JDK

A) If the compiler is networked, use the following command to install (need to have root permissions)

 $ sudo apt-get install openjdk-7-jdk

B) If you have download openjdk-7-jdk, use the following command to instal (need to have root permissions)

 $ sudo cp java-7-openjdk-amd64.tar.bz2 /opt
 $ cd /opt
 $ tar -jxvf java-7-openjdk-amd64.tar.bz2

Add environmental variables

 $ sudo gedit /etc/profile

Add the following content

export JAVA_HOME=/opt/java-7-openjdk-amd64 
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

C) Test

 $ source /etc/profile
 $ java –version

Compile Android SDK

Step 1: Download Android SDK

 $ git clone https://github.com/LeMaker/android-actions.git

Step 2: Compile kernel

If the first compilation, need to select board Type, because there are some paths or parameters need to configure.
lemaker_guitar_bbb is a board type for LeMaker Guitar base board Rev.B;
lemaker_guitar_bbc is a board type for LeMaker Guitar base board Rev.C;
lemaker_guitar_bbd is a board type for LeMaker Guitar base board Rev.D.

 $ cd  android-actions/
 $ ./autobuild.sh  config

Note: Select the guitar (lemaker_guitar_bbb) version of the option OR

 $ cd  android-actions/owl
 $ ./config.sh

Note: Select the guitar (lemaker_guitar_bbb) version of the option And then execute the following instructions:

 $ cd  android-actions
 $ ./autobuild.sh  kernel


 $ cd  android-actions/owl
 $ make kernel

Generate binary file uImage in the directory \owl\out\board Type\kernel\arch\arm\boot

Step 3: Configure kernel

 $ cd android-actions/owl
 $ make kernel-config

Step 4: Compile driver

 $ cd  android-actions/
 $ ./autobuild.sh  modules


 $ cd  android-actions/owl
 $ make modules

Generated binary file uImage in the directory android\owl\out\board Type\kernel\ . Directory structure is the same as the directory where the driver source code is located.
At present, some drivers are compiled with kenel, some of which are compiled into module separately, the kernel configuration file can be seen. If the corresponding configuration file is configured to m, then compiled into module form.
Such as:

Step 5: Compile Android module

Android system.img compilation

 $ cd  android-actions/android
 $ source  build/envsetup.sh
 $ lunch  [board Type]
 $ make  –j8


 $ cd  android-actions/owl
 $ make rootfs

Generated binary file system.img in the directory android/android/out/target/product/board Type/
Prerequisite for compiling Android module:
1、You need to compile the entire Android system successfully
2、Single module compiling method
mm:Compile the module of current directory, the current directory must to have Android.mk file
mmm:Compile the module under the specified path, There must have the Android.mk file on the specify the path.
For example:
If you want to compile the libstagefright module, the current directory is the source root directory, the method is as follows:

 source  build/envsetup.sh
 mmm [-B] android/frameworks/av/media/libstagefright


 source  build/envsetup.sh
 cd android/frameworks/av/media/libstagefright

Generated binary file so in the directory android/out/target/product/board Type/system/lib.

Step 6: Compile Android system package

A) Configure the board type package

 $ ./autobuild.sh config

and then choice the lemaker_guitar_bbb to configure
B) Run the following command to compile the Android system

 $ ./autobuild.sh

Generated binary file s500_android_lemaker_guitar_bbb_XXX.fw in the directory android-actions/owl/out/s500_android_lemaker_guitar_bbb/images/. Use this upgrade package to complete the upgrade of the whole Android system.