创建签名的Android映像后缺少内核DTB

问题描述 投票:0回答:1

我正在将android移植到显示设备上,并且差不多完成了这个。该设备使用Freescale / NXP i.MX6 Dual Lite Soc。使用的Android版本是Android 8.0.0,构建基于恩智浦/飞思卡尔的板级支持包(链接如下)。 https://www.nxp.com/support/developer-resources/software-development-tools/i.mx-developer-resources/android-os-for-i.mx-applications-processors:IMXANDROID?tab=Design_Tools_Tab

操作系统构建正常,而且“make”过程产生的图像(u-boot,boot.img,system.img,vendor.img)在设备上工作正常。所以我的最后一步基本上是签署图像,这是我努力工作的地方。

我按照这里找到的指南:https://source.android.com/devices/tech/ota/sign_builds

完成这些步骤后,我使用“signed-img.zip”文件中的现有签名图像来刷新设备(使用NXP制造工具,而不是快速启动)。但是,设备现在无法启动内核,给我一个DTB丢失的错误。

Hit any key to stop autoboot:  0 
boota mmc0 
kernel   @ 14008000 (8183104)
ramdisk  @ 15000000 (2036048)
## Booting Android Image at 0x12000000 ...
Kernel load addr 0x14008000 size 7992 KiB
Kernel command line: console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=128M androidboot.console=ttymxc0 consoleblank=0 ldo_active=on androidboot.hardware=sedevices cma=448M android.selinux=permissive android.dm_verify=disable androidboot.selinux=enforce androidboot.dm_verity=disable androidboot.storage_type=emmc loglevel=8 vt.global_cursor_default=0 buildvariant=userdebug androidboot.serialno=0b2861d4df668b47 androidboot.soc_type=imx6dl androidboot.storage_type=emmc
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
resetting ...

我已经将问题缩小到指南的第一步,其中“make dist”在构建目录中执行。这会在“out / dist”文件夹中生成许多ZIP文件,这些文件将在本指南的以下步骤中进一步处理。我尝试使用此步骤中生成的图像(在生成的“out / dist / * - img - * .zip”文件中找到)闪烁设备,这会产生完全相同的问题。

所以我的问题是,真正“make dist”会导致DTB在“boot.img”中丢失吗?我希望它能使用“out / target / product //”中已经运行的“boot.img”。但它反而似乎重新构建了这个图像,在这种情况下不包括DTB。与从Source构建Android的许多其他方面一样,“make dist”的工作似乎在文档中的任何地方都没有解释。

我希望任何有从源头构建Android的经验的人都知道这件事,因为我似乎被皇家卡住了。

仅供参考;当我闪现正常“make”后产生的“boot.img”时,U-boot后的输出如下:

Hit any key to stop autoboot:  0 
boota mmc0 
Error: blob decap job completed with errors 0x2000081A
In boota get fastboot lock status error. Set lock status
kernel   @ 14008000 (8183104)
ramdisk  @ 15000000 (2036754)
fdt      @ 14f00000 (40998)
## Booting Android Image at 0x12000000 ...
Kernel load addr 0x14008000 size 7992 KiB
Kernel command line: console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=128M androidboot.console=ttymxc0 consoleblank=0 ldo_active=on androidboot.hardware=sedevices cma=448M android.selinux=permissive android.dm_verify=disable androidboot.selinux=enforce androidboot.dm_verity=disable androidboot.storage_type=emmc loglevel=8 vt.global_cursor_default=0 buildvariant=userdebug androidboot.serialno=0b2861d4df668b47 androidboot.soc_type=imx6dl androidboot.storage_type=emmc
## Flattened Device Tree blob at 14f00000
   Booting using the fdt blob at 0x14f00000
   Loading Kernel Image ... OK
   Using Device Tree in place at 14f00000, end 14f0d025
switch to ldo_bypass mode!

Starting kernel ...
android kernel android-source device-tree
1个回答
0
投票

似乎恩智浦/飞思卡尔已经在他们的AOSP板支持包中修改了构建脚本,并在此过程中打破了DTB的包含。当标准“make”过程的输出在他们的开发板上工作时,看起来他们感到高兴,并且从不打扰检查是否可以用它创建工作签名的Release图像。

在dist包中包含DTB的机制已经到位(在BOARD_KERNEL_DTS中指定DTB的位置),并且还用于它们的“make otapackage”目标。但是,该目标仅生成未签名(或使用dev密钥签名)OTA包,该包不能与签名脚本一起使用。

为了使它能够正常工作,我不得不在主Makefile中做一个小的改动,它指定了BoardConfig.mk中定义的DTB的位置。这个变化很简单,但很难解决问题的位置以及最初的工作方式。

“build / make /”中的以下补丁修复了该问题,只要BoardConfig.mk仅指定一个DTB(至少符合我的需要):

diff --git a/core/Makefile b/core/Makefile
index a650565a1..92f3025a9 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -621,6 +621,19 @@ ifdef INTERNAL_KERNEL_CMDLINE
 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
 endif

+# NOTE! This script has a defect which cause the kernel DTB to be left out when ever 'make dist'
+#       is executed. The following addition "fixes" this by adding the first dtb specified in the 
+#       BoardConfig.mk file. (I would guess in most cases there is never more than one!)
+ifdef dist_goal
+ifndef BOARD_KERNEL_DTS
+ifdef TARGET_BOARD_DTS_CONFIG
+DTS_BOARD=$(word 2, $(subst :, ,$(word 1, $(TARGET_BOARD_DTS_CONFIG))))
+BOARD_KERNEL_DTS="$(KERNEL_OUT)/$(DTS_BOARD)"
+$(info FIXUP: Defining BOARD_KERNEL_DTS:=[$(BOARD_KERNEL_DTS)] for BOOT packaging)
+endif
+endif
+endif
+
 INTERNAL_MKBOOTIMG_VERSION_ARGS := \
     --os_version $(PLATFORM_VERSION) \
     --os_patch_level $(PLATFORM_SECURITY_PATCH)
© www.soinside.com 2019 - 2024. All rights reserved.