"Go" on Ubuntu 14.04.3 configuration and successfully compiled Android 6.0 R1 source code

Source: Internet
Author: User
Tags ssh server

Http://www.linuxidc.com/Linux/2016-01/127292.htm

Finally succeeded in the Android 6.0 R1 source code compiled. First, this is the Android emulator running in Ubuntu:

Because I installed the virtual machine VMware in Win8 and then installed Ubuntu in the virtual machine to compile, I encountered a lot of trouble. If you compile directly on Linux, it may be smoother.

--------------------------------------------------------------------------------------------------------------- -----------

Preparatory work:

VMware virtual machines, installation Please refer to: VMware8 installation configuration Win7, CentOS-7 Wizard http://www.linuxidc.com/Linux/2016-01/127188.htm

Download Ubuntu Image: Ubuntu-14.04.3-desktop-amd64.iso

Install Ubuntu and refer to "VMware8 installation configuration Win7, CentOS-7 Wizard"

-----------------------------------------------------------------------------

Recommendation: Ubuntu memory allocation 4G, reserved 90G virtual hard disk (previously selected the default 20G, in the decompression tgz when the direct report space is insufficient), the network choose "bridged" way.

In order to compile Android source code, the following for the installation of Ubuntu to do some configuration work.

First bring up the terminal, with the following shortcut keys

Ctrl + Alt + T
1. Install dependent components such as Git
sudo apt-get install-y git flex bison gperf build-essential libncurses5-dev:i386 libx11-dev:i386 libreadline6-dev:i386 li Bgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev Libsdl-dev Libesd0-dev

The red part above is the number "1". Of course, you can also perform these installation commands separately.

If you do not have these dependent components, you might encounter an error like this:

2. Installing the JDK

First search the JDK version with the following command

Apt-cache Search OpenJDK

Performing the installation

sudo apt-get install OPENJDK-7-JDK

To see if the installation was successful

Java-version

3, Configuration Java_home

Run directly

Echo $JAVA _home

The output cannot be seen.

Set up:

echo Export java_home= "/usr/lib/jvm/java-7-openjdk-amd64/" >> ~/.BASHRC

Then restart terminal or by using the following command

SOURCE ~/.BASHRC

When you re-enter $java_home, you can see the configured path.

4. Installing SSH Server

What's the use of this? Use Xshell to make it easy for us to manipulate files in Windows and virtual machines. Ubuntu lack of savings is not installed SSH server,client is for us to install.

Do not know how to use Xshell, please see

Xshell Login CentOS 6.3 Chinese garbled solution http://www.linuxidc.com/Linux/2013-06/86600.htm

VirtualBox4.12 Text installs CentOS 5.4 and Xshell connection tutorial PDF http://www.linuxidc.com/Linux/2013-06/85575.htm

Xshell connection CentOS6.5 iptables or LS output garbled http://www.linuxidc.com/Linux/2014-06/103725.htm

VMware Linux uses Xshell login http://www.linuxidc.com/Linux/2012-06/62546.htm

Telnet to Linux http://www.linuxidc.com/Linux/2015-03/114947.htm using the Xshell key authentication mechanism

sudo apt-get install Openssh-server

Restart it

Sudo/etc/init.d/ssh restart
5. Download Android Source code

In the Baidu cloud disk to share the ANDROID6_R1 source code, please download: Android 6.0 R1 Sub-volume source http://www.linuxidc.com/Linux/2016-01/127285.htm

6, copy Android source code to Ubuntu

This method is a bit silly. The use of Xshell is actually quite fast. Just drag it in.

7. Merging files

Monitor the file hash to see if there is any damage. Exactly what string to match, please control hash.txt

Md5sum ANDROID6_R1_AA

Then merge these files into a

Cat android6_r1_* > M.tgz

Calculate the merged file hash

Md5sum m.tgz

for more details, please read on to the next page. Highlights : http://www.linuxidc.com/Linux/2016-01/127292p2.htm

8. Unzip the file
Tar zxvf m.tgz

It's a long process.

This decompression command creates the Mydroid folder, and the extracted stuff is inside.

9, pre-compilation configuration

Add in the. bashrc file: Export Use_ccache = 1, operate as follows:

echo Export use_ccace=1 >> ~/.BASHRC

To improve compilation efficiency, set the compiler cache. Execute the following command:

Prebuilts/misc/linux-x86/ccache/ccache-m 30G

-M 30G two parameter indicates the 30G size of the space as a cache, this value can be adjusted according to the size of their hard disk space

Then import the environment variables and other parameters needed to compile the Android source code, run the following command

SOURCE build/envsetup.sh

Run the lunch command to select the compilation target

Lunch

For example, choose 1, the following message will appear, tell us the source of the compilation of some relevant information

10. Compiling
Make-j8

Since the notebook is i5 4210u, use 8 (twice times the CPU core), which may be set too large here.

11, continue to compile (error constantly, helpless)

It seems not to be smooth sailing ah, a problem. At first I thought the JDK version was wrong and entered Build/core/main.mk

Found by default is 1.7.

The error stops in the following place:

As mentioned above, I did not install these dependent components at first, causing some unnecessary trouble.

There are other common compilation errors, have been sorted out, suitable for the reference to the following:

1, compile the Android source code fatal error Solution http://www.linuxidc.com/Linux/2016-01/127187.htm

2, compile the Android system source code and kernel source http://www.linuxidc.com/Linux/2016-01/127291.htm

Continue compiling

Make-k

After the use of make-k, it was tragic, compiled a night is not good.

When you get up in the morning, use "Ctrl + C" To break the compilation, reinstall the above dependencies, and then do the cleanup work.

Make clean

Then go ahead and add a sudo, because the previous compilation output a hint like "no permission action".

sudo make-j8

After about two hours, the hard drive utilization was 100% and remained motionless. The compilation also seems to stop. One hours later, it looks like t~t.

Does the cache consume too much hard disk space? Not enough space for a virtual machine?

Well, I'm re-pretending to be an Ubuntu. Then allocate 60G of virtual space, 2G memory, 20G compiled cache. Run Another night.

The next day a look, again error, really tears!

arm-linux-androideabi-g++: Internal compiler error:killed (program Cc1plus)

What the hell is this?

Through the command build-essential,g++ I have also installed AH.

Google a bit, there is a bug report:build #478 Failed, but did not see the answer.

See StackOverflow A similar question and answer: Arm-linux-androideabi-gcc:internal error:killed (program cc1) from Android NDK R8

Organize a few answers:

This error went away for me when I used "make" instead of the recommended "Make-j4".
But rebooting the virtual machine seems to fix the problem for me. Is you sure??
For those has this issue with VMs, the solution that worked for me is bumping up the base memory. It is originally set to 512MB to 1536MB.

But this is GCC.

And then find this: Firefox build for Android fails, which mentions:

Is it really small ram?

Try it again. For machine configuration reasons, it seems that the virtual machine can only be allocated 3G of memory. Then direct sudo make to execute the command.

Crazy!! is arm still small?

Re-install Ubuntu again. This time allocate 90G hard disk space, 4G memory (at first I thought I could only give 3G).

12. Successful compilation

Finally use the following compile command

sudo make-j2

From around 11:30 A.M. to start execution, night 10 o'clock back, see incredibly compiled successfully! Did you see system.img? haha ~

Enter the directory/out/target/product/generic, you can see RAMDISK.IMG, system.img, userdata.img, cache.img these four image files

13. Run the Android emulator

Since the compilation was successful, you can run the Android emulator directly by enabling the command if you have not exited the terminal at this time.

Emulator

If you exit a previously compiled terminal command-line window, running the emulator is completely different.

If it works for you, please support ~

Reference:

Download, compile, and install Android's latest source code on Ubuntu http://www.linuxidc.com/Linux/2011-06/37781.htm

Android 4.4 Source Code compilation Http://www.linuxidc.com/Linux/2015-01/112628.htm

For more information about Ubuntu see the Ubuntu feature page http://www.linuxidc.com/topicnews.aspx?tid=2

For more information about Android, see the Android feature page http://www.linuxidc.com/topicnews.aspx?tid=11

This article permanently updates the link address : http://www.linuxidc.com/Linux/2016-01/127292.htm

"Go" on Ubuntu 14.04.3 configuration and successfully compiled Android 6.0 R1 source code

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.