编译android6.0

来源:互联网 发布:网络凶杀2 编辑:程序博客网 时间:2024/06/08 14:27

一、Xshell与ubuntu14连接

1、sudo apt-get update//更新软件源地址
2、sudo apt-get install openssh-server openssh-client //安装ssh框架

xshell连接虚拟机里的ubuntu用ssh安全,telnet和ftp是以明文传输,可能会在中间被黑客攻击

然后,打开Xshell,进行连接

xshell用于远程控制ubuntu


二、安装编译环境所依赖--Ubuntu 14.04 LTS


sudo apt-get update

1. Run below apt-get command to install the package
$ sudo apt-get -y install openjdk-7-jdk
2. Run below update-java-alternatives command to set open JDK 1.7 environment
$ update-java-alternatives -s java-1.7.0-openjdk-amd64

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip


三、android源码下载

由于国内限制,Google提供的下载地址,不能使用

可以参考:https://mirror.tuna.tsinghua.edu.cn/help/AOSP/


四、编译下载好的源码

Building the System

The following instructions to build the Android source tree apply to all branches, includingmaster. The basic sequence of build commands is as follows:

Note: If you're building Android 6.0 or later, please seeCompiling with Jack for information on this new default toolchain.

1、Set up environment

Initialize the environment with the envsetup.sh script. Note that replacingsource with . (a single dot) saves a few characters, and the short form is more commonly used in documentation.

$ source build/envsetup.sh

or

$ . build/envsetup.sh

2、Choose a Target

Choose which target to build with lunch. The exact configuration can be passed as an argument. For example, the following command:

$ lunch aosp_arm-eng

refers to a complete build for the emulator, with all debugging enabled.

If run with no arguments lunch will prompt you to choose a target from the menu.

All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to the particular feature combination.

The BUILDTYPE is one of the following:

BuildtypeUseuserlimited access; suited for productionuserdebuglike "user" but with root access and debuggability; preferred for debuggingengdevelopment configuration with additional debugging tools

For more information about building for and running on actual hardware, see Running Builds.

3、Build the code

Build everything with make. GNU make can handle parallel tasks with a-jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. For example, on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.

$ make -j4

4、Run It!

You can either run your build on an emulator or flash it on a device. Please note that you have already selected your build target withlunch, and it is unlikely at best to run on a different target than it was built for.

Flash a Device

To flash a device, you will need to use fastboot, which should be included in your path after a successful build. Place the device in fastboot mode either manually by holding the appropriate key combination at boot, or from the shell with

$ adb reboot bootloader

Once the device is in fastboot mode, run

$ fastboot flashall -w

The -w option wipes the /data partition on the device; this is useful for your first time flashing a particular device but is otherwise unnecessary.

For more information about building for and running on actual hardware, see Running Builds.

Emulate an Android Device

The emulator is added to your path automatically by the build process. To run the emulator, type

$ emulator




0 0