高通qssi android R OTA
背景Google在androidQ版本上动态分区就启用了,另外高通在android R版本上既开启了动态分区,还默认了启用qssi的机制,对于OTA升级来说,这块会有什么变化,本文先从近期的一些调试过程中,简单总结一些注意事项,当然主要是一些记录,后续还需要继续分析流程.问题调试部分device/honeywell/eda52/AndroidBoard.mk#-------------------
背景
Google在android Q版本上动态分区就启用了,另外高通在android R版本上既开启了动态分区,还默认了启用qssi的机制,对于OTA升级来说,这块会有什么变化,本文先从近期的一些调试过程中,简单总结一些注意事项,当然主要是一些记录,给最近在高通R版本上调试的朋友一点微薄的帮助,后续还需要继续分析流程.
问题调试部分
device/oem/projectxx/AndroidBoard.mk,添加abl镜像的编译,做了个判断,因为先编译qssi,不加判断导致编译报错
#----------------------------------------------------------------------
# Radio image
#----------------------------------------------------------------------
#
# OTA Package should add abl
$(warning "current build not qssi should install abl ", $(TARGET_PRODUCT))
ifneq ($(TARGET_PRODUCT),qssi)
INSTALLED_RADIOIMAGE_TARGET +=$(addprefix $(PRODUCT_OUT)/,abl.elf)
endif
# OTA Package should add abl
ifeq ($(ADD_RADIO_FILES), true)
radio_dir := $(LOCAL_PATH)/radio
RADIO_FILES := $(shell cd $(radio_dir) ; ls)
$(foreach f, $(RADIO_FILES), \
$(call add-radio-file,radio/$(f)))
endif
MP侧的镜像集成,总体来说,把所有带ab分区的镜像都添加到AB_OTA_PARTITIONS,这边遇到的几个问题
1.高通默认的文档做法是直接让把所有带ab分区的Modem bin修改为和MP partition.xml中的label名保持一致,eg
<partition label="modem_a" size_in_kb="184320" type="EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" bootable="false" readonly="true" filename="NON-HLOS.bin"/>
对应的device/oem/project/radio/下将NON-HLOS.bin,修改为modem.img
2.当然,为了兼顾后续的Modem bin的更新,我们也可以保持radio下bin文件的原样,在编译OTA版本时,通过脚本将镜像改名的方式更可取.
build/make/tools/releasetools/add_img_to_target_files.py
脚本添加了如下函数方便把target_file处理,radio目录下新建MPI_config文本文件,
def GetMPI_config(MP_list):
MPI_config = os.path.join(OPTIONS.input_tmp, "RADIO", "MPI_config")
assert os.path.exists(MPI_config)
with open(MPI_config) as f:
for line in f.readlines():
if line.startswith('#'):
logger.info("Note:"+line)
continue
MP_info=line.strip().split('=')
logger.info("partition:" + MP_info[0] + " imagename:" + MP_info[1])
MP_list.update({MP_info[0]: MP_info[1]})
MPI_config范例
#partition=imagename
abl=abl.elf
modem=NON-HLOS.bin
dsp=dspso.bin
devcfg=devcfg.mbn
keymaster=km41.mbn
rpm=rpm.mbn
xbl=xbl.elf
xbl_config=xbl_config.elf
tz=tz.mbn
hyp=hyp.mbn
bluetooth=BTFM.bin
imagefv=imagefv.elf
uefisecapp=uefi_sec.mbn
qupfw=qupv3fw.elf
multiimgoem=multi_image.mbn
featenabler=featenabler.mbn
在函数CheckAbOtaImages中处理,此处注意,需要考虑下qssi和非qssi target的编译问题,所以在调用CheckAbOtaImages的函数中通过读取ab_partitions.txt做了个区分
def CheckAbOtaImagesNonQssi(output_zip, ab_partitions):
"""Checks that all the listed A/B partitions have their images available.
The images need to be available under IMAGES/ or RADIO/, with the former takes
a priority.
Args:
output_zip: The output zip file (needs to be already open), or None to
find images in OPTIONS.input_tmp/.
ab_partitions: The list of A/B partitions.
Raises:
AssertionError: If it can't find an image.
"""
MP_list = {}
GetMPI_config(MP_list)
for partition in ab_partitions:
partition_name = partition.strip()
img_name = partition_name + ".img"
if partition_name in MP_list.keys():
radio_src_img_name = MP_list[partition_name]
radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", radio_src_img_name)
images_path = os.path.join(OPTIONS.input_tmp, "IMAGES", img_name)
shutil.copy(radio_path, images_path)
# Assert that the image is present under IMAGES/ now.
if output_zip:
# Zip spec says: All slashes MUST be forward slashes.
images_path = "IMAGES/" + img_name
radio_path = "RADIO/" + img_name
available = (images_path in output_zip.namelist() or
radio_path in output_zip.namelist())
else:
images_path = os.path.join(OPTIONS.input_tmp, "IMAGES", img_name)
radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name)
available = os.path.exists(images_path) or os.path.exists(radio_path)
assert available, "Failed to find " + img_name
调用处函数AddCareMapForAbOta通过target_file中metadata的ab_partitions.txt分区镜像编译确定当前是qssi还是target编译,因为只有target编译才需要修改Modem bin镜像名
if any("abl\n" in s for s in ab_partitions):
CheckAbOtaImagesNonQssi(output_zip, ab_partitions)
logging.warning(" OTA add image oem project build ...")
else:
CheckAbOtaImages(output_zip, ab_partitions)
logging.warning("OTA add image qssi build ...")
# Generate care_map.pb for ab_partitions, then write this file to
# target_files package.
3.BoardConfig.mk里面对ab partition的配置处理,涉及到升级modem bin之后出现切换slot开不起机,及开机crash的问题.
ifeq ($(ENABLE_AB), true)
# Defines for enabling A/B builds
AB_OTA_UPDATER := true
# Full A/B partition update set
# AB_OTA_PARTITIONS := xbl rpm tz hyp pmic modem abl boot keymaster cmnlib cmnlib64 system bluetooth
# add modem image to OTA Package
#AB_OTA_PARTITIONS := xbl xbl_config rpm tz hyp modem abl keymaster bluetooth dsp imagefv uefisecapp devcfg qupv3fw multiimgoem featenabler
ifneq ($(TARGET_PRODUCT),qssi)
$(warning " OTA add image oemProject build ota should go ... ")
#此处记录下部分分区添加的作用,vendor是兼顾编译报错,dtbo vbmeta是升级完成后因为校验无法进入系统,boot添加是因为开机的crash
AB_OTA_PARTITIONS := vendor xbl xbl_config rpm tz hyp modem abl keymaster dsp devcfg dtbo vbmeta bluetooth imagefv uefisecapp qupfw multiimgoem featenabler boot
else
# Minimum partition set for automation to test recovery generation code
# Packages generated by using just the below flag cannot be used for updating a device. You must pass
# in the full set mentioned above as part of your make commandline
$(warning " OTA add image qssi build ota should go ... ")
AB_OTA_PARTITIONS ?= boot vendor dtbo vbmeta
endif
这里需要指出的一点是,当qssi编译时,实际AB_OTA_PARTITIONS的赋值在qssi对应的BoardConfig.mk中赋值,当动态分区和虚拟AB同时开启时,
AB_OTA_PARTITIONS ?= system system_ext product vbmeta_system
###### Dynamic Partition Handling ####
ifneq ($(strip $(BOARD_DYNAMIC_PARTITION_ENABLE)),true)
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
BOARD_VENDORIMAGE_PARTITION_SIZE := 1073741824
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472
BOARD_PRODUCTIMAGE_PARTITION_SIZE := 838860800
ifeq ($(ENABLE_AB), true)
AB_OTA_PARTITIONS ?= system
endif
else
TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_SYSTEM_EXT := system_ext
BOARD_USES_PRODUCTIMAGE := true
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
BOARD_SUPER_PARTITION_SIZE := 12884901888
BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions
BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := system system_ext product
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 6438256640
BOARD_EXT4_SHARE_DUP_BLOCKS := true
ifeq ($(ENABLE_AB), true)
AB_OTA_PARTITIONS ?= system system_ext product vbmeta_system
endif
endif
###### Dynamic Partition Handling ####
更多推荐
所有评论(0)