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 "fbb@fbb.com"
MMB29S android-6.0.1_r9 Marshmallow Nexus 5、Nexus 6、Nexus 9 (volantis/volantisg)
mkdir android-6.0.1_r9
cd android-6.0.1_r9
## 如果提示无法连接到 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_r9
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 Component Company Download SHA-256 Checksum
NFC, Bluetooth, Wi-Fi Broadcom Link 57e056be0925ab0800d5e07b06849322d9a8d3e9e00f0fe1ecebad0387d3f1f1
Camera, Sensors, Audio LG Link 3a8f970fc13330ea54573f2c9002a1071dae56eae5337aa2220efa213b810164
Graphics, GSM, Camera, GPS, Sensors, Media, DSP, USB Qualcomm Link add1a3008faf2a68b44851e7ab193fb5b2e488dd4a92ec0c6b7d391576312a23
*/
过程:
根据链接下载 三个 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
4,编译android源码
make clobber
source build/envsetup.sh
lunch
输入:19
选择的:
19. aosp_hammerhead-userdebug
make -j16
5,刷机
参考(网页下面写了一些android的驱动的配置):http://blog.csdn.net/qq1084283172/article/details/54562606
前提:先配置usb的配置文件:
sudo gedit /etc/udev/rules.d/51-android.rules
sudo sed -i ‘s/username/fbb/g‘ /etc/udev/rules.d/51-android.rules
进入刷机模式的命令:
adb reboot bootloader
查看usb:
lsusb
真机刷机:
fastboot -w flashall
6,framework
1,环境
source build/envsetup.sh
或
. build/envsetup.sh
2,选择目标:
lunch
输入:19
选择的:
19. aosp_hammerhead-userdebug
3,mmm frameworks/base/
4,
sudo mount -t vboxsf H /mnt/H/
cp /home/fbb/android-6.0.1_r77/out/target/product/hammerhead/system/framework/framework.jar /mnt/H/
编译的时候先make clean-framework
然后再 make framework
make systemimage
cp /home/fbb/android-6.0.1_r77/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar /mnt/H/
7,参考
位置:
http://bbs.csdn.net/topics/391963822?page=1
art
android 6.0 源码编译 打开 ODEX
LOCAL_DEX_PREOPT
WITH_DEXPREOPT
关于变量设置:
http://blog.csdn.net/u011913612/article/details/51853502
原文:https://www.cnblogs.com/daimaodeheshang/p/9340796.html