====== Installing the Build Environment on Ubuntu 12.04 ====== //__About this Article__// * **Author**: weeb --- parker@cubietech.com --- 2013/10/12 18:22 * **Copyrights**: [[http://creativecommons.org/licenses/by-sa/3.0/|CC Attribution-Share Alike 3.0 Unported]] * **Contributors**: [[http://cubieboard.org/|Cubieboard Community]] : ... __** PC requirements **__ * ** Hardware ** * CPU: Intel 2.5G I5 x64 * Memory: 16G DDR3 * Disk: 30GB * Internet connected * ** Software ** * OS: Ubuntu 12.04(64 bit) * Java JDK 6 * Eclipse * ADT * CDT * Android SDK * Android NDK * Linux Source * Android Source ===== Initializing a Build Environment ===== **Attention**: Demon stration is in Ubuntu 12.04(32bit). ==== Installing the JDK ==== The Sun JDK is no longer in Ubuntu's mainpackage repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used. Download the jdk1.6: $ dl.cubieboard.org/software/tools/android/jdk1.6.0_33.tar.gz Input in terminal: $ sudo vim etc/profile Add : JAVA_HOME=/work/tools/jdk1.6.0_33 export JRE_HOME=/work/tools/jdk1.6.0_33/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH Then save and input : $souurce etc/profile ==== Installing the Android SDK ==== Download the SDK from Web Browser: http://developer.android.com/sdk/index.html Choose the ''adt-bundle-linux-x86-20130219.zip''. Input in the terminal: $ sudo mkdir ~/sdk Copy the ''adt-bundle-linux-x86-20130219.zip'' to the /root/sdk and extract the zip. Enter the folder ''/root/sdk/adt-bundle-linux-x86-20130219/sdk/tools''. Double click the script file android. It will show the Android SDK Manager. Choose the package with ticks. Then click the Install ''XX'' packages buttonon the right. It will start download the required packages. After the installation, add the SDK tools to PATH Environment Variable. Input in the terminal: $ gedit /etc/profile Input in the “profile” $ export ANDROID_SDK_PATH=/root/sdk/adt-bundle-linux-x86-20130219/sdk $ export PATH=.:$ANDROID_SDK_PATH/platform-tools:$PATH Save and close the profile. Input in the terminal: $ source /etc/profile ==== Installing the Eclipse ==== With the download of ''adt-bundle-linux-x86-20130219.zip'', we can find the Eclipse in the ''/root/sdk/adt-bundle-linux-x86-20130219/eclipse''. Double click the eclipse can run it. ==== Installing the ADT online ==== Android Development Tools (ADT) is a plugin for the Eclipse IDE, that is designed to give you a powerful, integrated environment in which to build Android applications. ADT extends the capabilities of Eclipse to let you quickly set up new Android projects, create an application UI, add packages based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned). **apk** files in order to distribute your application. Run the eclipse and click the help>Install New Software. Then click the Add button. Input the Location https://dl-ssl.google.com/android/eclipse. Click OK. Then it will show the choice for installation. Click Select All and Next. ==== Installing the NDK ==== The NDK is a toolset that allows you to implement parts of your app using native-codelanguages such as C and C++. For certain types of apps, this can be helpful so you can reuse existing code libraries written in these languages, but most apps do not need the Android NDK. Download the NDK from Web Browser: http://developer.android.com/sdk/ndk/index.html Choose the ''android-ndk-r8e-linux-x86.tar.bz2''. Input in the terminal: $ sudo mkdir ~/ndk Copy the ''android-ndk-r8e-linux-x86.tar.bz2'' to the ''/root/sdk'' and extract the zip. Input in the terminal: $tar –xvf android-ndk-r8e-linux-x86.tar.bz2 Finally, add the NDK folder to PATH Environment Variable. ==== Installing the CDT ==== The CDT Project provides a fully functional C and C++ Integrated Development Environment based on the Eclipse platform. Features include: support forproject creation and managed build for various toolchains, standard make build, source navigation, various source knowledge tools, such as type hierarchy, callgraph, include browser, macro definition browser, code editor with syntaxhighlighting, folding and hyperlink navigation, source code refactoring andcode generation, visual debugging tools, including memory, registers, anddisassembly viewers. The installation of CDT is the same as ADT. But the Location of CDT is: http://download.eclipse.org/tools/cdt/releases/indigo ==== Installing the Cross Compiling Environment ==== The CPU X86 is using the CISC, while the ARM processor is RISO. Therefore, the cross compiling environment should be installed. The CodeSourcery is an good choice for the cross compiling. It can be download from the following website: http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ Choose the ARM Processor GNU/Linux release. It will need your personal information. Finally, system will send you an Email with the download URL. Click the Download Sourcery CodeBench Lite 2012.09-64. Choose the IA32 GNU/Linux Installer. After download, enter the folder in terminal and use the following command: $ ln –s /lib/i386-linux-gnu/libc.so.6 /lib $ dpkg-reconfigure dash Choose NO. $ sh arm-2012.09-64-arm-none-linux-gnueabi.bin Add the CodeSourvery to PATH. Input in the terminal: $ gedit/etc/profile Input in the profile. $ export PATH=.:$/root/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_LIinux/bin:$PATH Save and close the profile. Input in the terminal: $ source/etc/profile ===== Test the first cross compiling environment ===== Program a simple ''first.c'' file. #include int main() { printf(“Hello world\n”); return 0; } Input in the terminal: $ arm-none-linux-gnueabi-gcc–static –o first first.c $ adb push first /data/local $ adb shell $ cd /data/local $ ./first {{tag>development environment ubuntu_12.04}}