September 22, 2017

Android Compilation in Ubuntu 12.04 LTS (precise) for pandaboard


Below are the steps followed for compiling the android in Ubuntu 12.04 for pandaboard. I had compiled by referencing the following links


Making ready the Ubuntu 12.04 for compiling Android

1) Installing JDK

Since Sun JDK is no longer in Ubuntu’s main package repository, we have to manually install it in ubuntu 12.04 from oracle website

Please go the below link and download the JDK

Follow the below steps to install the java and configuring it for the usage

$ chmod +x jdk-6u33-linux-x64.bin

$ sudo ./jdk-6u33-linux-x64.bin
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws

To verify the isntallation is proper do the belwo steps. It should now show that the Sun JDK is running instead of IcedTea

$ java -version
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)

 2) Installing the required packages for Ubuntu 12.04

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

3) Configuring USB Access


Under GNU/linux systems (and specifically under Ubuntu systems), regular users can’t directly access USB devices by default. The system needs to be configured to allow such access.

If you do not do this, when u insert the pandaboard it wont be detected and you wont be able to do any file trasnfer for u-boot and other system files

The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. <username> must be replaced by the actual username of the user who is authorized to access the phones over USB.
# adb protocol on panda (PandaBoard)
SUBSYSTEM==”usb”, ATTR{idVendor}==”0451″, ATTR{idProduct}==”d101″, MODE=”0600″, OWNER=”<username>”
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM==”usb”, ATTR{idVendor}==”0451″, ATTR{idProduct}==”d022″, MODE=”0600″, OWNER=”<username>”
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM==”usb”, ATTR{idVendor}==”0451″, ATTR{idProduct}==”d00f”, MODE=”0600″, OWNER=”<username>”
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM==”usb”, ATTR{idVendor}==”0451″, ATTR{idProduct}==”d010″, MODE=”0600″, OWNER=”<username>”
# adb protocol on grouper (Nexus 7)
SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e42″, MODE=”0600″, OWNER=”<username>”
# fastboot protocol on grouper (Nexus 7)
SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e40″, MODE=”0600″, OWNER=”<username>”

 If the username is dino, the line should look like

SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1″, ATTR{idProduct}==”4e40″, MODE=”0600″, OWNER=”dino”

Downloading the Source Tree

4) Create a bin/ directory in your home directory

$ mkdir ~/bin
$ PATH=~/bin:$PATH

5) Download the Repo script and make it executable

$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo

6) Downloading the master branch for pandaboard

pandaboard is supported in master branch of the android. So now we will now download the android master branch

First we will create a directory for he android source

$mkdir android_master
$cd android_master

now we will initialize the repo to bring the latest version of the repo

$ repo init -u

When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.

Now we will pull down the source code from the repository which we initialized

$repo sync

Now the download of the source code will start, this will take some hours to download the whole files . Make sure you have good internet speed :)



Compiling the Android

 7) Initialize the enviornment

$ source build/

8) Choose the Target as panda

$ lunch full_panda-userdebug


9) Installing binary driver for pandaboard

We need to now download the graphics driver for pandaboard, click the below link and download the binary corresponding to the android version . I used 4.0.4

$ tar xvzf imgtec-panda-imm76i-67545da7.tgz

the above will untar the driver

10) now we are all ready to start the compilation. type make and go for some snacks and tea

$ make -j4

It took 2 hours in my Toshiba C665 laptop, the configuration is Core i3(i3-2330M CPU@ 2.20GHz), 6GB RAM

Build everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.

 11) Writing to the pandaboard the Android Bootloader image

# Initial setup,

# With no SD card inserted, plug USB first, then the power cord,
# and load fastboot over USB:
device/ti/panda/usbboot device/ti/panda/bootloader.bin

# Initial setup,
# Once in fastboot, insert and initialize an SD card (4GB or greater):
fastboot oem format
fastboot flash xloader device/ti/panda/xloader.bin
fastboot flash bootloader device/ti/panda/bootloader.bin

# Build and flash, part 1: Do a build
source build/
lunch full_panda-userdebug

# Build and flash, part 2: Flash
# Reboot into the SD card’s fastboot (hold GPIO_121 and press PWRON_RESET)
# and flash the system:
fastboot erase cache
fastboot flash userdata
fastboot flashall

# Post-boot setup, part 1: Set the date on the board:
adb shell date $(date +%s)

# Post-boot setup, part 2: (optional) Configure Ethernet
adb shell dhcpcd eth0




Speak Your Mind


Anti-spam: complete the taskWordPress CAPTCHA