当前位置: 首页 > news >正文

system.img无法打包非PRODUCT_PACKAGES目标解析

背景:

针对上一篇文章给大家步骤的关于aosp15版本上system.img的打包已经和以前aosp14不一样的问题,这里再简单描述如下:
在这里插入图片描述但是在aosp15后,明显发现并不会打包整个system文件夹。
下面来探索这个到底是为啥?

线索追踪:

这里主要通过对比在out目录下对应的img的输出的中间目录
先看aosp14上同样的目录如下:

test@test:~/disk2/aosp14/out/target/product/emulator_x86_64/obj/PACKAGING/systemimage_intermediates$ ls -l
total 991824
-rw-rw-r-- 1 test test       2960 Apr 24 12:36 system_image_info.txt
-rw-rw-r-- 1 test test 1083002880 Apr 24 12:36 system.img

再看aosp15的情况如下:

test@test:~/aosp15/out/target/product/emu64x/obj/PACKAGING/system_intermediates$ ll
total 791680
drwxrwxr-x  2 test test      4096 Apr 24 22:34 ./
drwxrwxr-x 25 test test      4096 Apr 24 11:14 ../
-rw-rw-r--  1 test test     62288 Apr 24 11:29 file_list.txt
-rw-rw-r--  1 test test    258910 Apr 24 11:14 file_list.txt.rsp
-rw-rw-r--  1 test test       992 Apr 24 22:33 system_image_info.txt
-rw-rw-r--  1 test test 877621248 Apr 24 22:35 system.img

明显多了了个文件file_list.txt和file_list.txt.rsp,这里其实主要就是看file_list.txt文件既可以,可以看看它的内容

在这里插入图片描述不过在文件查找发现并没有我们新编译的目标没有加入PRODUCT_PACKAGES的文件,所以基本上我们就可以断定,aosp15相比aosp14就是在打包img时候,多了这个file_list.txt文件作为过滤依据,在打包img文件时候就是只会打包只有在file_list.txt文件中的,不在文件中也就不会打包。

至于是否使我们猜想的结论可以还需要更多验证,和需要相关build模块的git log来验证,看看这个修改的目的。

追查为什么要加入file_list.txt

这里可以通过在aosp15的代码中进行相关的grep file_list字符,因为涉及是编译模式变化,当然要到build目录进行grep,结果如下:
在这里插入图片描述
然后通过git blame看看这个提交记,然后git show看看相关提交详情

test@test:~/aosp15/build/make/core$ git show 152cdfab7c2
commit 152cdfab7c2a02a64b24a706566183d863db7a38
Author: Cole Faust <colefaust@google.com>
Date:   Wed Jul 26 14:33:51 2023 -0700Clean staging dirs in build_image.pybuild_image.py now accepts a --input-directory-filter-file argumentthat contains a list of files to consider from the input directory.A new, temporary input directory will be created, and only theconsidered files will be copied to it.This removes most of the need for `m installclean`, as old files orfiles built manually will no longer end up on the partition.Bug: 205632228Test: PresubmitsChange-Id: I07e0bf8e840abf0b51a2fdf67b758905fb3c5b5bdiff --git a/Changes.md b/Changes.md
index 6836528762..2616117d7a 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,4 +1,15 @@
-# Build System Changes for Android.mk Writers
+# Build System Changes for Android.mk/Android.bp Writers
+
+## Partitions are no longer affected by previous builds
+
+Partition builds used to include everything in their staging directories, and building an
+individual module will install it to the staging directory. Thus, previously, `m mymodule` followed
+by `m` would cause `mymodule` to be presinstalled on the device, even if it wasn't listed in
+`PRODUCT_PACKAGES`.
+
+This behavior has been changed, and now the partition images only include what they'd have if you
+did a clean build. This behavior can be disabled by setting the
+`BUILD_BROKEN_INCORRECT_PARTITION_IMAGES` environment variable or board config variable.## Perform validation of Soong plugins

这里大概提交中可以看出:

build_image.py脚本新增的–input-directory-filter-file参数实现了输入目录文件过滤功能,其核心作用与实现逻辑可归纳为
a.通过指定包含文件列表的过滤文件,脚本会自动创建临时输入目录,仅复制列表中明确指定的文件到新目录

b.有效解决了旧版本构建残留文件或手动生成文件意外混入分区的问题

c.通过前置过滤机制保障输入目录纯净度

修改方案:

这里修改方案可以如下两种:

1、正常把目标放入到PRODUCT_PACKAGES,这种就啥事情也没有,本身目标也是系统img的一员

2、不想放入到PRODUCT_PACKAGES,还是想要可以打包到img
这种临时修改方案可以如下:
步骤一:修改out目录下的的file_list文件

修改 out/target/product/emu64x/obj/PACKAGING/system_intermediates/file_list.txt文件,如下在这里插入图片描述

然后再老方法,触发系统重新打包编译,运行模拟器看看现象如下:
在这里插入图片描述

更多framework实战vip独享干货,请关注下面“千里马学框架”

http://www.xdnf.cn/news/131293.html

相关文章:

  • BUUCTF-[GWCTF 2019]re3
  • DeepSeek/AI驱动的销售业绩倍增实战
  • RHCE 第三次作业 正向解析
  • # 构建词汇表:自然语言处理中的关键步骤
  • 浏览器f12可以搜索接口的入参 和返回内容
  • 【Langchain】RAG 优化:提高语义完整性、向量相关性、召回率--从字符分割到语义分块 (SemanticChunker)
  • netcore8.0项目部署到windows服务器中(或个人windows电脑),利用nginx反向代理
  • 【c++11】c++11新特性(下)(可变参数模板、default和delete、容器新设定、包装器)
  • Browser-use使用教程
  • 智慧联络中心SaaS平台Java项目面试实战
  • Linux:进程间通信---匿名管道
  • 数字域残留频偏的补偿原理
  • 【Linux网络】:套接字之UDP
  • 精读27页健康医疗大数据安全管控分类分级实施指南
  • 常见游戏引擎介绍与对比
  • Python在AI虚拟教学视频开发中的核心技术与前景展望
  • uni-app 引入高德地图
  • 交叉编译paho.mqtt.c和paho.mqtt.cpp(MQTT客户端)
  • 【金仓数据库征文】金仓数据库KingbaseES:千行百业国产化征程中的璀璨之星
  • 【尚硅谷Redis6】自用学习笔记
  • leetcode0106. 从中序与后序遍历序列构造二叉树-medium
  • 巧记英语四级单词 Unit5-中【晓艳老师版】
  • 系统思考:看清问题背后的结构
  • 人工智能与机器学习,谁是谁的子集 —— 再谈智能的边界与演进路径
  • Action:Update your application‘s configuration
  • 【Harmony OS】组件
  • 高级java每日一道面试题-2025年4月25日-基础篇[反射篇]-在运行时,如何判断某个类是否实现了特定的接口或扩展了某个父类?
  • 动态规划(1)(java)(面试题)三步问题
  • 深度学习笔记22-RNN心脏病预测(Tensorflow)
  • Python torch.optim.lr_scheduler 常用学习率调度器使用方法