Android 4.1 (Jelly Bean) source code compilation process summary

Source: Internet
Author: User

Google has released the source code for Android 4.1 Jelly Bean. I put down the source code for the first time (for a whole night ), today, I spent the first morning compiling the ROM and flushing it to my Galaxy Nexus. Although Android 4.1 has been used for more than a week, as an Android developer and enthusiast, the entire process of downloading, compiling, and refreshing source code is quite meaningful. However, some problems have also been encountered during compilation and flashing. At night, I took some time to summarize the entire process, at the same time, I also hope to help my friends who want to compile and flash the machine by themselves ~~ Start with the topic.

1. Build the compiling environment. I am using Ubuntu 12.04. All the following processes are based on this platform.

For details, refer to Ubuntu 12.04 to build an Android development environment.

2. Download the Android 4.1 source code, refer to: idea. Save the following shell script as download. sh file is placed in the source code directory and executed. /download. sh starts downloading (Replace the last repo sync step in the document, and the remaining steps must follow the step described in the document)

#! /Bin/bash
Echo "===== start repo sync ====="
Repo sync
While [$? = 1]; do
Echo "===== sync failed, re-sync again ====="
Sleep 3
Repo sync
Done

3. Prepare to start compiling the rom. For details, see http://source.android.com/source/building.html. enter source first. /build/envsetup. sh, then enter the lunch full_maguro-user (different platform parameters, specific reference documentation instructions), then execute make-j4 compiled rom (according to the number of machine CPU core to set the parameter ), it is a long wait process (the author's machine performance is not powerful, and the entire compilation process takes about three and a half hours ). If the jdk version is incorrect at the beginning during the execution of make-j4, follow these steps:

Download jdk1.6.0 _ 33.bin http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html from Oracle official

Run sudo chmod a + x/home/jamie/jdk/jdk1.6.0 _ 33.bin( note that the directory here is different from the directory on your machine)

Sudo./home/jamie/jdk/jdk1.6.0 _ 33.bin

Sudo gedit/etc/profile, add at the end

# Set java environment

Export JAVA_HOME =/home/jamie/jdk1.6.0 _ 33

Export JRE_HOME =/home/jamie/jdk1.6.0 _ 31/jre

Export CLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH

Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH

Run source/etc/profile

Sudo update-alternatives -- install/usr/bin/java/home/jamie/jdk1.6.0 _ 33/bin/java 300

Sudo update-alternatives -- install/usr/bin/javac/home/jamie/jdk1.6.0 _ 33/bin/javac 300

Sudo update-alternatives -- config java select the required jdk version

4. After compilation, a lot of imgfiles will be generated in android_souce/out/target/product/maguro/, which is the compiled rom.

5. Follow the steps in the official google Documents and click "Flash". However, the results are quite tragic. The official documents are intended for simulators, And I compile Galaxy Nexus, when a black screen cannot be started, I suddenly thought that google released Android 4.1 binary files on the internet yesterday. These files happen to be Bluetooth, wifi, graphics card, and other drivers, google downloads these drivers separately and does not integrate them into the source code. Therefore, we need to compile these drivers into the rom as follows:

Open https://developers.google.com/android/nexus/drivers, download the four files corresponding to Galaxy Nexus and unzip them to the source code directory. The extracted four files are 4 shell scripts, which are extract-broadcom-maguro.sh, extract-imgtec-maguro.sh, extract-invensense-maguro.sh, extract-samsung-maguro.sh, and.

Run these four scripts separately. During the execution, you must enter "I ACCEPT"

Re-Execute make-j4 for compilation. This compilation process takes a short time.

6. After completing the above driver integration, enter cd/home/jamie/android_source/out/host/linux-x86/bin (fastboot file under this directory), and then enter sudo. /fastboot flashall-w starts to fl. Generally, the following error occurs during this step: neither-p product specified nor ANDROID_PRODUCT_OUT set, because the rom location is not set, the solution either uses the-p parameter, followed by the rom location, or configures the environment variable ANDROID_PRODUCT_OUT. The process is as follows:

Enter sudo gedit/etc/profile, add export ANDROID_PRODUCT_OUT =/home/jamie/android_source/out/target/product/maguro at the end, save and exit

Enter source/etc/profile to make the environment variable that you just set take effect immediately.

7. Wait until the flash brush is finished. After the flash is finished, the device restarts automatically !! The final result diagram is attached.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.