📜 ⬆️ ⬇️

Instructions for compiling Android 4.1 "Jelly Bean" on Ubuntu

Attention (!) This instruction will not allow you to create a fully functional firmware immediately, but will give you the opportunity to start working on it.
Note: the source takes about 6 GB. You need about 25 GB of free space to compile 1 build and up to 80 GB (or more) for a complete set of build.

Before you start compiling Jelly Bean on Ubuntu, you need to go through several steps to set up your computer to get the finished tool.


Instruction:
1) You need the following:
-JDK 6 if you want to compile jelly bean. You can download it from java.sun.com or:
')
$ sudo add-apt-repository "deb archive.canonical.com lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk


-Python 2.4 - 2.7, which can be downloaded from python.org or:

$ sudo apt-get install python

-Git 1.7 or newer. You can find it at Git-scm.com or:

$ sudo apt-get install git-core

2) Install the necessary packages. 64-bit (recommended)

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils


In newer versions of Ubuntu, such as 11.10, you may need to do the following:

$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

In Ubuntu 12.04, there is currently only experimental support and work on other branches other than master is not guaranteed.

$ 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/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so


3) Configure USB

$ gksudo gedit /etc/udev/rules.d/51-android.rules

Paste it inside an empty text file.

#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"


4) Save the file and close it, and then run the following command:

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

5) Install repo:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo


6) Run repo:

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u android.googlesource.com/platform/manifest -b android-4.1.1_r1


6.1) For people who already have a ready repo:

$ cd WORKING_DIRECTORY
$ repo init -b android-4.1.1_r1
$ repo sync


7) If required, enter your name and email address.
8) Collect files:

$ repo sync

9) Compile:

$ source build/envsetup.sh

or

$ . build/envsetup.sh

10) Launch:

$ lunch

11) Choose your device
12) Now the question is ('#' is the number of processor cores plus 1, for example, I have a 2 core processor, then I write 'make -j3')

$ make -j#

~ How to add a device to the list ~
1) Find the devices you want to add on GitHub. (For me, this is the HTC Evo 3D-CDMA)
2) Now go to the folder where you are going to clone the device tree:

$ cd WORKING_DIRECTORY/device
$ mkdir htc


3) Cloning a device tree from GitHub from remote to local:
(Make sure the folder will be named the same as the default name for your device, for example: Nexus One [passion], Nexus S [crespo] Motorola Droid [sholes], HTC Incredible [inc], etc.)

$ git clone git://github.com/CyanogenMod/android_device_htc_shooter.git shooter

4) Now go to the folder:

$ cd shooter

5) Connect the phone to the computer and make sure that USB debugging is enabled and adb is working properly.
6) Extract your own device files:

$ ./extract-files.sh

7) Return to your home directory

$ cd ~/WORKING_DIRECTORY

8) Prepare for compilation:

$ source build/envsetup.sh

or

$ . build/envsetup.sh

9) Get a list of your devices:

$ lunch

10) Choose your device
11) Compile:

$ make -j#

or to create a zip archive for the firmware:

$ make -j# otapackage

As a result, we get the compiled JB for a specific device, now you can try to run it on your device, see what works and what does not, then do the optimization of the Android version, make your AOSP firmware, etc.

Source: https://habr.com/ru/post/147516/


All Articles