Support vendor bootconfig creation

Gather all BOARD_BOOTCONFIG parameters.
Create vendor-bootconfig.img with parameters seperated by newlines. Pass
that file to mkbootimg as --vendor_bootconfig to add it to the
vendor_boot.img.

Test: Add BOARD_BOOTCONFIG parameters in cuttlefish .mk file
      Check vendor-bootconfig.img for expected output
      Verify expected vendor_boot.img format with:
      unpack_bootimg --boot_image vendor_boot.img
Test: Update Cuttlefish bootloader to handle the new vendor_boot.img and
      check /proc/bootconfig for the expexted parameters.
Bug: 173815685
Change-Id: Iaa9b71b4bc64375777a5353396e83bb2beb25c47
This commit is contained in:
Devin Moore 2021-01-13 10:45:04 -08:00
parent 157e6a06e4
commit 50509015bf
3 changed files with 20 additions and 1 deletions

View File

@ -1014,6 +1014,15 @@ ifdef INTERNAL_KERNEL_CMDLINE
INTERNAL_VENDOR_BOOTIMAGE_ARGS += --vendor_cmdline "$(INTERNAL_KERNEL_CMDLINE)"
endif
ifdef INTERNAL_BOOTCONFIG
INTERNAL_VENDOR_BOOTCONFIG_TARGET := $(PRODUCT_OUT)/vendor-bootconfig.img
$(INTERNAL_VENDOR_BOOTCONFIG_TARGET):
rm -f $@
$(foreach param,$(INTERNAL_BOOTCONFIG), \
printf "%s\n" $(param) >> $@;)
INTERNAL_VENDOR_BOOTIMAGE_ARGS += --vendor_bootconfig $(INTERNAL_VENDOR_BOOTCONFIG_TARGET)
endif
# $(1): Build target name
# $(2): Staging dir to be compressed
# $(3): Build dependencies
@ -1061,7 +1070,7 @@ $(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
INSTALLED_VENDOR_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot.img
$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DTBIMAGE_TARGET)
$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRAGMENT_TARGETS)
$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRAGMENT_TARGETS) $(INTERNAL_VENDOR_BOOTCONFIG_TARGET)
ifeq ($(BOARD_AVB_ENABLE),true)
$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KEY_PATH)
$(call pretty,"Target vendor_boot image: $@")
@ -4793,6 +4802,9 @@ ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifdef INSTALLED_DTBIMAGE_TARGET
cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/VENDOR_BOOT/dtb
endif
ifdef INTERNAL_VENDOR_BOOTCONFIG_TARGET
cp $(INTERNAL_VENDOR_BOOTCONFIG_TARGET) $(zip_root)/VENDOR_BOOT/vendor_bootconfig
endif
ifdef BOARD_KERNEL_BASE
echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/VENDOR_BOOT/base
endif

View File

@ -25,6 +25,7 @@ _board_strip_readonly_list += BOARD_EGL_CFG
_board_strip_readonly_list += BOARD_HAVE_BLUETOOTH
_board_strip_readonly_list += BOARD_INSTALLER_CMDLINE
_board_strip_readonly_list += BOARD_KERNEL_CMDLINE
_board_strip_readonly_list += BOARD_BOOTCONFIG
_board_strip_readonly_list += BOARD_KERNEL_BASE
_board_strip_readonly_list += BOARD_USES_GENERIC_AUDIO
_board_strip_readonly_list += BOARD_USES_RECOVERY_AS_BOOT
@ -222,6 +223,7 @@ endif
.KATI_READONLY := $(_board_strip_readonly_list)
INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG)
ifneq ($(filter %64,$(TARGET_ARCH)),)
TARGET_IS_64_BIT := true

View File

@ -1691,6 +1691,11 @@ def _BuildVendorBootImage(sourcedir, info_dict=None):
cmd.extend(["--vendor_ramdisk", ramdisk_img.name])
cmd.extend(["--vendor_boot", img.name])
fn = os.path.join(sourcedir, "vendor_bootconfig")
if os.access(fn, os.F_OK):
cmd.append("--vendor_bootconfig")
cmd.append(fn)
ramdisk_fragment_imgs = []
fn = os.path.join(sourcedir, "vendor_ramdisk_fragments")
if os.access(fn, os.F_OK):