编译流程:http://www.noobyard.com/article/p-zjbidapj-ms.html
目录
一、基本步骤
1.编译uboot
2.环境配置
source build/envsetup.sh >/dev/null && setpaths
lunch rk3399_box-userdebug
3.编译kernel
4.编译android
注意android编译之前又重新执行了一次两样的产品配置
5.使用mkimage.sh调用各种镜像生成工具生成镜像文件
6.使用mkupdate.sh生成update.img(可直接刷机的镜像)
三、流程详解
产品配置
lunch完之后的产品信息为rk3399_box.mk
脚本及命令
-
envsetup.sh脚本
自身会通过add_lunch_combo方法生成一些默认的产品配置信息,脚本的最后会遍历device、vendor、product目录下面的vendorsetup.sh文件然后include。 -
lunch命令
1.printconfig原理:依赖于build_build_var_cache方法生成的变量,其中dumpvar.mk文件中会生成打印产品配置信息的变量
@echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
相关mk文件
- app.mk
会将一些程序及rc文件拷贝到根文件系统
编译android
源码根目录执行make,调用根目录的Makefile,然后调用build/core/main.mk
。
build/core/main.mk的默认目标为:
DEFAULT_GOAL := droid
$(DEFAULT_GOAL): droid_targets
然后根据是否定义TARGET_BUILD_APPS
,droid_targets会产生不同的依赖。
ifneq ($(TARGET_BUILD_APPS),)
droid_targets: apps_only
else
# Building a full system-- the default is to build droidcore
droid_targets: droidcore dist_files
endif
依赖关系树形图:
参照https://www.cnblogs.com/Oude/p/12553545.html
droid_targets
##droidcore (Build files and then package it into the rom formats)
##files
##systemimage (目标定义在build/core/Makefile中)
##各种镜像文件
##dist_files (putting your library into the dist directory with a full build.完整编译系统的时候拷贝库文件)
0 条评论