include/image*: add support for device-tree overlays

Add new target feature 'dt-overlay' which makes DTC keep the symbol
names in the generated dtb.
Make sure additional DT overlay sources specified by the new device
variable DEVICE_DTS_OVERLAY get compiled together with the main DTS
(currently overlays got to be in the same folder). Let Build/fit pass
the generated DT overlay blobs to mkits.sh.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2021-03-17 17:30:48 +00:00
parent 4e6de4f093
commit 6890f6fe13
4 changed files with 13 additions and 4 deletions

View File

@ -207,13 +207,16 @@ endef
define Build/fit define Build/fit
$(TOPDIR)/scripts/mkits.sh \ $(TOPDIR)/scripts/mkits.sh \
-D $(DEVICE_NAME) -o $@.its -k $@ \ -D $(DEVICE_NAME) -o $@.its -k $@ \
$(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ -C $(word 1,$(1)) $(if $(word 2,$(1)),\
$(if $(DEVICE_DTS_OVERLAY),-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))),\
-d $(word 2,$(1)))) \
$(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ $(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \
$(if $(findstring with-initrd,$(word 3,$(1))), \ $(if $(findstring with-initrd,$(word 3,$(1))), \
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \
-i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \ -i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION) -A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\

View File

@ -190,6 +190,7 @@ define Image/BuildDTB
-o $(2).tmp $(1) -o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \ $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(DTC_FLAGS) $(4) \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
-o $(2) $(2).tmp -o $(2) $(2).tmp
$(RM) $(2).tmp $(RM) $(2).tmp
endef endef
@ -393,6 +394,7 @@ define Device/Init
DEVICE_DTS := DEVICE_DTS :=
DEVICE_DTS_CONFIG := DEVICE_DTS_CONFIG :=
DEVICE_DTS_DIR := DEVICE_DTS_DIR :=
DEVICE_DTS_OVERLAY :=
DEVICE_FDT_NUM := DEVICE_FDT_NUM :=
SOC := SOC :=
@ -416,8 +418,8 @@ DEFAULT_DEVICE_VARS := \
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_FDT_NUM SOC BOARD_NAME \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \
UIMAGE_MAGIC UIMAGE_NAME \ SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \ UBOOT_PATH IMAGE_SIZE \
DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
@ -539,7 +541,7 @@ endef
endif endif
define Device/Build/kernel define Device/Build/kernel
$$(eval $$(foreach dts,$$(DEVICE_DTS), \ $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dts) \ $$(dts) \

View File

@ -45,6 +45,7 @@ sub target_config_features(@) {
/^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n"; /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n";
/^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n";
/^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n"; /^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n";
/^dt-overlay$/ and $ret .= "\tselect HAS_DT_OVERLAY_SUPPORT\n";
} }
return $ret; return $ret;
} }

View File

@ -13,6 +13,9 @@ config HAS_SPE_FPU
config HAS_FPU config HAS_FPU
bool bool
config HAS_DT_OVERLAY_SUPPORT
bool
config AUDIO_SUPPORT config AUDIO_SUPPORT
bool bool