Sunday, April 9, 2017

Android Build HowTo



QC src
git clone -b MSM8939.LA.2.0.c2  \
https://chipmaster2.qti.qualcomm.com/home2/git/xxx-corporation/msm8939-la-2-0_amss_oem_no-l1-src.git
Android src
repo init -u git://codeaurora.org/platform/manifest.git -b release  \
-m LNX.LA.3.7.1-00810-8x16.0.xml --repo-url=git://codeaurora.org/tools/repo.git
repo sync
cp -r <LYA_build_location>/HY11-<build_id>/LINUX/android/* .
MPSS
MPSS.DI.1.0-00028-M8626AAAMAAAM-1(Image-Revision-ClientId-Spin)
Image: MPSS.DI.1.0
Revision: 00028
ClientId: M8626AAAMAAM
Spin: 1
APSS
Code Aurora Forum (CAF)
LNX.LA.3.7.3-00810-8939.1(<PL_Image>-<Version>-<Chipset>)
PL_Image: LNX.LA.3.7.3    # Linux Build is from the 3.7.3 branch
Version: 00810
Chipset: MSM8939
Date           Tag / Build ID               Chipset     Manifest   Android Version
August 25, 2014  LNX.LA.3.7.3.1-02410-8939.0  msm8939
LNX.LA.3.7.3.1-02410-8939.0.xml         04.04.04

Linux OS
Ubuntu LTS-12.04-64bit
repo
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ repo sync  #74.125.128.93 dl-ssl.l.google.com
JDK
$sudo apt-get install sun-java6-jdk openjdk-7-jdk
$ sudo update-alternatives --config java   #java 6: for Gingerbread through KitKat
$ sudo update-alternatives --config javac  #java 5: for Cupcake through Froyo
Packages
$ sudo apt-get install git 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 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
$ sudo apt-get install bison g++-multilib git gperf libxml2-utils  #Ubuntu 14.04
ccache
$ echo “export USE_CCACHE=1” > ~/.bashrc
$ echo “export CCACHE_DIR=<cache-directory>” > ~/.bashrc  #50-100GB
$ ANDROID_ROOT_DIR/prebuilts/misc/linux-x86/ccache/ccache -M 50G
$ echo “export OUT_DIR_COMMON_BASE=<out-directory>” > ~/.bashrc
commands
$rm out/target/product/*/obj/STATIC_LIBRARIES/<module name>_intermediates
$rm out/target/product/*/obj/SHARED_LIBRARIES/<module name>_intermediates
$rm out/target/product/*/obj/EXECUTABLES/<module name>_intermediates
$ m <component name>     # E.g. m libril-qc-1
printconfig: Prints the current configuration as set by the choosecombo commands
m: Runs make from the top of the tree
mm: Builds all of the modules in the current directory
mmm: Builds all of the modules in the supplied directories
croot: cd to the top of the tree
sgrep: grep for regex in all .c, .cpp, .h, .java, and .xml files below current directory
make clean: This is the same as rm -rf out/<configuration>/
clean-$(LOCAL_MODULE) and clean-$(LOCAL_PACKAGE_NAME)
Let you selectively clean one target. For example, you can type make clean-libutils, and it deletes libutils.so and all of the intermediate files, or you can type make clean-Home and it cleans just the Home application.
LOCAL_SRC_FILES:            List of all source files to include
LOCAL_MODULE:             Module name (used for “m”)
LOCAL_CFLAGS:              C compiler flags override
LOCAL_SHARED_LIBRARIES:  Shared libraries to include
include $(CLEAR_VARS)  #Clears LOCAL* variables for the following sections:
include $(BUILD_EXECUTABLE)
include $(BUILD_SHARED_LIBRARIES)
include $(BUILD_STATIC_LIBRARIES)


Building
commands
android
$ cd <build id>/LINUX/android     # msm8939: A53 - 2clusters * 4cores
$ source build/envsetup.sh         # msm8936: A53 - 1cluster * 4cores
$ lunch msm8916_32-userdebug    # msm8916: A53 - 1cluster * 1core
$ lunch msm8916_32_k64-userdebug   #for 64-bit kernel and 32-bit user space
$ make –j8
$make BUILD_TINY_ANDROID=true #build ''tiny android'' for kernel verification
kernel
$ cd <build id>/LINUX/android
$ source build/envsetup.sh  &  choosecombo
$ cd kernel
$ make ARCH=arm CROSS_COMPILE=arm-eabi- msm8974_defconfig
$make –j8 ARCH=arm CROSS_COMPILE=arm-eabi- zImage #kernel/*/*/*/zImage
$ make –j8 ARCH=arm CROSS_COMPILE=arm-eabi- modules
$ make distclean   #To remove all generated files
commands
$make --just-print  #print the full commands and parameters in building
$ make -j4 KERNEL_DEFCONFIG=xxx_defconfig #default in AndroidBoard.mk
$make TARGET_PREBUILT_KERNEL="zImage" #build with prebuilt kernel
fastboot
$ sudo fastboot devices  # android\out\host\linux-x86\bin
$ cd <target_root>/common/build
$ fastboot_all.py   #android/bootable/bootloader/lk/platform/msm_shared/mmc.c
$ fastboot flash modem < NON-HLOS.bin> or <APQ.bin>
$ fastboot flash sbl1 < sbl1.mbn>
$ fastboot flash rpm < rpm.mbn>
$ fastboot flash QSEE < tz.mbn>
$ fastboot flash aboot < emmc_appsboot.mbn >
$ fastboot flash boot < boot.img>
$ fastboot flash system < system.img>
$ fastboot flash userdata < userdata.img>
$ fastboot flash persist < persist.img>
$ fastboot flash recovery < recovery.img>
$ adb push xxx.apk /system/app/
$ sudo vi /etc/udev/rules.d/50-android.rules
#Sooner low-level bootloader
 SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", SYSFS{idProduct}=="d00d", MODE="0664", GROUP="plugdev"
 # adb composite interface device 9025
 SUBSYSTEM=="usb", SYSFS{idVendor}=="05C6", SYSFS{idProduct}=="9025", MODE="0664", GROUP="plugdev"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<plugdev>"
$ lsusb

2 comments: