aosp的android 5.0编译源码-asus 编译代号

aosp的android 5.0编译源码:

sudo apt-get install openjdk-7-jdk
2.source build/env
3.lunch nexus-7 2012 grouper
4.make otapackage -j16 2>&1 | tee build.log

Obtaining proprietary binaries

The Android Open-Source Project can’t be used from pure source code only, and requires additional hardware-related proprietary libraries to run, specifically for hardware graphics acceleration.

Official binaries for the supported devices running tagged AOSP release branches can be downloaded fromGoogle’s Nexus driver page. These add access to additional hardware capabilities with non-open-source code. To instead build the AOSP master branch, use the Binaries Preview for Nexus Devices.

When building the master branch for a device, the binaries for the most recent numbered release or with the most recent date are the ones that should be used.

Extracting the proprietary binaries

Each set of binaries comes as a self-extracting script in a compressed archive. After uncompressing each archive, run the included self-extracting script from the root of the source tree, confirm that you agree to the terms of the enclosed license agreement, and the binaries and their matching makefiles will get installed in thevendor/ hierarchy of the source tree.

Cleaning up when adding proprietary binaries

In order to make sure that the newly installed binaries are properly taken into account after being extracted, the existing output of any previous build needs to be deleted with

$ make clobber

Picking and building the configuration that matches a device

The steps to configure and build the Android Open Source Project are described in the Building page.

The recommended builds for the various devices are available through the lunch menu, accessed when running the lunch command with no arguments. Factory images and binaries for Nexus devices can be downloaded from:

Device Code name Build configuration
Nexus 5 (GSM/LTE) hammerhead aosp_hammerhead-userdebug
Nexus 7 (Wi-Fi) razor (flo) aosp_flo-userdebug
Nexus 7 (Mobile) razorg (deb) aosp_deb-userdebug
Nexus 10 mantaray (manta) full_manta-userdebug
Nexus 4 occam (mako) full_mako-userdebug
Nexus 7 (Wi-Fi) nakasi (grouper) full_grouper-userdebug
Nexus 7 (Mobile) nakasig (tilapia) full_tilapia-userdebug
Galaxy Nexus (GSM/HSPA+) yakju (maguro) full_maguro-userdebug
Galaxy Nexus (Verizon) mysid (toro) aosp_toro-userdebug
Galaxy Nexus (Experimental) mysidspr (toroplus) aosp_toroplus-userdebug
PandaBoard (Archived) panda aosp_panda-userdebug
Motorola Xoom (U.S. Wi-Fi) wingray full_wingray-userdebug
Nexus S soju (crespo) full_crespo-userdebug
Nexus S 4G sojus (crespo4g) full_crespo4g-userdebug

Do not use 4.1.1 on a Nexus 7 that was originally sold with 4.1.2 or newer.

Flashing a device

Set the device in fastboot mode if necessary (see above).

An entire Android system can be flashed in a single command: this writes the boot, recovery and system partitions together after verifying that the system being flashed is compatible with the installed bootloader and radio, and reboots the system. This also erases all the user data, similarly to fastboot oem unlock mentioned earlier.

$ fastboot -w flashall

Note that filesystems created via fastboot on Motorola Xoom aren’t working optimally, and it is strongly recommended to re-create them through recovery

$ adb reboot recovery

Once in recovery, open the menu (press Power + Volume Up), wipe the cache partition, then wipe data.


Booting into fastboot mode

During a cold boot, the following key combinations can be used to boot into fastboot mode, which is a mode in the bootloader that can be used to flash the devices:

Device Keys
hammerhead Press and hold both Volume Up and Volume Down, then press and hold Power
flo Press and hold Volume Down, then press and hold Power
deb Press and hold Volume Down, then press and hold Power
manta Press and hold both Volume Up and Volume Down, then press and hold Power
mako Press and hold Volume Down, then press and hold Power
grouper Press and hold Volume Down, then press and hold Power
tilapia Press and hold Volume Down, then press and hold Power
phantasm Power the device, cover it with one hand after the LEDs light up and until they turn red
maguro Press and hold both Volume Up and Volume Down, then press and hold Power
toro Press and hold both Volume Up and Volume Down, then press and hold Power
toroplus Press and hold both Volume Up and Volume Down, then press and hold Power
panda Press and hold Input, then press Power
wingray Press and hold Volume Down, then press and hold Power
crespo Press and hold Volume Up, then press and hold Power
crespo4g Press and hold Volume Up, then press and hold Power

Also, the command adb reboot bootloader can be used to reboot from Android directly into the bootloader with no key combinations.

fastboot oem unlock
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata
fastboot flash bootloader bootloader-grouper-4.23.img
fastboot reboot-bootloader
sleep 10
fastboot -w update


Nexus 7 (Wi-Fi) binaries for Android 4.4.4 (KTU84P)

Hardware Component Company Download MD5 Checksum SHA-1 Checksum
Camera, Sensors, DRM ASUS Link 7ffa1f81555ed43a7c3087f433259664 23762b0aed3cd3120e0c3fc3dadc6d5a69ab9772
Wi-Fi, Bluetooth, GPS Broadcom Link c92d63852e3ba158e4c0a0766b2418e0 d8c1d01d17092b89cf62fb49e239c1373f27b9bd
Touch Panel ELAN Link 008d914344e5946fad5b9b6d89c6b58d 9f56304c2b5228117155dbd0091258bf2a6b2c05
Orientation Sensor Invensense Link 7684cae88024bc5cfa7f11f5d6ace212 5549e1b7ec243dd315763cfaba2a06a00078fb2c
Graphics NVIDIA Link d1e9ef9b67cf3a1b5055597625a5d857 f7363843ac56c125f8d2d869b94d5700d0e53a2a
NFC NXP Link b92526920471de241aa1b474c2197f29 ccc3753614ce36df907519bc225d4ba1bcdcc8cd
DRM Widevine/Google Link 066906b0170176e9533cc5a9c254a3cf 249b05ae3792325a41e6f4789e793c9f164489f1

支持设备为Nexus系列亲儿子,最近的几款设备全部在列,但是较老的Google Nexus、Nexus S并不在列。

Nexus 7 Wi-Fi 2013:

Nexus 7 LTE 2013:

Nexus 7 Wi-Fi 2012:

Nexus 7 LTE 2012:

Nexus 10:

Nexus 5:

Nexus 4:

Building Kernels

If you are only interested in the kernel, you may use this guide to download and build the appropriate kernel.

The following instructions assume that you have not downloaded all of AOSP. If you have downloaded all of AOSP, you may skip the git clone steps other than the step to download the actual kernel sources.

We will use the Pandaboard kernel in all the following examples.

Figuring out which kernel to build

This table lists the name and locations of the kernel sources and binaries:

Device Binary location Source location Build configuration
hammerhead device/lge/hammerhead-kernel kernel/msm hammerhead_defconfig
flo device/asus/flo-kernel/kernel kernel/msm flo_defconfig
deb device/asus/flo-kernel/kernel kernel/msm flo_defconfig
manta device/samsung/manta/kernel kernel/exynos manta_defconfig
mako device/lge/mako-kernel/kernel kernel/msm mako_defconfig
grouper device/asus/grouper/kernel kernel/tegra tegra3_android_defconfig
tilapia device/asus/grouper/kernel kernel/tegra tegra3_android_defconfig
maguro device/samsung/tuna/kernel kernel/omap tuna_defconfig
toro device/samsung/tuna/kernel kernel/omap tuna_defconfig
panda device/ti/panda/kernel kernel/omap panda_defconfig
stingray device/moto/wingray/kernel kernel/tegra stingray_defconfig
wingray device/moto/wingray/kernel kernel/tegra stingray_defconfig
crespo device/samsung/crespo/kernel kernel/samsung herring_defconfig
crespo4g device/samsung/crespo/kernel kernel/samsung herring_defconfig

You will want to look at the git log for the kernel binary in the device project that you are interested in.

Device projects are of the form device/<vendor>/<name>.

$ git clone
$ cd panda
$ git log --max-count=1 kernel

The commit message for the kernel binary contains a partial git log of the kernel sources that were used to build the binary in question. The first entry in the log is the most recent, i.e. the one used to build that kernel. You will need it at a later step.

Identifying kernel version

To determine the kernel version used in a particular system image, run the following command against the kernel file:

$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'

For Nexus 5 (hammerhead), this can be accomplished with:

$ bzgrep -a 'Linux version' vmlinux.bz2

Downloading sources

Depending on which kernel you want,

$ git clone
$ git clone
$ git clone
$ git clone
$ git clone
$ git clone
$ git clone
  • The goldfish project contains the kernel sources for the emulated platforms.
  • The msm project has the sources for ADP1, ADP2, Nexus One, Nexus 4, and can be used as a starting point for work on Qualcomm MSM chipsets.
  • The omap project is used for PandaBoard and Galaxy Nexus, and can be used as a starting point for work on TI OMAP chipsets.
  • The samsung project is used for Nexus S, and can be used as a starting point for work on Samsung Hummingbird chipsets.
  • The tegra project is for Xoom and Nexus 7, and can be used as a starting point for work on NVIDIA Tegra chipsets.
  • The exynos project has the kernel sources for Nexus 10, and can be used as a starting point for work on Samsung Exynos chipsets.

Downloading a prebuilt gcc

Ensure that the prebuilt toolchain is in your path.

$ export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH


$ export PATH=$(pwd)/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin:$PATH

On a linux host, if you don’t have an Android source tree, you can download the prebuilt toolchain from:

$ git clone


As an example, we would build the panda kernel using the following commands:

$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
$ git checkout <commit_from_first_step>
$ make panda_defconfig
$ make

To build the tuna kernel, you may run the previous commands replacing all instances of “panda” with “tuna”.

The kernel binary is output as: `arch/arm/boot/zImage` It can be copied into the Android source tree in order to build the matching boot image.

Or you can include the TARGET_PREBUILT_KERNEL variable while using make bootimage or any other make command line that builds a boot image.

$ export TARGET_PREBUILT_KERNEL=$your_kernel_path/arch/arm/boot/zImage

That variable is supported by all devices as it is set up via device/common/











copy_from := etc/dbus.conf   etc/hosts

copy_from += etc/vold.fstab


拷贝到那里呢? 在看看copy_to的定义:

copy_to := $(addprefix $(TARGET_OUT)/,$(coby_from))



copy_to :=out/target/product/tcc8800/system/etc/dbus.conf …之类,在此略掉。


copy_from := $(addprefix $(LOCAL_PATH)/, $(copy_from)


$(copy_to) : $(TARGET_OUT)/% : $(LOCAL_PATH)/% | $(ACP)



随后,脚本将copy_to变量添加进 ALL_PREBUILT全局宏中:

ALL_PREBUILT += $(copy_to)

最后,在build/core/Makefile中看到copy_to的内容被提取到了另外一个全局宏 ,具体如下:







file := $(TARGET_ROOT_OUT)/init.rc

$(file) : $(LOCAL_PATH)/% | $(ACP)


ALL_PREBUILT +=$(file)








BUILT_RAMDISK_TARGET = $(PRODUCT_OUT/ramdisk.img 这是我们的目标


MKBOOTFS = mkbootfs 就是位于out/host/linux-x86/bin目录下的mkbootfs,这东西自然也有后话。







LOCAL_KERNEL :=  kernel/arch/arm/boot/Image








现在的问题就是查看 INSTALLED_KERNEL_TARGET的定义,该宏位于build/target/board/Android.mk中: