Android安全在线视频课程+免费指导+Android逆向/安全相关工作推荐
APP逆向分析/渗透测试/安全检测/隐私合规如何选择手机机型或系统
https://m.weishi100.com/mweb/series/?id=1372437
AOSP Android11系统源码编译
本节主要内容:
pixel3手机源码驱动文件配置
安卓源码中编译Pixel 3设备手机镜像
1.编译环境构建
安装所需的软件包:
qiang@ubuntu:~/Aosp11$ sudoapt-getinstallgit-coregnupgflexbisonbuild-essentialzip curlzlib1g-devgcc-multilibg++-multiliblibc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-devlibx11-devlib32z1-devlibgl1-mesa-devlibxml2-utilsxsltprocunzip fontconfig
2.配置手机设备的驱动文件
(1).查找源代码版本对应的代号
安卓Aosp源码中支持很多个设备的镜像编译,在编译之前需要配置对应设备依赖的驱动文件。此处下载 的源码版本为:android-11.0.0_r46。对应安卓源码代号为:RQ3A.211001.001。具体源代码版本对应的 代号以及支持的手机设备可以如下官网中查找:https://source.android.google.cn/setup/start/build- numbers。如下是该官网中找到的本编译版本结果。如下所示:
Google已为Aosp源码中支持的设备提供了对应的驱动文件支持。在官
网:https://developers.google.cn/android/drivers可以找到对应系统版本和手机设备的驱动文件。此处需 要编译的设备为pixel 3手机,手机系统版本为:android-11.0.0_r46,代号为:RQ3A.211001.001。在驱动 官网找到对应的驱动文件如下:
点击页面中的"Link"下载对应的驱动文件包,并分别解压到源码根目录。如下所示:
qiang@ubuntu:~/Aosp11$
qiang@ubuntu:~/Aosp11$ pwd
/home/qiang/Aosp11
qiang@ubuntu:~/Aosp11$ ls-laextract-*
-rwxr-x--x1 qiangqiang263013256 Sep23 2021 extract-google_devices-blueline.sh -rwxr-x--x1 qiangqiang 1094338 Sep23 2021 extract-qcom-blueline.sh
qiang@ubuntu:~/Aosp11$
qiang@ubuntu:~/Aosp11$
(3).执行驱动shell提取脚本
分别在终端执行extract-google_devices-blueline.sh和extract-qcom-blueline.sh脚本提取设备对应 的驱动文件。该脚本执行完成之后,会自动在源码目录vendor中生成设备对应的驱动文件相关配置文 件。命令执行如下:
[email protected]:~/Aosp11$ ./extract-google_devices-blueline.sh
[email protected]:~/Aosp11$ ./extract-qcom-blueline.sh
注意事项:
执行以上两个脚本之后,会显示一个文本协议,需要按*"Enter"键拉到底部,然后输入"I ACCEPT"的信 息之后才能提取成功。如下所示:
3.源码编译
执行如下命令进行Pixel3设备的镜像编译。命令如下:
[email protected]:~/Aosp11$ source build/envsetup.sh
[email protected]:~/Aosp11$ lunch
You 're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_blueline-userdebug
4. aosp_blueline_car-userdebug
5. aosp_bonito-userdebug
54. yukawa_sei510-userdebug
Which would you like? [aosp_arm-eng] 3
============================================
PLATFORM VERSION CODENAME=REL
PLATFORM VERSION=11
TARGET_PRODUCT=aosp_blueline
TARGET_BUILD_VARIANT=userdebug
TARGET BUILD TYPE=release
TARGET ARCH=arm64
TARGET ARCH VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET 2ND ARCH=arm
TARGET 2ND ARCH VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST ARCH=x86 64
HOST 2ND ARCH=x86
HOST OS=linux
HOST_OS_EXTRA=Linux-5.13.0-44-generic-x86_64-Ubuntu-20.04.4-LTS
HOST CROSS OS=windows
HOST CROSS ARCH=x86
HOST CROSS 2ND ARCH=x86 64
HOST BUILD TYPE=release
BUILD_ID=RQ3A.211001.001
OUT DIR=out
PRODUCT_SOONG_NAMESPACES=device/google/crosshatch hardware/google/av hardware/google/camera hard
============================================
[email protected]:~/Aosp11$ make -j6
以上命令说明:
sourcebuild/envsetup.sh命令初始化编译环境。
lunch命令列举当前源码支持的设备编译列表。由于此处的测试机为pixel 3,对应系统源码设备代号
为:blueline,所以选择:3. aosp_blueline-userdebug进行编译。
make -j6表示开启6个并行任务数进行编译,此处j6可以根据电脑处理器进行调整。
以上命令编译的镜像为userdebug镜像,具有root权限和调试功能。如果想编译user模式镜像(user类型 的镜像权限受限,适用于生产环境)。可以参考如下命令执行编译。
[email protected]:~/Aosp11$ source build/envsetup.sh
[email protected]:~/Aosp11$ lunch
You are building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_blueline-userdebug
Which would you like? [aosp_arm-eng] 3
============================================
PLATFORM VERSION CODENAME=REL
_ _
PLATFORM VERSION=11
_
TARGET_PRODUCT=aosp_blueline
TARGET_BUILD_VARIANT=userdebug
TARGET BUILD TYPE=release
TARGET ARCH=arm64
TARGET ARCH VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET 2ND ARCH=arm
TARGET 2ND ARCH VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST ARCH=x86 64
HOST 2ND ARCH=x86
HOST OS=linux
HOST_OS_EXTRA=Linux-5.13.0-44-generic-x86_64-Ubuntu-20.04.4-LTS
HOST CROSS OS=windows
HOST CROSS ARCH=x86
HOST CROSS 2ND ARCH=x86 64
HOST BUILD TYPE=release
BUILD_ID=RQ3A.211001.001
OUT DIR=out
PRODUCT_SOONG_NAMESPACES=device/google/crosshatch hardware/google/av hardware/google/camera hard
============================================
[email protected]:~/Aosp11$ choosecombo
Build type choices are:
1. release
2. debug
Which would you like? [1] 1
Which product would you like? [aosp_blueline]
Variant choices are:
1. user
2. userdebug
3. eng
Which would you like? [eng] 1
============================================
PLATFORM VERSION CODENAME=REL
PLATFORM VERSION=11
TARGET_PRODUCT=aosp_blueline
TARGET BUILD VARIANT=user
TARGET BUILD TYPE=release
TARGET ARCH=arm64
TARGET ARCH VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET 2ND ARCH=arm
TARGET 2ND ARCH VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST ARCH=x86 64
HOST 2ND ARCH=x86
HOST OS=linux
HOST_OS_EXTRA=Linux-5.13.0-44-generic-x86_64-Ubuntu-20.04.4-LTS
HOST CROSS OS=windows
HOST CROSS ARCH=x86
HOST CROSS 2ND ARCH=x86 64
HOST BUILD TYPE=release
BUILD_ID=RQ3A.211001.001
OUT DIR=out
PRODUCT_SOONG_NAMESPACES=device/google/crosshatch hardware/google/av hardware/google/camera hard
============================================
[email protected]:~/Aosp11$ make -j6
商务合作、进群添加官方微信
推荐阅读
AOSP Android11系统源码下载方法(Pixel3)
强烈推荐Google系列Android机型(Android逆向的最佳机型)
Android11系统源码的下载与编译方法(解决内存、磁盘不足问题)
Ubuntu18.04/20.04虚拟机编译Android4/5/6/7/8/9/10/11系统源码的问题解决
Ubuntu20.04系统添加swap交换空间解决Android系统编译过程内存不足的问题
2022全球20多款知名的Android刷机ROM镜像和Android系统开源源码(覆盖全球机型)
Android手机系统刷机方法
玩转Android10(二)刷机操作之fastboot刷机演示