kbuild: refactor DTB build rules, introduce a generic built-in boot DTB support
Subsystems (16)
cover kbuild: refactor DTB build rules, introduce a generic built-in boot DTB support
01 and 02 are kbuild cleanups.
03 and 04 parepare to wrap boot DTBs in scripts/Makefile.vmlinux.
My plan is to 05-13 to each arch ML in the next cycle, but they are included in this patch set so that reviewers can understand what will happen in the future.
Masahiro Yamada (15):
kbuild: add intermediate targets for Flex/Bison in
scripts/Makefile.host
kbuild: split device tree build rules into scripts/Makefile.dtbs
kbuild: move non-boot builtin DTBs to .init.rodata section
kbuild: add generic support for built-in boot DTBs
MIPS: migrate to generic rule for built-in DTBs
riscv: migrate to the generic rule for built-in DTB
LoongArch: migrate to the generic rule for built-in DTB
ARC: migrate to the generic rule for built-in DTB
openrisc: migrate to the generic rule for built-in DTB
xtensa: migrate to the generic rule for built-in DTB
nios2: migrate to the generic rule for built-in DTB
sh: migrate to the generic rule for built-in DTB
microblaze: migrate to the generic rule for built-in DTB
kbuild: rename CONFIG_GENERIC_BUILTIN_DTB to CONFIG_BUILTIN_DTB
kbuild: use .init.rodata section unconditionally for cmd_wrap_S_dtb
Makefile | 7 +- arch/arc/Kconfig | 7 +- arch/arc/Makefile | 3 - arch/arc/boot/dts/Makefile | 9 +- arch/arc/configs/axs101_defconfig | 2 +- arch/arc/configs/axs103_defconfig | 2 +- arch/arc/configs/axs103_smp_defconfig | 2 +- arch/arc/configs/haps_hs_defconfig | 2 +- arch/arc/configs/haps_hs_smp_defconfig | 2 +- arch/arc/configs/hsdk_defconfig | 2 +- arch/arc/configs/nsim_700_defconfig | 2 +- arch/arc/configs/nsimosci_defconfig | 2 +- arch/arc/configs/nsimosci_hs_defconfig | 2 +- arch/arc/configs/nsimosci_hs_smp_defconfig | 2 +- arch/arc/configs/tb10x_defconfig | 2 +- arch/arc/configs/vdk_hs38_defconfig | 2 +- arch/arc/configs/vdk_hs38_smp_defconfig | 2 +- arch/loongarch/Kbuild | 1 - arch/loongarch/boot/dts/Makefile | 2 - arch/microblaze/Kbuild | 1 - arch/microblaze/Kconfig | 5 + arch/microblaze/boot/dts/Makefile | 5 - arch/microblaze/boot/dts/linked_dtb.S | 2 - arch/microblaze/kernel/vmlinux.lds.S | 2 +- arch/mips/Kconfig | 1 + arch/mips/Makefile | 3 - arch/mips/boot/dts/Makefile | 2 - arch/mips/boot/dts/brcm/Makefile | 2 - arch/mips/boot/dts/cavium-octeon/Makefile | 2 - arch/mips/boot/dts/ingenic/Makefile | 2 - arch/mips/boot/dts/lantiq/Makefile | 2 - arch/mips/boot/dts/loongson/Makefile | 2 - arch/mips/boot/dts/mscc/Makefile | 3 - arch/mips/boot/dts/mti/Makefile | 2 - arch/mips/boot/dts/pic32/Makefile | 2 - arch/mips/boot/dts/ralink/Makefile | 2 - arch/nios2/Kbuild | 2 +- arch/nios2/boot/dts/Makefile | 4 +- arch/nios2/kernel/prom.c | 2 +- arch/nios2/platform/Kconfig.platform | 10 +- arch/openrisc/Kbuild | 1 - arch/openrisc/Kconfig | 3 +- arch/openrisc/boot/dts/Makefile | 2 +- arch/openrisc/configs/or1klitex_defconfig | 2 +- arch/openrisc/configs/or1ksim_defconfig | 2 +- arch/openrisc/configs/simple_smp_defconfig | 2 +- arch/riscv/Kbuild | 1 - arch/riscv/Kconfig | 2 +- arch/riscv/boot/dts/Makefile | 2 - arch/riscv/configs/nommu_k210_defconfig | 2 +- .../riscv/configs/nommu_k210_sdcard_defconfig | 2 +- arch/sh/Kbuild | 1 - arch/sh/Kconfig | 6 +- arch/sh/boot/dts/Makefile | 2 +- arch/sh/kernel/setup.c | 4 +- arch/xtensa/Kbuild | 2 +- arch/xtensa/Kconfig | 3 +- arch/xtensa/boot/dts/Makefile | 2 +- arch/xtensa/configs/audio_kc705_defconfig | 2 +- arch/xtensa/configs/cadence_csp_defconfig | 2 +- arch/xtensa/configs/generic_kc705_defconfig | 2 +- arch/xtensa/configs/nommu_kc705_defconfig | 2 +- arch/xtensa/configs/smp_lx200_defconfig | 2 +- arch/xtensa/configs/virt_defconfig | 2 +- arch/xtensa/configs/xip_kc705_defconfig | 2 +- drivers/of/Kconfig | 6 + drivers/of/fdt.c | 2 +- drivers/of/unittest.c | 6 +- scripts/Makefile.build | 58 +++---- scripts/Makefile.dtbs | 142 ++++++++++++++++++ scripts/Makefile.host | 5 + scripts/Makefile.lib | 115 -------------- scripts/Makefile.vmlinux | 44 ++++++ scripts/link-vmlinux.sh | 4 + 74 files changed, 294 insertions(+), 256 deletions(-) delete mode 100644 arch/microblaze/boot/dts/linked_dtb.S create mode 100644 scripts/Makefile.dtbs
Signature · 1 line
2.43.0
PATCH 1/15 kbuild: add intermediate targets for Flex/Bison in scripts/Makefile.host
Flex and Bison are used only for host programs. Move their intermediate target processing from scripts/Makefile.build to scripts/Makefile.host.
---
scripts/Makefile.build | 35 ++++++++++++++++------------------- scripts/Makefile.host | 5 +++++ 2 files changed, 21 insertions(+), 19 deletions(-)
scripts/Makefile.build +16 -19
@@ -41,20 +41,6 @@ include $(srctree)/scripts/Makefile.compiler include $(kbuild-file) include $(srctree)/scripts/Makefile.lib -# Do not include hostprogs rules unless needed. -# $(sort ...) is used here to remove duplicated words and excessive spaces. -hostprogs := $(sort $(hostprogs)) -ifneq ($(hostprogs),) -include $(srctree)/scripts/Makefile.host -endif - -# Do not include userprogs rules unless needed. -# $(sort ...) is used here to remove duplicated words and excessive spaces. -userprogs := $(sort $(userprogs)) -ifneq ($(userprogs),) -include $(srctree)/scripts/Makefile.userprogs -endif - ifndef obj $(warning kbuild: Makefile.build is included improperly) endif
@@ -452,13 +438,24 @@ intermediate_targets = $(foreach sfx, $(2), \ # %.asn1.o <- %.asn1.[ch] <- %.asn1 # %.dtb.o <- %.dtb.S <- %.dtb <- %.dts # %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso -# %.lex.o <- %.lex.c <- %.l -# %.tab.o <- %.tab.[ch] <- %.y targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \ - $(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo) \ - $(call intermediate_targets, .lex.o, .lex.c) \ - $(call intermediate_targets, .tab.o, .tab.c .tab.h) + $(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo) + +# Include additional build rules when necessary +# --------------------------------------------------------------------------- + +# $(sort ...) is used here to remove duplicated words and excessive spaces. +hostprogs := $(sort $(hostprogs)) +ifneq ($(hostprogs),) +include $(srctree)/scripts/Makefile.host +endif + +# $(sort ...) is used here to remove duplicated words and excessive spaces. +userprogs := $(sort $(userprogs)) +ifneq ($(userprogs),) +include $(srctree)/scripts/Makefile.userprogs +endif # Build # ---------------------------------------------------------------------------
scripts/Makefile.host +5 -0
@@ -160,3 +160,8 @@ $(host-rust): $(obj)/%: $(src)/%.rs FORCE targets += $(host-csingle) $(host-cmulti) $(host-cobjs) \ $(host-cxxmulti) $(host-cxxobjs) $(host-rust) + +# %.lex.o <- %.lex.c <- %.l +# %.tab.o <- %.tab.[ch] <- %.y +targets += $(call intermediate_targets, .lex.o, .lex.c) \ + $(call intermediate_targets, .tab.o, .tab.c .tab.h)
Signature · 1 line
2.43.0
PATCH 2/15 kbuild: split device tree build rules into scripts/Makefile.dtbs
In reply to Masahiro Yamadascripts/Makefile.lib is included not only from scripts/Makefile.build but also from scripts/Makefile.{modfinal,package,vmlinux,vmlinux_o}, where DT build rules are not required.
Split the DT build rules out to scripts/Makefile.dtbs, and include it only when necessary.
---
drivers/of/fdt.c | 2 +- drivers/of/unittest.c | 4 +- scripts/Makefile.build | 25 +++----- scripts/Makefile.dtbs | 142 +++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.lib | 115 --------------------------------- 5 files changed, 153 insertions(+), 135 deletions(-) create mode 100644 scripts/Makefile.dtbs
drivers/of/fdt.c +1 -1
@@ -34,7 +34,7 @@/* * __dtb_empty_root_begin[] and __dtb_empty_root_end[] magically created by -* cmd_dt_S_dtb in scripts/Makefile.lib +* cmd_wrap_S_dtb in scripts/Makefile.dtbs */ extern uint8_t __dtb_empty_root_begin[];extern uint8_t __dtb_empty_root_end[];
drivers/of/unittest.c +2 -2
@@ -1861,7 +1861,7 @@ static int __init unittest_data_add(void)struct device_node *unittest_data_node =NULL , *np;/* * __dtbo_testcases_begin[] and __dtbo_testcases_end[] are magically -* created by cmd_dt_S_dtbo in scripts/Makefile.lib +* created by cmd_wrap_S_dtbo in scripts/Makefile.dtbs */ extern uint8_t __dtbo_testcases_begin[];extern uint8_t __dtbo_testcases_end[];
@@ -3525,7 +3525,7 @@ static void __init of_unittest_lifecycle(void)/* * __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are -* created by cmd_dt_S_dtbo in scripts/Makefile.lib +* created by cmd_wrap_S_dtbo in scripts/Makefile.dtbs */ #define OVERLAY_INFO_EXTERN (overlay_name) \
scripts/Makefile.build +8 -17
@@ -57,7 +57,6 @@ endif # subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...) subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y))) subdir-modorder := $(sort $(filter %/modules.order, $(obj-m))) -subdir-dtbslist := $(sort $(filter %/dtbs-list, $(dtb-y))) targets-for-builtin := $(extra-y)
@@ -349,7 +348,7 @@ $(obj)/%.o: $(obj)/%.S FORCE targets += $(filter-out $(subdir-builtin), $(real-obj-y)) targets += $(filter-out $(subdir-modorder), $(real-obj-m)) -targets += $(real-dtb-y) $(lib-y) $(always-y) +targets += $(lib-y) $(always-y) # Linker scripts preprocessor (.lds.S -> .lds) # ---------------------------------------------------------------------------
@@ -375,7 +374,6 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # To build objects in subdirs, we need to descend into the directories $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ; $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ; -$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ; # # Rule to compile a set of .o files into one .a file (without symbol table)
@@ -391,12 +389,8 @@ quiet_cmd_ar_builtin = AR $@ $(obj)/built-in.a: $(real-obj-y) FORCE $(call if_changed,ar_builtin) -# -# Rule to create modules.order and dtbs-list -# -# This is a list of build artifacts (module or dtb) from the current Makefile -# and its sub-directories. The timestamp should be updated when any of the -# member files. +# This is a list of build artifacts from the current Makefile and its +# sub-directories. The timestamp should be updated when any of the member files. cmd_gen_order = { $(foreach m, $(real-prereqs), \ $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
@@ -405,9 +399,6 @@ cmd_gen_order = { $(foreach m, $(real-prereqs), \ $(obj)/modules.order: $(obj-m) FORCE $(call if_changed,gen_order) -$(obj)/dtbs-list: $(dtb-y) FORCE - $(call if_changed,gen_order) - # # Rule to compile a set of .o files into one .a file (with symbol table) #
@@ -436,11 +427,7 @@ intermediate_targets = $(foreach sfx, $(2), \ $(patsubst %$(strip $(1)),%$(sfx), \ $(filter %$(strip $(1)), $(targets)))) # %.asn1.o <- %.asn1.[ch] <- %.asn1 -# %.dtb.o <- %.dtb.S <- %.dtb <- %.dts -# %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso -targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ - $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \ - $(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo) +targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) # Include additional build rules when necessary # ---------------------------------------------------------------------------
@@ -457,6 +444,10 @@ ifneq ($(userprogs),) include $(srctree)/scripts/Makefile.userprogs endif +ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb.o %.dtbo.o,$(targets)),) +include $(srctree)/scripts/Makefile.dtbs +endif + # Build # ---------------------------------------------------------------------------
scripts/Makefile.dtbs new file +142 -0
142 lines not on this page · raw message
scripts/Makefile.lib +0 -115
145 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 3/15 kbuild: move non-boot builtin DTBs to .init.rodata section
In reply to Masahiro YamadaSome architectures support embedding boot DTB(s) in vmlinux. These architectures, except MIPS and MicroBlaze, expect a single DTB in the .dtb.init.rodata section. MIPS embeds multiple DTBs in vmlinux. MicroBlaze embeds a DTB in its own __fdt_blob section instead of the .dtb.init.rodata section.
For example, RISC-V previously allowed embedding multiple DTBs, but only the first DTB in the .dtb.init.rodata section was used. Commit 2672031b20f6 ("riscv: dts: Move BUILTIN_DTB_SOURCE to common Kconfig") ensured only one boot DTB is embedded.
Meanwhile, commit 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware") introduced another DTB into the .dtb.init.rodata section.
The symbol dump (sorted by address) for ARCH=riscv nommu_k210_defconfig is now as follows:
00000000801290e0 D __dtb_start
00000000801290e0 D __dtb_k210_generic_begin
000000008012b571 D __dtb_k210_generic_end
000000008012b580 D __dtb_empty_root_begin
000000008012b5c8 D __dtb_empty_root_end
000000008012b5e0 D __dtb_endThe .dtb.init.rodata section contains the following two DTB files:
arch/riscv/boot/dts/canaan/k210_generic.dtb
drivers/of/empty_root.dtb
This is not an immediate problem because the boot code chooses the first DTB, k210_generic.dtb. The second one, empty_root.dtb is ignored. However, relying on the link order (i.e., the order in Makefiles) is fragile.
Only the boot DTB should be placed in the .dtb.init.rodata because the arch boot code generally does not know the DT name, thus it uses the __dtb_start symbol to find it.
empty_root.dtb is looked up by name, so it can be moved to the generic .init.rodata section.
When CONFIG_OF_UNITTEST is enabled, more unittest DTBOs are embedded in the .dtb.init.rodata section. These are also looked up by name, so can be moved to the .init.rodata section.
I added the __initdata annotation to the overlay_info data array because modpost knows the .init.rodata section is discarded, and would otherwise warn about it.
The implementation is kind of cheesy; the section is .dtb.init.rodata under the arch/ directory, and .init.rodata section otherwise. This will be refactored later.
---
drivers/of/unittest.c | 2 +- scripts/Makefile.dtbs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/of/unittest.c +1 -1
@@ -3585,7 +3585,7 @@ OVERLAY_INFO_EXTERN(overlay_bad_symbol);OVERLAY_INFO_EXTERN (overlay_bad_unresolved);/* entries found by name */ -static struct overlay_info overlays[] = { +static __initdata struct overlay_info overlays[] = {OVERLAY_INFO (overlay_base,-9999 ,0 ),OVERLAY_INFO (overlay,0 ,0 ),OVERLAY_INFO (overlay_0,0 ,0 ),
scripts/Makefile.dtbs +3 -1
@@ -34,12 +34,14 @@ $(obj)/dtbs-list: $(dtb-y) FORCE # Assembly file to wrap dtb(o) # --------------------------------------------------------------------------- +builtin-dtb-section = $(if $(filter arch/%, $(obj)),.dtb.init.rodata,.init.rodata) + # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_wrap_S_dtb = WRAP $@ cmd_wrap_S_dtb = { \ symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*)); \ echo '\#include <asm-generic/vmlinux.lds.h>'; \ - echo '.section .dtb.init.rodata,"a"'; \ + echo '.section $(builtin-dtb-section),"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ echo ".global $${symbase}_begin"; \ echo "$${symbase}_begin:"; \
Signature · 1 line
2.43.0
PATCH 4/15 kbuild: add generic support for built-in boot DTBs
In reply to Masahiro YamadaSome architectures embed boot DTBs in vmlinux. A potential issue for these architectures is a race condition during parallel builds because Kbuild descends into arch/*/boot/dts/ twice.
One build thread is initiated by the 'dtbs' target, which is a prerequisite of the 'all' target in the top-level Makefile:
ifdef CONFIG_OF_EARLY_FLATTREE
all: dtbs
endif
For architectures that support the embedded boot dtb, arch/*/boot/dts/ is visited also during the ordinary directory traversal in order to build obj-y objects that wrap DTBs.
Since these build threads are unaware of each other, they can run simultaneously during parallel builds.
This commit introduces a generic build rule to scripts/Makefile.vmlinux to support embedded boot DTBs in a race-free way. Architectures that want to use this rule need to select CONFIG_GENERIC_BUILTIN_DTB.
After the migration, Makefiles under arch/*/boot/dts/ will be visited only once to build only *.dtb files.
This change also aims to unify the CONFIG options used for embedded DTBs support. Currently, different architectures use different CONFIG options for the same purposes.
The CONFIG options are unified as follows:
- CONFIG_GENERIC_BUILTIN_DTB
This enables the generic rule for embedded boot DTBs. This will be renamed to CONFIG_BUILTIN_DTB after all architectures migrate to the generic rule.
- CONFIG_BUILTIN_DTB_NAME
This specifies the path to the embedded DTB.
(relative to arch/*/boot/dts/)
- CONFIG_BUILTIN_DTB_ALL
If this is enabled, all DTB files compiled under arch/*/boot/dts/ are embedded into vmlinux. Only used by MIPS.
---
Makefile | 7 ++++++- drivers/of/Kconfig | 6 ++++++ scripts/Makefile.vmlinux | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/link-vmlinux.sh | 4 ++++ 4 files changed, 60 insertions(+), 1 deletion(-)
Makefile +6 -1
@@ -1417,6 +1417,10 @@ ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs endif +ifdef CONFIG_GENERIC_BUILTIN_DTB +vmlinux: dtbs +endif + endif PHONY += scripts_dtc
@@ -1483,7 +1487,8 @@ endif # CONFIG_MODULES CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ compile_commands.json rust/test \ - rust-project.json .vmlinux.objs .vmlinux.export.c + rust-project.json .vmlinux.objs .vmlinux.export.c \ + .builtin-dtbs-list .builtin-dtb.S # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \
drivers/of/Kconfig +6 -0
@@ -2,6 +2,12 @@ config DTC bool +config GENERIC_BUILTIN_DTB + bool + +config BUILTIN_DTB_ALL + bool + menuconfig OF bool "Device Tree and Open Firmware support" help
scripts/Makefile.vmlinux +44 -0
50 lines not on this page · raw message
scripts/link-vmlinux.sh +4 -0
@@ -68,6 +68,10 @@ vmlinux_link() libs="${KBUILD_VMLINUX_LIBS}" fi + if is_enabled CONFIG_GENERIC_BUILTIN_DTB; then + objs="${objs} .builtin-dtbs.o" + fi + if is_enabled CONFIG_MODULES; then objs="${objs} .vmlinux.export.o" fi
Signature · 1 line
2.43.0
PATCH 5/15 MIPS: migrate to generic rule for built-in DTBs
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB and BUILTIN_DTB_ALL when built-in DTB support is enabled.
DTBs compiled under arch/mips/boot/dts/ will be wrapped and compiled in scripts/Makefile.vmlinux.
---
arch/mips/Kconfig | 2 ++ arch/mips/Makefile | 3 --- arch/mips/boot/dts/Makefile | 2 -- arch/mips/boot/dts/brcm/Makefile | 2 -- arch/mips/boot/dts/cavium-octeon/Makefile | 2 -- arch/mips/boot/dts/ingenic/Makefile | 2 -- arch/mips/boot/dts/lantiq/Makefile | 2 -- arch/mips/boot/dts/loongson/Makefile | 2 -- arch/mips/boot/dts/mscc/Makefile | 3 --- arch/mips/boot/dts/mti/Makefile | 2 -- arch/mips/boot/dts/pic32/Makefile | 2 -- arch/mips/boot/dts/ralink/Makefile | 2 -- 12 files changed, 2 insertions(+), 24 deletions(-)
arch/mips/Kconfig +2 -0
@@ -28,10 +28,12 @@ config MIPS select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_LD_ORPHAN_WARN select BUILDTIME_TABLE_SORT + select BUILTIN_DTB_ALL if BUILTIN_DTB select CLONE_BACKWARDS select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1) select CPU_PM if CPU_IDLE || SUSPEND select GENERIC_ATOMIC64 if !64BIT + select GENERIC_BUILTIN_DTB if BUILTIN_DTB select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE select GENERIC_GETTIMEOFDAY
arch/mips/Makefile +0 -3
@@ -423,9 +423,6 @@ endif CLEAN_FILES += vmlinux.32 vmlinux.64 -# device-trees -core-y += arch/mips/boot/dts/ - archprepare: ifdef CONFIG_MIPS32_N32 @$(kecho) ' Checking missing-syscalls for N32'
arch/mips/boot/dts/Makefile +0 -2
@@ -16,5 +16,3 @@ subdir-$(CONFIG_ATH79) += qca subdir-$(CONFIG_RALINK) += ralink subdir-$(CONFIG_MACH_REALTEK_RTL) += realtek subdir-$(CONFIG_FIT_IMAGE_FDT_XILFPGA) += xilfpga - -obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
arch/mips/boot/dts/brcm/Makefile +0 -2
@@ -33,5 +33,3 @@ dtb-$(CONFIG_DT_NONE) += \ bcm97420c.dtb \ bcm97425svmb.dtb \ bcm97435svmb.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/cavium-octeon/Makefile +0 -2
@@ -1,4 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_CAVIUM_OCTEON_SOC) += octeon_3xxx.dtb octeon_68xx.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/ingenic/Makefile +0 -2
@@ -5,5 +5,3 @@ dtb-$(CONFIG_JZ4770_GCW0) += gcw0.dtb dtb-$(CONFIG_JZ4780_CI20) += ci20.dtb dtb-$(CONFIG_X1000_CU1000_NEO) += cu1000-neo.dtb dtb-$(CONFIG_X1830_CU1830_NEO) += cu1830-neo.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/lantiq/Makefile +0 -2
@@ -1,4 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_DT_EASY50712) += danube_easy50712.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/loongson/Makefile +0 -2
@@ -5,5 +5,3 @@ dtb-$(CONFIG_MACH_LOONGSON64) += loongson64c_4core_rs780e.dtb dtb-$(CONFIG_MACH_LOONGSON64) += loongson64c_8core_rs780e.dtb dtb-$(CONFIG_MACH_LOONGSON64) += loongson64g_4core_ls7a.dtb dtb-$(CONFIG_MACH_LOONGSON64) += loongson64v_4core_virtio.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/mscc/Makefile +0 -3
@@ -8,6 +8,3 @@ dtb-$(CONFIG_SOC_VCOREIII) += \ ocelot_pcb123.dtb \ serval_pcb105.dtb \ serval_pcb106.dtb - - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/mti/Makefile +0 -2
@@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_MIPS_MALTA) += malta.dtb dtb-$(CONFIG_LEGACY_BOARD_SEAD3) += sead3.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/pic32/Makefile +0 -2
@@ -3,5 +3,3 @@ dtb-$(CONFIG_DTB_PIC32_MZDA_SK) += pic32mzda_sk.dtb dtb-$(CONFIG_DTB_PIC32_NONE) += \ pic32mzda_sk.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/mips/boot/dts/ralink/Makefile +0 -2
@@ -10,5 +10,3 @@ dtb-$(CONFIG_SOC_MT7621) += \ mt7621-gnubee-gb-pc1.dtb \ mt7621-gnubee-gb-pc2.dtb \ mt7621-tplink-hc220-g5-v1.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
Signature · 1 line
2.43.0
PATCH 6/15 riscv: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB when built-in DTB support is enabled.
To keep consistency across architectures, this commit also renames CONFIG_BUILTIN_DTB_SOURCE to CONFIG_BUILTIN_DTB_NAME.
---
arch/riscv/Kbuild | 1 - arch/riscv/Kconfig | 3 ++- arch/riscv/boot/dts/Makefile | 2 -- arch/riscv/configs/nommu_k210_defconfig | 2 +- arch/riscv/configs/nommu_k210_sdcard_defconfig | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-)
arch/riscv/Kbuild +0 -1
@@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y += kernel/ mm/ net/ -obj-$(CONFIG_BUILTIN_DTB) += boot/dts/ obj-$(CONFIG_CRYPTO) += crypto/ obj-y += errata/ obj-$(CONFIG_KVM) += kvm/
arch/riscv/Kconfig +2 -1
@@ -1110,13 +1110,14 @@ config RISCV_ISA_FALLBACK config BUILTIN_DTB bool "Built-in device tree" depends on OF && NONPORTABLE + select GENERIC_BUILTIN_DTB help Build a device tree into the Linux image. This option should be selected if no bootloader is being used. If unsure, say N. -config BUILTIN_DTB_SOURCE +config BUILTIN_DTB_NAME string "Built-in device tree source" depends on BUILTIN_DTB help
arch/riscv/boot/dts/Makefile +0 -2
@@ -7,5 +7,3 @@ subdir-y += sifive subdir-y += sophgo subdir-y += starfive subdir-y += thead - -obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
arch/riscv/configs/nommu_k210_defconfig +1 -1
@@ -35,7 +35,7 @@ CONFIG_NR_CPUS=2 CONFIG_CMDLINE="earlycon console=ttySIF0" CONFIG_CMDLINE_FORCE=y CONFIG_BUILTIN_DTB=y -CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic" +CONFIG_BUILTIN_DTB_NAME="canaan/k210_generic" # CONFIG_SECCOMP is not set # CONFIG_STACKPROTECTOR is not set # CONFIG_GCC_PLUGINS is not set
arch/riscv/configs/nommu_k210_sdcard_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_NR_CPUS=2 CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro" CONFIG_CMDLINE_FORCE=y CONFIG_BUILTIN_DTB=y -CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic" +CONFIG_BUILTIN_DTB_NAME="canaan/k210_generic" # CONFIG_SECCOMP is not set # CONFIG_STACKPROTECTOR is not set # CONFIG_GCC_PLUGINS is not set
Signature · 1 line
2.43.0
PATCH 7/15 LoongArch: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB when built-in DTB support is enabled.
---
arch/loongarch/Kbuild | 1 - arch/loongarch/Kconfig | 1 + arch/loongarch/boot/dts/Makefile | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-)
arch/loongarch/Kbuild +0 -1
@@ -4,7 +4,6 @@ obj-y += net/ obj-y += vdso/ obj-$(CONFIG_KVM) += kvm/ -obj-$(CONFIG_BUILTIN_DTB) += boot/dts/ # for cleaning subdir- += boot
arch/loongarch/Kconfig +1 -0
@@ -388,6 +388,7 @@ endchoice config BUILTIN_DTB bool "Enable built-in dtb in kernel" depends on OF + select GENERIC_BUILTIN_DTB help Some existing systems do not provide a canonical device tree to the kernel at boot time. Let's provide a device tree table in the
arch/loongarch/boot/dts/Makefile +0 -2
@@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only dtb-y = loongson-2k0500-ref.dtb loongson-2k1000-ref.dtb loongson-2k2000-ref.dtb - -obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_NAME))
Signature · 1 line
2.43.0
PATCH 8/15 ARC: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB to use the generic rule to support built-in DTB.
To keep consistency across architectures, this commit also renames CONFIG_ARC_BUILTIN_DTB_NAME to CONFIG_BUILTIN_DTB_NAME.
---
arch/arc/Kconfig | 7 ++++--- arch/arc/Makefile | 3 --- arch/arc/boot/dts/Makefile | 9 +-------- arch/arc/configs/axs101_defconfig | 2 +- arch/arc/configs/axs103_defconfig | 2 +- arch/arc/configs/axs103_smp_defconfig | 2 +- arch/arc/configs/haps_hs_defconfig | 2 +- arch/arc/configs/haps_hs_smp_defconfig | 2 +- arch/arc/configs/hsdk_defconfig | 2 +- arch/arc/configs/nsim_700_defconfig | 2 +- arch/arc/configs/nsimosci_defconfig | 2 +- arch/arc/configs/nsimosci_hs_defconfig | 2 +- arch/arc/configs/nsimosci_hs_smp_defconfig | 2 +- arch/arc/configs/tb10x_defconfig | 2 +- arch/arc/configs/vdk_hs38_defconfig | 2 +- arch/arc/configs/vdk_hs38_smp_defconfig | 2 +- 16 files changed, 18 insertions(+), 27 deletions(-)
arch/arc/Kconfig +4 -3
@@ -16,6 +16,7 @@ config ARC select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC select ARCH_32BIT_OFF_T select BUILDTIME_TABLE_SORT + select GENERIC_BUILTIN_DTB select CLONE_BACKWARDS select COMMON_CLK select DMA_DIRECT_REMAP
@@ -549,11 +550,11 @@ config ARC_DBG_JUMP_LABEL part of static keys (jump labels) related code. endif -config ARC_BUILTIN_DTB_NAME +config BUILTIN_DTB_NAME string "Built in DTB" + default "nsim_700" help - Set the name of the DTB to embed in the vmlinux binary - Leaving it blank selects the "nsim_700" dtb. + Set the name of the DTB to embed in the vmlinux binary. endmenu # "ARC Architecture Configuration"
arch/arc/Makefile +0 -3
@@ -82,9 +82,6 @@ KBUILD_CFLAGS += $(cflags-y) KBUILD_AFLAGS += $(KBUILD_CFLAGS) KBUILD_LDFLAGS += $(ldflags-y) -# w/o this dtb won't embed into kernel binary -core-y += arch/arc/boot/dts/ - core-y += arch/arc/plat-sim/ core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
arch/arc/boot/dts/Makefile +1 -8
@@ -1,13 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -# Built-in dtb -builtindtb-y := nsim_700 -ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),) - builtindtb-y := $(CONFIG_ARC_BUILTIN_DTB_NAME) -endif - -obj-y += $(builtindtb-y).dtb.o -dtb-y := $(builtindtb-y).dtb +dtb-y := $(addsuffix .dtb, $(CONFIG_BUILTIN_DTB_NAME)) # for CONFIG_OF_ALL_DTBS test dtb- := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
arch/arc/configs/axs101_defconfig +1 -1
@@ -23,7 +23,7 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_ARC_PLAT_AXS10X=y CONFIG_AXS101=y CONFIG_ARC_CACHE_LINE_SHIFT=5 -CONFIG_ARC_BUILTIN_DTB_NAME="axs101" +CONFIG_BUILTIN_DTB_NAME="axs101" CONFIG_PREEMPT=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/axs103_defconfig +1 -1
@@ -22,7 +22,7 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_ARC_PLAT_AXS10X=y CONFIG_AXS103=y CONFIG_ISA_ARCV2=y -CONFIG_ARC_BUILTIN_DTB_NAME="axs103" +CONFIG_BUILTIN_DTB_NAME="axs103" CONFIG_PREEMPT=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/axs103_smp_defconfig +1 -1
@@ -22,7 +22,7 @@ CONFIG_ARC_PLAT_AXS10X=y CONFIG_AXS103=y CONFIG_ISA_ARCV2=y CONFIG_SMP=y -CONFIG_ARC_BUILTIN_DTB_NAME="axs103_idu" +CONFIG_BUILTIN_DTB_NAME="axs103_idu" CONFIG_PREEMPT=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/haps_hs_defconfig +1 -1
@@ -14,7 +14,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_EXPERT=y CONFIG_PERF_EVENTS=y # CONFIG_COMPAT_BRK is not set -CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs" +CONFIG_BUILTIN_DTB_NAME="haps_hs" CONFIG_MODULES=y # CONFIG_BLK_DEV_BSG is not set # CONFIG_COMPACTION is not set
arch/arc/configs/haps_hs_smp_defconfig +1 -1
@@ -16,7 +16,7 @@ CONFIG_PERF_EVENTS=y # CONFIG_VM_EVENT_COUNTERS is not set # CONFIG_COMPAT_BRK is not set CONFIG_SMP=y -CONFIG_ARC_BUILTIN_DTB_NAME="haps_hs_idu" +CONFIG_BUILTIN_DTB_NAME="haps_hs_idu" CONFIG_KPROBES=y CONFIG_MODULES=y # CONFIG_BLK_DEV_BSG is not set
arch/arc/configs/hsdk_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_ISA_ARCV2=y CONFIG_SMP=y CONFIG_LINUX_LINK_BASE=0x90000000 CONFIG_LINUX_RAM_BASE=0x80000000 -CONFIG_ARC_BUILTIN_DTB_NAME="hsdk" +CONFIG_BUILTIN_DTB_NAME="hsdk" CONFIG_PREEMPT=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/nsim_700_defconfig +1 -1
@@ -17,7 +17,7 @@ CONFIG_PERF_EVENTS=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set CONFIG_ISA_ARCOMPACT=y -CONFIG_ARC_BUILTIN_DTB_NAME="nsim_700" +CONFIG_BUILTIN_DTB_NAME="nsim_700" CONFIG_KPROBES=y CONFIG_MODULES=y # CONFIG_BLK_DEV_BSG is not set
arch/arc/configs/nsimosci_defconfig +1 -1
@@ -19,7 +19,7 @@ CONFIG_ISA_ARCOMPACT=y CONFIG_KPROBES=y CONFIG_MODULES=y # CONFIG_BLK_DEV_BSG is not set -CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci" +CONFIG_BUILTIN_DTB_NAME="nsimosci" # CONFIG_COMPACTION is not set CONFIG_NET=y CONFIG_PACKET=y
arch/arc/configs/nsimosci_hs_defconfig +1 -1
@@ -19,7 +19,7 @@ CONFIG_KPROBES=y CONFIG_MODULES=y # CONFIG_BLK_DEV_BSG is not set CONFIG_ISA_ARCV2=y -CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci_hs" +CONFIG_BUILTIN_DTB_NAME="nsimosci_hs" # CONFIG_COMPACTION is not set CONFIG_NET=y CONFIG_PACKET=y
arch/arc/configs/nsimosci_hs_smp_defconfig +1 -1
@@ -16,7 +16,7 @@ CONFIG_MODULES=y CONFIG_ISA_ARCV2=y CONFIG_SMP=y # CONFIG_ARC_TIMERS_64BIT is not set -CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci_hs_idu" +CONFIG_BUILTIN_DTB_NAME="nsimosci_hs_idu" CONFIG_PREEMPT=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/tb10x_defconfig +1 -1
@@ -26,7 +26,7 @@ CONFIG_MODULE_UNLOAD=y CONFIG_ARC_PLAT_TB10X=y CONFIG_ARC_CACHE_LINE_SHIFT=5 CONFIG_HZ=250 -CONFIG_ARC_BUILTIN_DTB_NAME="abilis_tb100_dvk" +CONFIG_BUILTIN_DTB_NAME="abilis_tb100_dvk" CONFIG_PREEMPT_VOLUNTARY=y # CONFIG_COMPACTION is not set CONFIG_NET=y
arch/arc/configs/vdk_hs38_defconfig +1 -1
@@ -13,7 +13,7 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_ARC_PLAT_AXS10X=y CONFIG_AXS103=y CONFIG_ISA_ARCV2=y -CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" +CONFIG_BUILTIN_DTB_NAME="vdk_hs38" CONFIG_PREEMPT=y CONFIG_NET=y CONFIG_PACKET=y
arch/arc/configs/vdk_hs38_smp_defconfig +1 -1
@@ -15,7 +15,7 @@ CONFIG_AXS103=y CONFIG_ISA_ARCV2=y CONFIG_SMP=y # CONFIG_ARC_TIMERS_64BIT is not set -CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" +CONFIG_BUILTIN_DTB_NAME="vdk_hs38_smp" CONFIG_PREEMPT=y CONFIG_NET=y CONFIG_PACKET=y
Signature · 1 line
2.43.0
PATCH 9/15 openrisc: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB to use the generic rule to support built-in DTB.
To keep consistency across architectures, this commit also renames CONFIG_OPENRISC_BUILTIN_DTB_NAME to CONFIG_BUILTIN_DTB_NAME.
---
arch/openrisc/Kbuild | 1 - arch/openrisc/Kconfig | 3 ++- arch/openrisc/boot/dts/Makefile | 2 +- arch/openrisc/configs/or1klitex_defconfig | 2 +- arch/openrisc/configs/or1ksim_defconfig | 2 +- arch/openrisc/configs/simple_smp_defconfig | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
arch/openrisc/Kbuild +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += lib/ kernel/ mm/ -obj-y += boot/dts/ # for cleaning subdir- += boot
arch/openrisc/Kconfig +2 -1
@@ -10,6 +10,7 @@ config OPENRISC select ARCH_HAS_DMA_SET_UNCACHED select ARCH_HAS_DMA_CLEAR_UNCACHED select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select GENERIC_BUILTIN_DTB select COMMON_CLK select OF select OF_EARLY_FLATTREE
@@ -89,7 +90,7 @@ config DCACHE_WRITETHROUGH If unsure say N here -config OPENRISC_BUILTIN_DTB +config BUILTIN_DTB_NAME string "Builtin DTB" default ""
arch/openrisc/boot/dts/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y += $(addsuffix .dtb.o, $(CONFIG_OPENRISC_BUILTIN_DTB)) +dtb-y += $(addsuffix .dtb, $(CONFIG_BUILTIN_DTB_NAME)) #DTC_FLAGS ?= -p 1024
arch/openrisc/configs/or1klitex_defconfig +1 -1
@@ -7,7 +7,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_SGETMASK_SYSCALL=y CONFIG_EXPERT=y -CONFIG_OPENRISC_BUILTIN_DTB="or1klitex" +CONFIG_BUILTIN_DTB_NAME="or1klitex" CONFIG_HZ_100=y CONFIG_OPENRISC_HAVE_SHADOW_GPRS=y CONFIG_NET=y
arch/openrisc/configs/or1ksim_defconfig +1 -1
@@ -14,7 +14,7 @@ CONFIG_SLUB=y CONFIG_SLUB_TINY=y CONFIG_MODULES=y # CONFIG_BLOCK is not set -CONFIG_OPENRISC_BUILTIN_DTB="or1ksim" +CONFIG_BUILTIN_DTB_NAME="or1ksim" CONFIG_HZ_100=y CONFIG_NET=y CONFIG_PACKET=y
arch/openrisc/configs/simple_smp_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_SLUB=y CONFIG_SLUB_TINY=y CONFIG_MODULES=y # CONFIG_BLOCK is not set -CONFIG_OPENRISC_BUILTIN_DTB="simple_smp" +CONFIG_BUILTIN_DTB_NAME="simple_smp" CONFIG_SMP=y CONFIG_HZ_100=y CONFIG_OPENRISC_HAVE_SHADOW_GPRS=y
Signature · 1 line
2.43.0
PATCH 10/15 xtensa: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB to use the generic rule to support built-in DTB.
To keep consistency across architectures, this commit also renames CONFIG_BUILTIN_DTB_SOURCE to CONFIG_BUILTIN_DTB_NAME.
---
arch/xtensa/Kbuild | 2 +- arch/xtensa/Kconfig | 3 ++- arch/xtensa/boot/dts/Makefile | 2 +- arch/xtensa/configs/audio_kc705_defconfig | 2 +- arch/xtensa/configs/cadence_csp_defconfig | 2 +- arch/xtensa/configs/generic_kc705_defconfig | 2 +- arch/xtensa/configs/nommu_kc705_defconfig | 2 +- arch/xtensa/configs/smp_lx200_defconfig | 2 +- arch/xtensa/configs/virt_defconfig | 2 +- arch/xtensa/configs/xip_kc705_defconfig | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-)
arch/xtensa/Kbuild +1 -1
@@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += kernel/ mm/ platforms/ boot/dts/ +obj-y += kernel/ mm/ platforms/
arch/xtensa/Kconfig +2 -1
@@ -19,6 +19,7 @@ config XTENSA select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_TABLE_SORT + select GENERIC_BUILTIN_DTB select CLONE_BACKWARDS select COMMON_CLK select DMA_NONCOHERENT_MMAP if MMU
@@ -461,7 +462,7 @@ config USE_OF help Include support for flattened device tree machine descriptions. -config BUILTIN_DTB_SOURCE +config BUILTIN_DTB_NAME string "DTB to build into the kernel image" depends on OF
arch/xtensa/boot/dts/Makefile +1 -1
@@ -7,7 +7,7 @@ # # -obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE)) +dtb-$(CONFIG_OF) += $(addsuffix .dtb, $(CONFIG_BUILTIN_DTB_NAME)) # for CONFIG_OF_ALL_DTBS test dtb- := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
arch/xtensa/configs/audio_kc705_defconfig +1 -1
@@ -30,7 +30,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="kc705" +CONFIG_BUILTIN_DTB_NAME="kc705" # CONFIG_COMPACTION is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_PM=y
arch/xtensa/configs/cadence_csp_defconfig +1 -1
@@ -35,7 +35,7 @@ CONFIG_HIGHMEM=y # CONFIG_PCI is not set CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="csp" +CONFIG_BUILTIN_DTB_NAME="csp" # CONFIG_COMPACTION is not set CONFIG_XTFPGA_LCD=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
arch/xtensa/configs/generic_kc705_defconfig +1 -1
@@ -29,7 +29,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="kc705" +CONFIG_BUILTIN_DTB_NAME="kc705" # CONFIG_COMPACTION is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_NET=y
arch/xtensa/configs/nommu_kc705_defconfig +1 -1
@@ -36,7 +36,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu" +CONFIG_BUILTIN_DTB_NAME="kc705_nommu" CONFIG_BINFMT_FLAT=y CONFIG_NET=y CONFIG_PACKET=y
arch/xtensa/configs/smp_lx200_defconfig +1 -1
@@ -33,7 +33,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="lx200mx" +CONFIG_BUILTIN_DTB_NAME="lx200mx" # CONFIG_COMPACTION is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set CONFIG_NET=y
arch/xtensa/configs/virt_defconfig +1 -1
@@ -24,7 +24,7 @@ CONFIG_HIGHMEM=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x80000000@0" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="virt" +CONFIG_BUILTIN_DTB_NAME="virt" # CONFIG_PARSE_BOOTPARAM is not set CONFIG_JUMP_LABEL=y CONFIG_MODULES=y
arch/xtensa/configs/xip_kc705_defconfig +1 -1
@@ -29,7 +29,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" CONFIG_USE_OF=y -CONFIG_BUILTIN_DTB_SOURCE="kc705" +CONFIG_BUILTIN_DTB_NAME="kc705" # CONFIG_PARSE_BOOTPARAM is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_COMPACTION is not set
Signature · 1 line
2.43.0
PATCH 11/15 nios2: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB when built-in DTB support is enabled.
To keep consistency across architectures, this commit also renames CONFIG_NIOS2_DTB_SOURCE_BOOL to CONFIG_BUILTIN_DTB, and CONFIG_NIOS2_DTB_SOURCE to CONFIG_BUILTIN_DTB_NAME.
---
arch/nios2/Kbuild | 2 +- arch/nios2/boot/dts/Makefile | 4 ++-- arch/nios2/kernel/prom.c | 2 +- arch/nios2/platform/Kconfig.platform | 11 ++++++----- 4 files changed, 10 insertions(+), 9 deletions(-)
arch/nios2/Kbuild +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += kernel/ mm/ platform/ boot/dts/ +obj-y += kernel/ mm/ platform/ # for cleaning subdir- += boot
arch/nios2/boot/dts/Makefile +2 -2
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y := $(patsubst %.dts,%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE)) +dtb-y := $(addsuffix .dtb, $(CONFIG_BUILTIN_DTB_NAME)) -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts)) +dtb-$(CONFIG_OF_ALL_DTBS) += $(patsubst $(src)/%.dts,%.dtb, $(wildcard $(src)/*.dts))
arch/nios2/kernel/prom.c +1 -1
@@ -32,7 +32,7 @@ void __init early_init_devtree(void *params) }#endif -#ifdef CONFIG_NIOS2_DTB_SOURCE_BOOL +#ifdef CONFIG_BUILTIN_DTB if (be32_to_cpu ((__be32) *dtb) ==OF_DT_HEADER ) params = (void *)__dtb_start;#endif
arch/nios2/platform/Kconfig.platform +6 -5
@@ -35,19 +35,20 @@ config NIOS2_DTB_PHYS_ADDR help Physical address of a dtb blob. -config NIOS2_DTB_SOURCE_BOOL +config BUILTIN_DTB bool "Compile and link device tree into kernel image" depends on !COMPILE_TEST + select GENERIC_BUILTIN_DTB help This allows you to specify a dts (device tree source) file which will be compiled and linked into the kernel image. -config NIOS2_DTB_SOURCE - string "Device tree source file" - depends on NIOS2_DTB_SOURCE_BOOL +config BUILTIN_DTB_NAME + string "Built-in device tree name" + depends on BUILTIN_DTB default "" help - Absolute path to the device tree source (dts) file describing your + Relative path to the device tree without suffix describing your system. comment "Nios II instructions"
Signature · 1 line
2.43.0
PATCH 12/15 sh: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB when built-in DTB support is enabled.
To keep consistency across architectures, this commit also renames CONFIG_USE_BUILTIN_DTB to CONFIG_BUILTIN_DTB, and CONFIG_BUILTIN_DTB_SOURCE to CONFIG_BUILTIN_DTB_NAME.
---
arch/sh/Kbuild | 1 - arch/sh/Kconfig | 7 ++++--- arch/sh/boot/dts/Makefile | 2 +- arch/sh/kernel/setup.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
arch/sh/Kbuild +0 -1
@@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y += kernel/ mm/ boards/ obj-$(CONFIG_SH_FPU_EMU) += math-emu/ -obj-$(CONFIG_USE_BUILTIN_DTB) += boot/dts/ obj-$(CONFIG_HD6446X_SERIES) += cchips/hd6446x/
arch/sh/Kconfig +4 -3
@@ -644,10 +644,11 @@ endmenu menu "Boot options" -config USE_BUILTIN_DTB +config BUILTIN_DTB bool "Use builtin DTB" default n depends on SH_DEVICE_TREE + select GENERIC_BUILTIN_DTB help Link a device tree blob for particular hardware into the kernel, suppressing use of the DTB pointer provided by the bootloader.
@@ -655,10 +656,10 @@ config USE_BUILTIN_DTB not capable of providing a DTB to the kernel, or for experimental hardware without stable device tree bindings. -config BUILTIN_DTB_SOURCE +config BUILTIN_DTB_NAME string "Source file for builtin DTB" default "" - depends on USE_BUILTIN_DTB + depends on BUILTIN_DTB help Base name (without suffix, relative to arch/sh/boot/dts) for the a DTS file that will be used to produce the DTB linked into the
arch/sh/boot/dts/Makefile +1 -1
@@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_USE_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE)) +obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_NAME))
arch/sh/kernel/setup.c +2 -2
@@ -249,7 +249,7 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)/* Avoid calling an __init function on secondary cpus. */ if (done)return ; -#ifdef CONFIG_USE_BUILTIN_DTB +#ifdef CONFIG_BUILTIN_DTB dt_virt = __dtb_start;#else dt_virt =phys_to_virt (dt_phys);
@@ -323,7 +323,7 @@ void __init setup_arch(char **cmdline_p)sh_early_platform_driver_probe ("earlyprintk" ,1 ,1 );#ifdef CONFIG_OF_EARLY_FLATTREE -#ifdef CONFIG_USE_BUILTIN_DTB +#ifdef CONFIG_BUILTIN_DTB unflatten_and_copy_device_tree ();#else unflatten_device_tree ();
Signature · 1 line
2.43.0
PATCH 13/15 microblaze: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaSelect GENERIC_BUILTIN_DTB to use the generic rule to support built-in DTB.
MicroBlaze is the only architecture that embeds the boot DTB into its own section, __fdt_blob, and hard-codes the section size to 64kB.
All other architectures that support embedded DTBs use the .dtb.init.rodata handled by include/asm-generic/vmlinux.lds.h.
For safety, arch/microblaze/boot/dts/system.dtb is still placed in the __fdt_blob section, but removing the MicroBlaze-specific section should be considered.
---
arch/microblaze/Kbuild | 1 - arch/microblaze/Kconfig | 5 +++++ arch/microblaze/boot/dts/Makefile | 5 ----- arch/microblaze/boot/dts/linked_dtb.S | 2 -- arch/microblaze/kernel/vmlinux.lds.S | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 arch/microblaze/boot/dts/linked_dtb.S
arch/microblaze/Kbuild +0 -1
@@ -2,7 +2,6 @@ obj-y += kernel/ obj-y += mm/ obj-$(CONFIG_PCI) += pci/ -obj-y += boot/dts/ # for cleaning subdir- += boot
arch/microblaze/Kconfig +5 -0
@@ -10,6 +10,7 @@ config MICROBLAZE select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_TABLE_SORT + select GENERIC_BUILTIN_DTB select TIMER_OF select CLONE_BACKWARDS3 select COMMON_CLK
@@ -47,6 +48,10 @@ config MICROBLAZE select TRACE_IRQFLAGS_SUPPORT select GENERIC_IRQ_MULTI_HANDLER +config BUILTIN_DTB_NAME + string + default "system" + # Endianness selection choice prompt "Endianness selection"
arch/microblaze/boot/dts/Makefile +0 -5
@@ -4,11 +4,6 @@ dtb-y := system.dtb ifneq ($(DTB),) -obj-y += linked_dtb.o - -# Ensure system.dtb exists -$(obj)/linked_dtb.o: $(obj)/system.dtb - # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb
arch/microblaze/boot/dts/linked_dtb.S deleted +0 -2
@@ -1,2 +0,0 @@ -.section __fdt_blob,"a" -.incbin "arch/microblaze/boot/dts/system.dtb"
arch/microblaze/kernel/vmlinux.lds.S +1 -1
@@ -47,7 +47,7 @@ SECTIONS { . = ALIGN (8) ; __fdt_blob : AT(ADDR(__fdt_blob) - LOAD_OFFSET) { _fdt_start = . ; /* place for fdt blob */ - *(__fdt_blob) ; /* Any link-placed DTB */ + *(.dtb.init.rodata) ; /* Any link-placed DTB */ . = _fdt_start + 0x10000; /* Pad up to 64kbyte */ _fdt_end = . ; }
Signature · 1 line
2.43.0
PATCH 14/15 kbuild: rename CONFIG_GENERIC_BUILTIN_DTB to CONFIG_BUILTIN_DTB
In reply to Masahiro YamadaNow that all architectures have migrated to the generic built-in DTB support, the GENERIC_ prefix is no longer necessary.
---
Makefile | 2 +- arch/arc/Kconfig | 2 +- arch/loongarch/Kconfig | 1 - arch/microblaze/Kconfig | 2 +- arch/mips/Kconfig | 1 - arch/nios2/platform/Kconfig.platform | 1 - arch/openrisc/Kconfig | 2 +- arch/riscv/Kconfig | 1 - arch/sh/Kconfig | 1 - arch/xtensa/Kconfig | 2 +- drivers/of/Kconfig | 2 +- scripts/Makefile.vmlinux | 2 +- scripts/link-vmlinux.sh | 2 +- 13 files changed, 8 insertions(+), 13 deletions(-)
Makefile +1 -1
@@ -1417,7 +1417,7 @@ ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs endif -ifdef CONFIG_GENERIC_BUILTIN_DTB +ifdef CONFIG_BUILTIN_DTB vmlinux: dtbs endif
arch/arc/Kconfig +1 -1
@@ -16,7 +16,7 @@ config ARC select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC select ARCH_32BIT_OFF_T select BUILDTIME_TABLE_SORT - select GENERIC_BUILTIN_DTB + select BUILTIN_DTB select CLONE_BACKWARDS select COMMON_CLK select DMA_DIRECT_REMAP
arch/loongarch/Kconfig +0 -1
@@ -388,7 +388,6 @@ endchoice config BUILTIN_DTB bool "Enable built-in dtb in kernel" depends on OF - select GENERIC_BUILTIN_DTB help Some existing systems do not provide a canonical device tree to the kernel at boot time. Let's provide a device tree table in the
arch/microblaze/Kconfig +1 -1
@@ -10,7 +10,7 @@ config MICROBLAZE select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_TABLE_SORT - select GENERIC_BUILTIN_DTB + select BUILTIN_DTB select TIMER_OF select CLONE_BACKWARDS3 select COMMON_CLK
arch/mips/Kconfig +0 -1
@@ -33,7 +33,6 @@ config MIPS select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1) select CPU_PM if CPU_IDLE || SUSPEND select GENERIC_ATOMIC64 if !64BIT - select GENERIC_BUILTIN_DTB if BUILTIN_DTB select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE select GENERIC_GETTIMEOFDAY
arch/nios2/platform/Kconfig.platform +0 -1
@@ -38,7 +38,6 @@ config NIOS2_DTB_PHYS_ADDR config BUILTIN_DTB bool "Compile and link device tree into kernel image" depends on !COMPILE_TEST - select GENERIC_BUILTIN_DTB help This allows you to specify a dts (device tree source) file which will be compiled and linked into the kernel image.
arch/openrisc/Kconfig +1 -1
@@ -10,7 +10,7 @@ config OPENRISC select ARCH_HAS_DMA_SET_UNCACHED select ARCH_HAS_DMA_CLEAR_UNCACHED select ARCH_HAS_SYNC_DMA_FOR_DEVICE - select GENERIC_BUILTIN_DTB + select BUILTIN_DTB select COMMON_CLK select OF select OF_EARLY_FLATTREE
arch/riscv/Kconfig +0 -1
@@ -1110,7 +1110,6 @@ config RISCV_ISA_FALLBACK config BUILTIN_DTB bool "Built-in device tree" depends on OF && NONPORTABLE - select GENERIC_BUILTIN_DTB help Build a device tree into the Linux image. This option should be selected if no bootloader is being used.
arch/sh/Kconfig +0 -1
@@ -648,7 +648,6 @@ config BUILTIN_DTB bool "Use builtin DTB" default n depends on SH_DEVICE_TREE - select GENERIC_BUILTIN_DTB help Link a device tree blob for particular hardware into the kernel, suppressing use of the DTB pointer provided by the bootloader.
arch/xtensa/Kconfig +1 -1
@@ -19,7 +19,7 @@ config XTENSA select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_TABLE_SORT - select GENERIC_BUILTIN_DTB + select BUILTIN_DTB select CLONE_BACKWARDS select COMMON_CLK select DMA_NONCOHERENT_MMAP if MMU
drivers/of/Kconfig +1 -1
@@ -2,7 +2,7 @@ config DTC bool -config GENERIC_BUILTIN_DTB +config BUILTIN_DTB bool config BUILTIN_DTB_ALL
scripts/Makefile.vmlinux +1 -1
@@ -53,7 +53,7 @@ quiet_cmd_gen_dtbs_list = GEN $@ targets += .builtin-dtbs-list -ifdef CONFIG_GENERIC_BUILTIN_DTB +ifdef CONFIG_BUILTIN_DTB targets += .builtin-dtbs.S .builtin-dtbs.o vmlinux: .builtin-dtbs.o endif
scripts/link-vmlinux.sh +1 -1
@@ -68,7 +68,7 @@ vmlinux_link() libs="${KBUILD_VMLINUX_LIBS}" fi - if is_enabled CONFIG_GENERIC_BUILTIN_DTB; then + if is_enabled CONFIG_BUILTIN_DTB; then objs="${objs} .builtin-dtbs.o" fi
Signature · 1 line
2.43.0
PATCH 15/15 kbuild: use .init.rodata section unconditionally for cmd_wrap_S_dtb
In reply to Masahiro YamadaBoot DTBs are now wrapped and compiled in scripts/Makefile.vmlinux.
The cmd_wrap_S_dtb rule in scripts/Makefile.dtbs is now only used for generic purposes, so the .init.rodata section should be used unconditionally.
---
scripts/Makefile.dtbs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
scripts/Makefile.dtbs +1 -3
@@ -34,14 +34,12 @@ $(obj)/dtbs-list: $(dtb-y) FORCE # Assembly file to wrap dtb(o) # --------------------------------------------------------------------------- -builtin-dtb-section = $(if $(filter arch/%, $(obj)),.dtb.init.rodata,.init.rodata) - # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_wrap_S_dtb = WRAP $@ cmd_wrap_S_dtb = { \ symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*)); \ echo '\#include <asm-generic/vmlinux.lds.h>'; \ - echo '.section $(builtin-dtb-section),"a"'; \ + echo '.section .init.rodata,"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ echo ".global $${symbase}_begin"; \ echo "$${symbase}_begin:"; \
Signature · 1 line
2.43.0
Re: [PATCH 02/15] kbuild: split device tree build rules into scripts/Makefile.dtbs
In reply to Masahiro YamadaQuoted 10 lines · Masahiro Yamada
scripts/Makefile.libis included not only fromscripts/Makefile.buildbut also fromscripts/Makefile.{modfinal,package,vmlinux,vmlinux_o}, where DT build rules are not required.Split the DT build rules out to
scripts/Makefile.dtbs, and include it only when necessary.Signed-off-by Masahiro Yamada <[email protected]>---
Quoted 7 lines
drivers/of/fdt.c | 2 +- drivers/of/unittest.c | 4 +- scripts/Makefile.build | 25 +++----- scripts/Makefile.dtbs | 142 +++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.lib | 115 --------------------------------- 5 files changed, 153 insertions(+), 135 deletions(-) create mode 100644 scripts/Makefile.dtbs
Re: [PATCH 03/15] kbuild: move non-boot builtin DTBs to .init.rodata section
In reply to Masahiro YamadaQuoted 53 lines · Masahiro Yamada
Some architectures support embedding boot DTB(s) in vmlinux. These architectures, except MIPS and MicroBlaze, expect a single DTB in the .dtb.init.rodata section. MIPS embeds multiple DTBs in vmlinux. MicroBlaze embeds a DTB in its own
__fdt_blobsection instead of the .dtb.init.rodata section.For example, RISC-V previously allowed embedding multiple DTBs, but only the first DTB in the .dtb.init.rodata section was used. Commit
2672031b20f6("riscv: dts: MoveBUILTIN_DTB_SOURCEto commonKconfig") ensured only one boot DTB is embedded.Meanwhile, commit
7b937cc243e5("of: Createof_rootif no dtb provided by firmware") introduced another DTB into the .dtb.init.rodata section.The symbol dump (sorted by address) for ARCH=riscv
nommu_k210_defconfigis now as follows:00000000801290e0 D __dtb_start 00000000801290e0 D __dtb_k210_generic_begin 000000008012b571 D __dtb_k210_generic_end 000000008012b580 D __dtb_empty_root_begin 000000008012b5c8 D __dtb_empty_root_end 000000008012b5e0 D __dtb_endThe .dtb.init.rodata section contains the following two DTB files:
arch/riscv/boot/dts/canaan/k210_generic.dtb
drivers/of/empty_root.dtbThis is not an immediate problem because the boot code chooses the first DTB, k210_generic.dtb. The second one, empty_root.dtb is ignored. However, relying on the link order (i.e., the order in Makefiles) is fragile.
Only the boot DTB should be placed in the .dtb.init.rodata because the arch boot code generally does not know the DT name, thus it uses the
__dtb_startsymbol to find it.empty_root.dtb is looked up by name, so it can be moved to the generic .init.rodata section.
When
CONFIG_OF_UNITTESTis enabled, more unittest DTBOs are embedded in the .dtb.init.rodata section. These are also looked up by name, so can be moved to the .init.rodata section.I added the
__initdataannotation to theoverlay_infodata array because modpost knows the .init.rodata section is discarded, and would otherwise warn about it.The implementation is kind of cheesy; the section is .dtb.init.rodata under the
arch/directory, and .init.rodata section otherwise. This will be refactored later.
Quoted 6 lines
Signed-off-by Masahiro Yamada <[email protected]>---
drivers/of/unittest.c | 2 +- scripts/Makefile.dtbs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
Rob Herring
maintainerRe: [PATCH 04/15] kbuild: add generic support for built-in boot DTBs
In reply to Masahiro YamadaQuoted 39 lines · Masahiro Yamada
Some architectures embed boot DTBs in vmlinux. A potential issue for these architectures is a race condition during parallel builds because
Kbuilddescends intoarch/*/boot/dts/twice.One build thread is initiated by the 'dtbs' target, which is a prerequisite of the 'all' target in the top-level
Makefile:ifdef
CONFIG_OF_EARLY_FLATTREE
all: dtbs
endifFor architectures that support the embedded boot dtb,
arch/*/boot/dts/is visited also during the ordinary directory traversal in order to build obj-y objects that wrap DTBs.Since these build threads are unaware of each other, they can run simultaneously during parallel builds.
This commit introduces a generic build rule to
scripts/Makefile.vmlinuxto support embedded boot DTBs in a race-free way. Architectures that want to use this rule need to selectCONFIG_GENERIC_BUILTIN_DTB.After the migration, Makefiles under
arch/*/boot/dts/will be visited only once to build only *.dtb files.This change also aims to unify the CONFIG options used for embedded DTBs support. Currently, different architectures use different CONFIG options for the same purposes.
The CONFIG options are unified as follows:
-
CONFIG_GENERIC_BUILTIN_DTBThis enables the generic rule for embedded boot DTBs. This will be renamed to
CONFIG_BUILTIN_DTBafter all architectures migrate to the generic rule.-
CONFIG_BUILTIN_DTB_NAME
Quoted 7 lines
This specifies the path to the embedded DTB.
(relative toarch/*/boot/dts/)-
CONFIG_BUILTIN_DTB_ALLIf this is enabled, all DTB files compiled under
arch/*/boot/dts/are embedded into vmlinux. Only used by MIPS.
I started to do this a long time ago, but then decided we didn't want to encourage this feature. IMO it should only be for legacy bootloaders or development/debug. And really, appended DTB is more flexible for the legacy bootloader case.
In hindsight, a common config would have been easier to limit new arches...
Quoted 40 lines
Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 7 ++++++- drivers/of/Kconfig | 6 ++++++ scripts/Makefile.vmlinux | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/link-vmlinux.sh | 4 ++++ 4 files changed, 60 insertions(+), 1 deletion(-)Makefile +6
-1@@ -1417,6 +1417,10 @@ ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs endif +ifdef CONFIG_GENERIC_BUILTIN_DTB +vmlinux: dtbs +endif + endif PHONY += scripts_dtc@@ -1483,7 +1487,8 @@ endif # CONFIG_MODULES CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ compile_commands.json rust/test \ - rust-project.json .vmlinux.objs .vmlinux.export.c + rust-project.json .vmlinux.objs .vmlinux.export.c \ + .builtin-dtbs-list .builtin-dtb.S # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \drivers/of/Kconfig +0
-0
drivers/of/Kconfig line 6
Quoted 5 lines
drivers/of/Kconfig +2
-0@@ -2,6 +2,12 @@ config DTC bool +config GENERIC_BUILTIN_DTB + bool
So that we don't add new architectures to this, I would like something like:
# Do not add new architectures to this list
depends on MIPS || RISCV || MICROBLAZE ...
Yes, it's kind of odd since the arch selects the option...
For sure, we don't want this option on arm64. For that, I can rely on Will and Catalin rejecting a select, but on some new arch I can't.
drivers/of/Kconfig line 9
Quoted 3 lines
drivers/of/Kconfig +3
-0+ +config BUILTIN_DTB_ALL + bool
Can this be limited to MIPS?
Quoted 18 lines
drivers/of/Kconfig +1
-0+ menuconfig OF bool "Device Tree and Open Firmware support" helpscripts/Makefile.vmlinux +6
-0@@ -17,6 +17,50 @@ quiet_cmd_cc_o_c = CC $@ %.o: %.c FORCE $(call if_changed_dep,cc_o_c) +quiet_cmd_as_o_S = AS $@ + cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< + +%.o: %.S FORCE + $(call if_changed_dep,as_o_S) +
scripts/Makefile.vmlinux quiet_cmd_cc_o_c = CC $@ · line 35
Quoted 10 lines
scripts/Makefile.vmlinux +10
-0+# Built-in dtb +# --------------------------------------------------------------------------- + +quiet_cmd_wrap_dtbs = WRAP $@ + cmd_wrap_dtbs = { \ + echo '\#include <asm-generic/vmlinux.lds.h>'; \ + echo '.section .dtb.init.rodata,"a"'; \ + while read dtb; do \ + symbase=__dtb_$$(basename -s .dtb "$${dtb}" | tr - _); \ + echo '.balign STRUCT_ALIGNMENT'; \
Is this always guaranteed to be at least 8 bytes? That's the required alignment for dtbs and assumed by libfdt.
Quoted 7 lines
scripts/Makefile.vmlinux +7
-0+ echo ".global $${symbase}_begin"; \ + echo "$${symbase}_begin:"; \ + echo '.incbin "'$$dtb'" '; \ + echo ".global $${symbase}_end"; \ + echo "$${symbase}_end:"; \ + done < $<; \ + } > $@
Rob Herring
maintainerRe: [PATCH 14/15] kbuild: rename CONFIG_GENERIC_BUILTIN_DTB to CONFIG_BUILTIN_DTB
In reply to Masahiro YamadaQuoted 47 lines · Masahiro Yamada
Now that all architectures have migrated to the generic built-in DTB support, the
GENERIC_prefix is no longer necessary.Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 2 +- arch/arc/Kconfig | 2 +- arch/loongarch/Kconfig | 1 - arch/microblaze/Kconfig | 2 +- arch/mips/Kconfig | 1 - arch/nios2/platform/Kconfig.platform | 1 - arch/openrisc/Kconfig | 2 +- arch/riscv/Kconfig | 1 - arch/sh/Kconfig | 1 - arch/xtensa/Kconfig | 2 +- drivers/of/Kconfig | 2 +- scripts/Makefile.vmlinux | 2 +- scripts/link-vmlinux.sh | 2 +- 13 files changed, 8 insertions(+), 13 deletions(-)arch/loongarch/Kconfig +0
-1@@ -388,7 +388,6 @@ endchoice config BUILTIN_DTB bool "Enable built-in dtb in kernel" depends on OF - select GENERIC_BUILTIN_DTB help Some existing systems do not provide a canonical device tree to the kernel at boot time. Let's provide a device tree table in thearch/nios2/platform/Kconfig.platform +0
-1@@ -38,7 +38,6 @@ config NIOS2_DTB_PHYS_ADDR config BUILTIN_DTB bool "Compile and link device tree into kernel image" depends on !COMPILE_TEST - select GENERIC_BUILTIN_DTB
arch/riscv/Kconfig config RISCV_ISA_FALLBACK · line 1112
Quoted 3 lines
arch/riscv/Kconfig +0
-0@@ -1110,7 +1110,6 @@ config RISCV_ISA_FALLBACK config BUILTIN_DTB bool "Built-in device tree" depends on OF && NONPORTABLE
Humm, maybe this NONPORTABLE option could be common and used to accomplish what I want here...
Quoted 17 lines
arch/riscv/Kconfig +0
-1- select GENERIC_BUILTIN_DTBarch/sh/Kconfig +0
-1@@ -648,7 +648,6 @@ config BUILTIN_DTB bool "Use builtin DTB" default n depends on SH_DEVICE_TREE - select GENERIC_BUILTIN_DTBdrivers/of/Kconfig +0
-0
drivers/of/Kconfig line 6
Quoted 6 lines
drivers/of/Kconfig +1
-1@@ -2,7 +2,7 @@ config DTC bool -config GENERIC_BUILTIN_DTB +config BUILTIN_DTB bool
I'm confused. We can't have the same config option twice, can we?
Rob
Re: [PATCH 14/15] kbuild: rename CONFIG_GENERIC_BUILTIN_DTB to CONFIG_BUILTIN_DTB
Quoted 46 lines · Rob Herring
Quoted 43 lines · Masahiro Yamada
Now that all architectures have migrated to the generic built-in DTB support, the
GENERIC_prefix is no longer necessary.Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 2 +- arch/arc/Kconfig | 2 +- arch/loongarch/Kconfig | 1 - arch/microblaze/Kconfig | 2 +- arch/mips/Kconfig | 1 - arch/nios2/platform/Kconfig.platform | 1 - arch/openrisc/Kconfig | 2 +- arch/riscv/Kconfig | 1 - arch/sh/Kconfig | 1 - arch/xtensa/Kconfig | 2 +- drivers/of/Kconfig | 2 +- scripts/Makefile.vmlinux | 2 +- scripts/link-vmlinux.sh | 2 +- 13 files changed, 8 insertions(+), 13 deletions(-)arch/loongarch/Kconfig +0
-1@@ -388,7 +388,6 @@ endchoice config BUILTIN_DTB bool "Enable built-in dtb in kernel" depends on OF - select GENERIC_BUILTIN_DTB help Some existing systems do not provide a canonical device tree to the kernel at boot time. Let's provide a device tree table in thearch/nios2/platform/Kconfig.platform +0
-1@@ -38,7 +38,6 @@ config NIOS2_DTB_PHYS_ADDR config BUILTIN_DTB bool "Compile and link device tree into kernel image" depends on !COMPILE_TEST - select GENERIC_BUILTIN_DTB
Quoted 9 lines
arch/riscv/Kconfig config RISCV_ISA_FALLBACK · line 1112
Quoted 6 lines
arch/riscv/Kconfig +0
-0@@ -1110,7 +1110,6 @@ config RISCV_ISA_FALLBACK config BUILTIN_DTB bool "Built-in device tree" depends on OF && NONPORTABLEHumm, maybe this NONPORTABLE option could be common and used to accomplish what I want here...
I do not know how this can prevent new architectures from enabling BUILTIN_DTB.
New architectures can select BUILTIN_DTB together with NONPORTABLE.
Quoted 20 lines
Quoted 20 lines
arch/riscv/Kconfig +0
-1- select GENERIC_BUILTIN_DTBarch/sh/Kconfig +0
-1@@ -648,7 +648,6 @@ config BUILTIN_DTB bool "Use builtin DTB" default n depends on SH_DEVICE_TREE - select GENERIC_BUILTIN_DTBdrivers/of/Kconfig +0
-0@@ -2,7 +2,7 @@ config DTC bool
Quoted 5 lines
drivers/of/Kconfig line 6
Quoted 3 lines
drivers/of/Kconfig +1
-1-config GENERIC_BUILTIN_DTB +config BUILTIN_DTB boolI'm confused. We can't have the same config option twice, can we?
We can.
Documentation/kbuild/kconfig-language.rst says:
A config option can be defined multiple times with the same name, but every definition can have only a single input prompt and the type must not conflict.
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 04/15] kbuild: add generic support for built-in boot DTBs
In reply to Rob HerringQuoted 46 lines · Rob Herring
Quoted 44 lines · Masahiro Yamada
Some architectures embed boot DTBs in vmlinux. A potential issue for these architectures is a race condition during parallel builds because
Kbuilddescends intoarch/*/boot/dts/twice.One build thread is initiated by the 'dtbs' target, which is a prerequisite of the 'all' target in the top-level
Makefile:ifdef
CONFIG_OF_EARLY_FLATTREE
all: dtbs
endifFor architectures that support the embedded boot dtb,
arch/*/boot/dts/is visited also during the ordinary directory traversal in order to build obj-y objects that wrap DTBs.Since these build threads are unaware of each other, they can run simultaneously during parallel builds.
This commit introduces a generic build rule to
scripts/Makefile.vmlinuxto support embedded boot DTBs in a race-free way. Architectures that want to use this rule need to selectCONFIG_GENERIC_BUILTIN_DTB.After the migration, Makefiles under
arch/*/boot/dts/will be visited only once to build only *.dtb files.This change also aims to unify the CONFIG options used for embedded DTBs support. Currently, different architectures use different CONFIG options for the same purposes.
The CONFIG options are unified as follows:
-
CONFIG_GENERIC_BUILTIN_DTBThis enables the generic rule for embedded boot DTBs. This will be renamed to
CONFIG_BUILTIN_DTBafter all architectures migrate to the generic rule.-
CONFIG_BUILTIN_DTB_NAMEThis specifies the path to the embedded DTB.
(relative toarch/*/boot/dts/)-
CONFIG_BUILTIN_DTB_ALL
Quoted 7 lines
Quoted 2 lines
If this is enabled, all DTB files compiled under
arch/*/boot/dts/are embedded into vmlinux. Only used by MIPS.I started to do this a long time ago, but then decided we didn't want to encourage this feature. IMO it should only be for legacy bootloaders or development/debug. And really, appended DTB is more flexible for the legacy bootloader case.
I learned CONFIG_ARM_APPENDED_DTB today.
Quoted 57 lines
In hindsight, a common config would have been easier to limit new arches...
Quoted 40 lines
Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 7 ++++++- drivers/of/Kconfig | 6 ++++++ scripts/Makefile.vmlinux | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/link-vmlinux.sh | 4 ++++ 4 files changed, 60 insertions(+), 1 deletion(-)Makefile +6
-1@@ -1417,6 +1417,10 @@ ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs endif +ifdef CONFIG_GENERIC_BUILTIN_DTB +vmlinux: dtbs +endif + endif PHONY += scripts_dtc@@ -1483,7 +1487,8 @@ endif # CONFIG_MODULES CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ compile_commands.json rust/test \ - rust-project.json .vmlinux.objs .vmlinux.export.c + rust-project.json .vmlinux.objs .vmlinux.export.c \ + .builtin-dtbs-list .builtin-dtb.S # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \drivers/of/Kconfig +0
-0drivers/of/Kconfig line 6
Quoted 5 lines
drivers/of/Kconfig +2
-0@@ -2,6 +2,12 @@ config DTC bool +config GENERIC_BUILTIN_DTB + boolSo that we don't add new architectures to this, I would like something like:
# Do not add new architectures to this list
depends on MIPS || RISCV || MICROBLAZE ...Yes, it's kind of odd since the arch selects the option...
Quoted 8 lines
For sure, we don't want this option on arm64. For that, I can rely on Will and Catalin rejecting a select, but on some new arch I can't.
drivers/of/Kconfig line 9
Quoted 3 lines
drivers/of/Kconfig +3
-0+ +config BUILTIN_DTB_ALL + boolCan this be limited to MIPS?
I am fine with hard-coded "depends on"
if this feature is discouraged.
Quoted 23 lines
Quoted 23 lines
drivers/of/Kconfig +1
-0+ menuconfig OF bool "Device Tree and Open Firmware support" helpscripts/Makefile.vmlinux +11
-0@@ -17,6 +17,50 @@ quiet_cmd_cc_o_c = CC $@ %.o: %.c FORCE $(call if_changed_dep,cc_o_c) +quiet_cmd_as_o_S = AS $@ + cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< + +%.o: %.S FORCE + $(call if_changed_dep,as_o_S) + +# Built-in dtb +# --------------------------------------------------------------------------- + +quiet_cmd_wrap_dtbs = WRAP $@ + cmd_wrap_dtbs = { \
Quoted 8 lines
scripts/Makefile.vmlinux quiet_cmd_cc_o_c = CC $@ · line 35
Quoted 5 lines
scripts/Makefile.vmlinux +5
-0+ echo '\#include <asm-generic/vmlinux.lds.h>'; \ + echo '.section .dtb.init.rodata,"a"'; \ + while read dtb; do \ + symbase=__dtb_$$(basename -s .dtb "$${dtb}" | tr - _); \ + echo '.balign STRUCT_ALIGNMENT'; \Is this always guaranteed to be at least 8 bytes? That's the required alignment for dtbs and assumed by libfdt.
I think so.
include/asm-generic/vmlinux.lds.h defines it as 32.
We can loosen the alignment to 8, but for safety, I just copied this from scripts/Makefile.lib because 32-byte alignment is what we do now.
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 06/15] riscv: migrate to the generic rule for built-in DTB
In reply to Masahiro YamadaQuoted 6 lines · Masahiro Yamada
Select
GENERIC_BUILTIN_DTBwhen built-in DTB support is enabled.To keep consistency across architectures, this commit also renames
CONFIG_BUILTIN_DTB_SOURCEtoCONFIG_BUILTIN_DTB_NAME.Signed-off-by Masahiro Yamada <[email protected]>
Re: [PATCH 04/15] kbuild: add generic support for built-in boot DTBs
In reply to Rob HerringQuoted 100 lines · Rob Herring
Quoted 39 lines · Masahiro Yamada
Some architectures embed boot DTBs in vmlinux. A potential issue for these architectures is a race condition during parallel builds because
Kbuilddescends intoarch/*/boot/dts/twice.One build thread is initiated by the 'dtbs' target, which is a prerequisite of the 'all' target in the top-level
Makefile:ifdef
CONFIG_OF_EARLY_FLATTREE
all: dtbs
endifFor architectures that support the embedded boot dtb,
arch/*/boot/dts/is visited also during the ordinary directory traversal in order to build obj-y objects that wrap DTBs.Since these build threads are unaware of each other, they can run simultaneously during parallel builds.
This commit introduces a generic build rule to
scripts/Makefile.vmlinuxto support embedded boot DTBs in a race-free way. Architectures that want to use this rule need to selectCONFIG_GENERIC_BUILTIN_DTB.After the migration, Makefiles under
arch/*/boot/dts/will be visited only once to build only *.dtb files.This change also aims to unify the CONFIG options used for embedded DTBs support. Currently, different architectures use different CONFIG options for the same purposes.
The CONFIG options are unified as follows:
-
CONFIG_GENERIC_BUILTIN_DTBThis enables the generic rule for embedded boot DTBs. This will be renamed to
CONFIG_BUILTIN_DTBafter all architectures migrate to the generic rule.-
CONFIG_BUILTIN_DTB_NAMEQuoted 7 lines
This specifies the path to the embedded DTB.
(relative toarch/*/boot/dts/)-
CONFIG_BUILTIN_DTB_ALLIf this is enabled, all DTB files compiled under
arch/*/boot/dts/are embedded into vmlinux. Only used by MIPS.I started to do this a long time ago, but then decided we didn't want to encourage this feature. IMO it should only be for legacy bootloaders or development/debug. And really, appended DTB is more flexible for the legacy bootloader case.
In hindsight, a common config would have been easier to limit new arches...
Quoted 43 lines
Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 7 ++++++- drivers/of/Kconfig | 6 ++++++ scripts/Makefile.vmlinux | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/link-vmlinux.sh | 4 ++++ 4 files changed, 60 insertions(+), 1 deletion(-)Makefile +6
-1@@ -1417,6 +1417,10 @@ ifdef CONFIG_OF_EARLY_FLATTREE all: dtbs endif +ifdef CONFIG_GENERIC_BUILTIN_DTB +vmlinux: dtbs +endif + endif PHONY += scripts_dtc@@ -1483,7 +1487,8 @@ endif # CONFIG_MODULES CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ compile_commands.json rust/test \ - rust-project.json .vmlinux.objs .vmlinux.export.c + rust-project.json .vmlinux.objs .vmlinux.export.c \ + .builtin-dtbs-list .builtin-dtb.S # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \drivers/of/Kconfig +0
-0@@ -2,6 +2,12 @@ config DTC bool
Quoted 8 lines
drivers/of/Kconfig line 6
Quoted 2 lines
drivers/of/Kconfig +2
-0+config GENERIC_BUILTIN_DTB + boolSo that we don't add new architectures to this, I would like something like:
# Do not add new architectures to this list
depends on MIPS || RISCV || MICROBLAZE ...
This will not work after 14/15 is applied.
For example, if arch/arm/Kconfig has
config BUILTIN_DTB
bool "enable BUILTIN_DTB"
No warning is displayed.
Signature · 2 lines
Best Regards Masahiro Yamada