背景
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/254091.html
標籤:其他
