Mar 29, 2012

Gentoo amd64 Android Building

Well ... setting-up a Gentoo Linux system always painful ... :-) . But gentoo linux was born in 1999 and still alive up to 2012. I was gentoo user and shift to ubuntu. I fallen in love to ubuntu mostly because their community, their ability to serve "common pc user" in using Linux Platform, ubuntu brought linux into wider audience. Gentoo is different in Philosophy at least with ubuntu. Gentoo is flexibility where ubuntu is Just Work. I need this flexibility and come back to gentoo.

I brought down a ThinkCentre all in one desktop a70e from office :-) ... with the following basic specifications :
00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 03)
00:02.0 VGA compatible controller: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)
00:1c.1 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 2 (rev 01)
00:1c.2 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 3 (rev 01)
00:1d.0 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)
00:1d.7 USB controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.2 IDE interface: Intel Corporation N10/ICH7 Family SATA Controller [IDE mode] (rev 01)
00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)
02:00.0 Network controller: Broadcom Corporation BCM43225 802.11b/g/n (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)


CPU
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Pentium(R) Dual-Core CPU E5500 @ 2.80GHz

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Pentium(R) Dual-Core CPU E5500 @ 2.80GHz


Gentoo Installation & Android Build
Again I set prebuilt profile for gentoo 10.0/desktop/gnome ... since I wish to build android kernel and rom with this machine and android still in 32 bit camps, I need to make gentoo multilib machine, it is mean the amd64 architecture must be able to run 32 bit library, we need to merge emul-linux-86-baselibs
How about java ? since android only support oracle(formerly)sun-jdk, I merge sun-jdk-1.6.0.31 x86_64 linux package by downloading from THIS PAGE > put in folder /usr/portage/distfiles. and run emerge -av sun-jdk
Since I dont wanna to deal with various JDK and I wish to build gingerbread and higher, I just need jdk-1.6, let us ensure system and user using this jdk
Gentoo x11 # java-config --list-available-vms
The following VMs are available for generation-2:
*) Sun JDK 1.6.0.31 [sun-jdk-1.6]

Android repo init error
When I run android repo initializing I got errors
[x11@Gentoo] [aospgb] > repo init -u https://android.googlesource.com/platform/manifest
File "/opt/bin/repo", line 180
except OSError, e:
^
SyntaxError: invalid syntax

Solution
As Root # emerge av python:2.7
As user $ mkdir ~/bin ... you probably have already this one
As user $ cd ~/bin
As user $ ln -sy /usr/bin/python2 ~/bin/python
This is to create symlinks from python2 to be used for user related to repo, where file repo for android in similar folder ~/bin
export PATH=~/bin:$PATH to ensure your PATH, or you can add the line to ~/.bashrc file and test
[x11@Gentoo] [gbaosp] > repo init -u https://android.googlesource.com/platform/manifest
remote: Counting objects: 28, done
remote: Finding sources: 100% (22/22)
remote: Getting sizes: 100% (11/11)
remote: Compressing objects: 100% (5/5)
remote: Total 22 (delta 9), reused 22 (delta 9)
Unpacking objects: 100% (22/22), done.
From https://android.googlesource.com/platform/manifest

run flawlessly

Android rom build error after "make"
[x11@Gentoo] [rom] > make -j5 otapackage
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.6
TARGET_PRODUCT=msm7627_surf
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRK39F
============================================
File "build/tools/findleaves.py", line 95
print r
^
SyntaxError: invalid syntax
File "build/tools/findleaves.py", line 95
print r
^
SyntaxError: invalid syntax
No private recovery resources for TARGET_DEVICE msm7627_surf
amake: *** No rule to make target `out/host/linux-x86/bin/mkbootimg', needed by `out/target/product/msm7627_surf/boot.img'. Stop.

Solution
the error itself give us clear clue ..... File "build/tools/findleaves.py", line 95 it must be related to python
As user $ cd ~/bin
As user $ ln -s /usr/bin/gmake ~/bin/amake


I create amake file symlinks to /usr/bin/gmake just to easy remember when I need to "make" android my command is amake, sure you can create whatever the name you like ...:-))

Update on Mar 31, 2012
Realizing the weird build is related to pythong ... realized, Gentoo active python is 3.2, refers to AOSP PAGE
Quote :
In general you will need:
Python 2.5 -- 2.7, which you can download from python.org.
Check available python in my gentoo system:
# eselect python list :
[1] python2.7
[2] python3.2*
Changed > # eselect python set 1
Checked :
[1] python2.7 *
[2] python3.2

Test Build
[x11@Gentoo] [rom] > amake -j5 otapackage
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.6
TARGET_PRODUCT=msm7627_surf
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRK39F
============================================
Clean step: rm -rf out/target/product/msm7627_surf/obj/APPS/Camera*
Clean step: rm -rf out/target/common/obj/APPS/Camera*
Clean step: rm -f out/target/product/msm7627_surf/system/app/Nfc.apk
Clean step: rm -rf out/target/common/obj/APPS/LatinIME*
Clean step: rm -rf out/target/product/msm7627_surf/system/app/LatinIME.apk

..... CUT in this post

Conclusion
Gentoo amd64 is good machine to build android kernel and rom
python:2.7 is the accepted python library for android right now
sun-jdk 1.6 x86_64 is acceptable library for android
Multilib is mandatory right now
Make 2.82 is acceptable

welcome to ... compiling fest

No comments:

Real Multilib Userland on Linux

Read multilib requirement on Android rom building and other stuff. About two years absent from getting rid with android rom. I have time to...