一身转战三千里,一剑曾百万师。这篇文章主要讲述android源码编译到刷机过程2相关的知识,希望能为你提供帮助。
0,vbox挂载共享
sudo mount -t vboxsf H /mnt/H/
1,安装系统
配置:
内存 12G
cpu 16个,峰值 95%
硬盘200G
分区:自动分区
2,配置环境,下载源码
sudo apt-get update
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
sudo apt-get install openjdk-7-jdk
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo >
~/bin/repo
chmod a+x ~/bin/repo
git config --global user.name "fbb"
git config --global user.email "[email
protected]"
M4B30Z android-6.0.1_r77 Marshmallow Nexus 5
mkdir android-6.0.1_r77
cd android-6.0.1_r77
## 如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成下面的:
## REPO_URL = ‘https://gerrit-googlesource.proxy.ustclug.org/git-repo‘
//google地址下载困难用,清华的镜像。
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-6.0.1_r77
repo sync -j4
3,(参考)下载nexus 5 的硬件驱动:
关键字:编译android 刷到nexus 5
https://developers.google.com/android/drivers
Nexus 5 (GSM/LTE) ("hammerhead")
Nexus 5 (GSM/LTE) binaries for Android 6.0.1 (MMB29S)
/*
Nexus 5 (GSM/LTE) binaries for Android 6.0.1 (MMB29S)
Hardware ComponentCompanyDownloadSHA-256 Checksum
NFC, Bluetooth, Wi-FiBroadcomLink57e056be0925ab0800d5e07b06849322d9a8d3e9e00f0fe1ecebad0387d3f1f1
Camera, Sensors, AudioLGLink3a8f970fc13330ea54573f2c9002a1071dae56eae5337aa2220efa213b810164
Graphics, GSM, Camera, GPS, Sensors, Media, DSP, USBQualcommLinkadd1a3008faf2a68b44851e7ab193fb5b2e488dd4a92ec0c6b7d391576312a23
*/
过程:
根据链接下载 三个 tgz的文件,
解压后是sh文件放到源码的跟目录,
执行sh文件,会在源码根目录下生存vendor文件夹。
命令:
mkdir drivers
curl https://dl.google.com/dl/android/aosp/broadcom-hammerhead-mmb29s-3a3c03c6.tgz >
~/drivers/broadcom-hammerhead-mmb29s-3a3c03c6.tgz
curl https://dl.google.com/dl/android/aosp/lge-hammerhead-mmb29s-fa0209c9.tgz >
~/drivers/lge-hammerhead-mmb29s-fa0209c9.tgz
curl https://dl.google.com/dl/android/aosp/qcom-hammerhead-mmb29s-bd184be4.tgz >
~/drivers/qcom-hammerhead-mmb29s-bd184be4.tgz
tar -zxf broadcom-hammerhead-mmb29s-3a3c03c6.tgz
tar -zxf lge-hammerhead-mmb29s-fa0209c9.tgz
tar -zxf qcom-hammerhead-mmb29s-bd184be4.tgz
cp ~/drivers/extract-broadcom-hammerhead.sh ~/android-4.4.4_r1/extract-broadcom-hammerhead.sh
cp ~/drivers/extract-lge-hammerhead.sh ~/android-4.4.4_r1/extract-lge-hammerhead.sh
cp ~/drivers/extract-qcom-hammerhead.sh ~/android-4.4.4_r1/extract-qcom-hammerhead.sh
./extract-broadcom-hammerhead.sh
./extract-lge-hammerhead.sh
./extract-qcom-hammerhead.sh
################################################################
打包:tar -cf /mnt/H/android-6.0.1_r77.tar android-6.0.1_r77
################################################################
4,编译android源码
make clobber
source build/envsetup.sh
lunch
输入:19
选择的:
19. aosp_hammerhead-userdebug
make -j16
lunch aosp_hammerhead-user
TARGET_BUILD_VARIANT=user
choosecombo release msm8974 user
function choosecombo()
{
choosetype $1
echo
echo
chooseproduct $2
echo
echo
choosevariant $3
echo
set_stuff_for_environment
printconfig
choosevariant
choosevariant
user版本需要先打开USB debug开关,打开方式如下:
1、打开usb调试 build/core/main.mk
请将user版本下也改为ro.debuggable = 1
ifeq (true,(strip(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
# Include the debugging/testing OTA keys in this build.
INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 //这边改成1
endif # !enable_target_debugging
【android源码编译到刷机过程2】语言:
/home/fbb/android-6.0.1_r77/build/target/product/languages_full.mk
推荐阅读
- 一(ORM关系对象映射(Object Relational Mapping,简称ORM))
- android源码编译到刷机过程1
- 记录学习Appium踩过的一些坑(持续更新)
- 史上最全!CodeIgniter面试题和答案汇总
- C#常见面试题和答案合集详解
- 面试必备!WordPress面试题和知识点汇总
- 史上最全!Magento面试题和答案合集
- 推荐!Joomla面试题和答案汇集
- 最新Drupal面试问题和知识点合集