kbuild: cherry-pick kbuild fdtoverlay changes from linux
Linux commits: 15d16d6dadf6 kbuild: Add generic rule to apply fdtoverlay 44f87191d105 kbuild: parameterize the .o part of suffix-search The Linux commit 15d16d6dadf6 adds a generic rule in Makefile.lib to automatically apply fdtoverlay, so that each platform doesn't need to include a complex rule. This also automatically appends DTC_FLAGS_foo_base += -@ to all base files The platform's Makefile only needs to have this now: foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo dtb-y := foo.dtb Signed-off-by: Prasad Kummari <prasad.kummari@amd.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20240906070808.1045991-2-prasad.kummari@amd.com
This commit is contained in:
committed by
Michal Simek
parent
a268b53be0
commit
10de9b5a6a
@@ -47,6 +47,13 @@ obj-m := $(filter-out %/, $(obj-m))
|
||||
|
||||
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
||||
|
||||
# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
|
||||
suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
|
||||
# List composite targets that are constructed by combining other targets
|
||||
multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $m)))
|
||||
# List primitive targets that are compiled from source files
|
||||
real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $(call suffix-search, $m, $2, $3), $m))
|
||||
|
||||
# if $(foo-objs) exists, foo.o is a composite object
|
||||
multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
||||
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
||||
@@ -58,6 +65,13 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
|
||||
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
|
||||
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
|
||||
|
||||
# Composite DTB (i.e. DTB constructed by overlay)
|
||||
multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
|
||||
# Primitive DTB compiled from *.dts
|
||||
real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
|
||||
# Base DTB that overlay is applied onto (each first word of $(*-dtbs) expansion)
|
||||
base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m, .dtb, -dtbs)))
|
||||
|
||||
# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
|
||||
# tell kbuild to descend
|
||||
subdir-obj-y := $(filter %/built-in.o, $(obj-y))
|
||||
@@ -69,6 +83,7 @@ real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)
|
||||
# Add subdir path
|
||||
|
||||
extra-y := $(addprefix $(obj)/,$(extra-y))
|
||||
always-y := $(addprefix $(obj)/,$(always-y))
|
||||
always := $(addprefix $(obj)/,$(always))
|
||||
targets := $(addprefix $(obj)/,$(targets))
|
||||
modorder := $(addprefix $(obj)/,$(modorder))
|
||||
@@ -83,6 +98,8 @@ multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
|
||||
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
|
||||
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
|
||||
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
|
||||
multi-dtb-y := $(addprefix $(obj)/,$(multi-dtb-y))
|
||||
real-dtb-y := $(addprefix $(obj)/,$(real-dtb-y))
|
||||
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
||||
|
||||
# These flags are needed for modversions and compiling, so we define them here
|
||||
@@ -301,6 +318,9 @@ endif
|
||||
|
||||
DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
|
||||
|
||||
# Set -@ if the target is a base DTB that overlay is applied onto
|
||||
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
|
||||
|
||||
# Generate an assembly file to wrap the output of the device tree compiler
|
||||
quiet_cmd_dt_S_dtb= DTBS $@
|
||||
# Modified for U-Boot
|
||||
@@ -422,6 +442,13 @@ cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
|
||||
$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
|
||||
$(call if_changed_dep,dtco)
|
||||
|
||||
quiet_cmd_fdtoverlay = DTOVL $@
|
||||
cmd_fdtoverlay = fdtoverlay -o $@ -i $(real-prereqs)
|
||||
|
||||
$(multi-dtb-y): FORCE
|
||||
$(call if_changed,fdtoverlay)
|
||||
$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
|
||||
|
||||
# Fonts
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user