Fedora 20 Compile Cyanogenmod 11.0 - Nexus 4 ( mako ) example

来源:互联网 发布:依爱消防主机怎么编程 编辑:程序博客网 时间:2024/06/01 23:16
Install adb/fastboot/android sdk :

# cd /opt
# wget http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20131030.zip
# unzip adt-bundle-linux-x86_64-20131030.zip
# ln -s adt-bundle-linux-x86_64-20131030 adt-bundle

Add new path for a normal user:
$echo "export PATH="/opt/adt-bundle/sdk/platform-tools:\$PATH"" >> /home/maccu/.bashrc
$ bash
$ which fastboot
/opt/adt-bundle/sdk/platform-tools/fastboot
$ which adb
/opt/adt-bundle/sdk/platform-tools/adb

Add new path for ror root:
# echo "export PATH="/opt/adt-bundle/sdk/platform-tools:\$PATH"" >> /root/.bashrc
# bash 
# which fastboot
/opt/adt-bundle/sdk/platform-tools/fastboot
# which adb
/opt/adt-bundle/sdk/platform-tools/adb


Install jdk:

Download Java JDK from here and install:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

# rpm -qa | grep java 
java-1.7.0-openjdk-headless-1.7.0.60-2.4.3.0.fc20.x86_64
abrt-java-connector-1.0.6-1.fc20.x86_64
java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64
javapackages-tools-3.4.1-1.fc20.noarch
tzdata-java-2013h-1.fc20.noarch
python-javapackages-3.4.1-1.fc20.noarch

# rpm -ivh jdk-7u45-linux-x64.rpm

# which javah
/usr/bin/which: no javah in (/opt/adt-bundle/sdk/platform-tools:/opt/adt-bundle-linux-x86-20130522/sdk/platform-tools:/opt/adt-bundle-linux-x86-20130522/sdk/tools:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

# ls /usr/java/default/bin/javah 
/usr/java/default/bin/javah

# ln -s /usr/java/default/bin/javah /usr/bin/javah
# which javah
/bin/javah

#  java -version
java version "1.7.0_45"
OpenJDK Runtime Environment (fedora-2.4.3.0.fc20-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)


If you have problem during the building of CM11.0 ,you need a version 6 Java Development Kit for building CM11.0. Usually, the SUN JDK 6 is recommended. But there is another way: you can use the OpenJDK 6. When you installed the required packages as described above, you will just need to configure your Java installation.

Remove jdk

# rpm -qa | grep jdk 
java-1.7.0-openjdk-headless-1.7.0.60-2.4.3.0.fc20.x86_64
java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64
jdk-1.7.0_45-fcs.x86_64

# rpm -e jdk-1.7.0_45-fcs.x86_64

Download from oracle site, you must need a oracle account.
http://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin

# chmod +x jdk-6u45-linux-x64-rpm.bin 
# ./jdk-6u45-linux-x64-rpm.bin 

# ln -s /usr/java/default/bin/javah /usr/bin/javah


# /usr/bin/javah -version
javah version "1.6.0_45"

Install dependencies:

# yum install -y zip curl gcc gcc-c++ flex bison gperf glibc-devel.{x86_64,i686} zlib-devel.{x86_64,i686} ncurses-devel.i686 libX11-devel.i686 libstdc++.i686 readline-devel.i686 libXrender.i686 libXrandr.i686 perl-Digest-MD5-File python-markdown mesa-libGL-devel.i686 git

This is important

If you have 64-bit systems, you will need to install some 32bit packages, because Android SDK is 32bit
32 bit packages
# yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686

If you are compiling custom ROM's, most utilize CyanogenMod's squisher script and mka command

which needs these two packages.
# yum install -y schedtool pngcrush

Install Eclipse:
This is important
If you have problems like [Bug875490] try to install the "Fedora Eclipse" group rather than just "yum install eclipse"
Eclipse IDE (3.5 and higher is needed because of ADT plugin dependency on Equinox P2)
yum install eclipse-jdt

# yum install eclipse-jtd

Installing Repo Script:

# mkdir ~/bin
# export PATH=~/bin:$PATH
# echo "export PATH=~/bin:\$PATH" >> /root/.bashrc

# curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
# chmod a+x ~/bin/repo

For version 1.20, the SHA-1 checksum for repo is e197cb48ff4ddda4d11f23940d316e323b29671c
# /usr/bin/openssl sha1 repo 
SHA1(repo)= e197cb48ff4ddda4d11f23940d316e323b29671c

# which repo 
~/bin/repo


Inizialize source directory:

Inizialize source directory for Cyanogenmod 11.0:

# mkdir -p ~/android/cm-11.0
# cd ~/android/cm-11.0

# git config --global user.email "yourmailaddress@gmail.com"
# git config --global user.name "Maccu Maccu"


# repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white
  bold     dim      ul       reverse
Enable color display in this user account (y/N)? y

Inizialize source directory for Cyanogenmod 10.2:



# mkdir -p ~/android/cm-10.2
# cd ~/android/cm-10.2


# git config --global user.email "yourmailaddress@gmail.com"
# git config --global user.name "Maccu Maccu"


# repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2

If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white
  bold     dim      ul       reverse
Enable color display in this user account (y/N)? y


Initialize source directory behind a proxy:

# git config --get http.proxy http://localhost:5865(ntlmaps example)
# repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

with https:

# repo init -u https://github.com/CyanogenMod/android.git -b cm-11.0


Start download - Sync source repo:

you must have at least 25 GB free
# cd ~/android/cm-11.0
# repo sync

wait...
If your not on the ultra super fast connection, you need to wait.

# cd .. 
# du -sh cm-11.0/
20G cm-11.0/

If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using

# repo sync -j1 

Get prebuild apps :

# cd /home/maccu/android/cm-11.0/vendor/cm
# ./get-prebuilts 

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   178  100   178    0     0    179      0 --:--:-- --:--:-- --:--:--   179
100  455k  100  455k    0     0   217k      0  0:00:02  0:00:02 --:--:-- 1221k
Archive:  ./proprietary/Term.apk
  inflating: ./proprietary/lib/armeabi/libjackpal-androidterm4.so  
  inflating: ./proprietary/lib/mips/libjackpal-androidterm4.so  
  inflating: ./proprietary/lib/x86/libjackpal-androidterm4.so  

or

#  ./vendor/cm/get-prebuilts

Prepare device specific code : 

# cd /home/maccu/android/cm-11.0/
# pwd
/home/maccu/android/cm-11.0

# . build/envsetup.sh 
or 
# source build/envsetup.sh 
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/goldfish/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including vendor/cm/vendorsetup.sh
including sdk/bash_completion/adb.bash
including vendor/cm/bash_completion/git.bash
including vendor/cm/bash_completion/repo.bash


# breakfast mako 
including vendor/cm/vendorsetup.sh
ls: cannot access device/*/mako/cm.mk: No such file or directory
build/core/product_config.mk:233: *** Can not locate config makefile for product "cm_mako".  Stop.
Device mako not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Found repository: android_device_lge_mako
Default revision: cm-11.0
Checking branch info
CyanogenMod/android_device_lge_mako already exists
Syncing repository to retrieve project.
Fetching project CyanogenMod/android_device_lge_mako

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4
CM_VERSION=11-20131125-UNOFFICIAL-mako
TARGET_PRODUCT=cm_mako
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.11.8-300.fc20.x86_64-x86_64-with-fedora-20-Heisenbug
HOST_BUILD_TYPE=release
BUILD_ID=KRT16S
OUT_DIR=/home/maccu/android/cm-11.0/out
============================================


if you have problem with "mako" try with "lge_mako" :
ls: cannot access device/*/mako/cm.mk: No such file or directory
build/core/product_config.mk:234: *** Cannot locate config makefile for product "cm_mako".  Stop.
** Don't have a product spec for: 'cm_mako'
** Do you have the right repo manifest?

warning: local_manifest.xml is deprecated; put local manifests in `/home/maccu/android/cm-11/.repo/local_manifests` instead


# breakfast lge_mako
including vendor/cm/vendorsetup.sh
ls: cannot access device/*/lge_mako/cm.mk: No such file or directory
build/core/product_config.mk:233: *** Can not locate config makefile for product "cm_lge_mako".  Stop.

Device lge_mako not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).....


Helpful Tip from http://wiki.cyanogenmod.org/w/Build_for_mako

If the build doesn't start, try lunch and choose your device from the menu. If that doesn't work, trybreakfast and choose from the menu. The command make mako should then work.

A second, bonus tip! If you get a command not found error for croot orbrunch or lunch, be sure you’ve done the “ . build/envsetup.sh” command in this Terminal session from the ~/android/system directory.

Extract proprietary data:

Connect your device to your computer and turn on USB debugging on Developer Options.
Go to your device vendor directory and extract files from your phone, for Nexus 4:

# adb devices
List of devices attached 
04d6f87fe10e0122 device

# cd device/lge/mako/
# ./extract-files.sh

# cat extract-files.sh 
#!/bin/sh

VENDOR=lge
DEVICE=mako

BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
rm -rf $BASE/*

for FILE in `cat proprietary-blobs.txt | grep -v ^# | grep -v ^$`; do
    DIR=`dirname $FILE`
    if [ ! -d $BASE/$DIR ]; then
        mkdir -p $BASE/$DIR
    fi
    adb pull /system/$FILE $BASE/$FILE
done


Enable caching :

# export USE_CCACHE=1

Setup the environment :

# cd /home/mfalchi/android/cm-11.0/
# . build/envsetup.sh

# croot
# brunch mako

Use your device specific code instead of mako, if you are using different device.
Wait for build to complete. It can take 1-5 hours.
Get installable zip from out directory and install it via custom recovery.
0 0