Merge branch 'dt/dtbo-rename' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux into soc/dt
* 'dt/dtbo-rename' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: kbuild: Cleanup DT Overlay intermediate files as appropriate staging: pi433: overlay: Rename overlay source file from .dts to .dtso of: overlay: rename overlay source files from .dts to .dtso kbuild: Allow DTB overlays to built into .dtbo.S files kbuild: Allow DTB overlays to built from .dtso named source files Link: https://lore.kernel.org/r/20221118211103.GA1334449-robh@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
cdd1db7660
|
@ -20,6 +20,7 @@
|
|||
*.dtb
|
||||
*.dtbo
|
||||
*.dtb.S
|
||||
*.dtbo.S
|
||||
*.dwo
|
||||
*.elf
|
||||
*.gcno
|
||||
|
|
4
Makefile
4
Makefile
|
@ -2001,7 +2001,9 @@ clean: $(clean-dirs)
|
|||
@find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
|
||||
\( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
|
||||
-o -name '*.ko.*' \
|
||||
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
||||
-o -name '*.dtb' -o -name '*.dtbo' \
|
||||
-o -name '*.dtb.S' -o -name '*.dtbo.S' \
|
||||
-o -name '*.dt.yaml' \
|
||||
-o -name '*.dwo' -o -name '*.lst' \
|
||||
-o -name '*.su' -o -name '*.mod' -o -name '*.usyms' \
|
||||
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-y += testcases.dtb.o
|
||||
obj-y += testcases.dtbo.o
|
||||
|
||||
obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
|
||||
overlay_0.dtb.o \
|
||||
overlay_1.dtb.o \
|
||||
overlay_2.dtb.o \
|
||||
overlay_3.dtb.o \
|
||||
overlay_4.dtb.o \
|
||||
overlay_5.dtb.o \
|
||||
overlay_6.dtb.o \
|
||||
overlay_7.dtb.o \
|
||||
overlay_8.dtb.o \
|
||||
overlay_9.dtb.o \
|
||||
overlay_10.dtb.o \
|
||||
overlay_11.dtb.o \
|
||||
overlay_12.dtb.o \
|
||||
overlay_13.dtb.o \
|
||||
overlay_15.dtb.o \
|
||||
overlay_16.dtb.o \
|
||||
overlay_17.dtb.o \
|
||||
overlay_18.dtb.o \
|
||||
overlay_19.dtb.o \
|
||||
overlay_20.dtb.o \
|
||||
overlay_bad_add_dup_node.dtb.o \
|
||||
overlay_bad_add_dup_prop.dtb.o \
|
||||
overlay_bad_phandle.dtb.o \
|
||||
overlay_bad_symbol.dtb.o \
|
||||
overlay_base.dtb.o \
|
||||
overlay_gpio_01.dtb.o \
|
||||
overlay_gpio_02a.dtb.o \
|
||||
overlay_gpio_02b.dtb.o \
|
||||
overlay_gpio_03.dtb.o \
|
||||
overlay_gpio_04a.dtb.o \
|
||||
overlay_gpio_04b.dtb.o
|
||||
obj-$(CONFIG_OF_OVERLAY) += overlay.dtbo.o \
|
||||
overlay_0.dtbo.o \
|
||||
overlay_1.dtbo.o \
|
||||
overlay_2.dtbo.o \
|
||||
overlay_3.dtbo.o \
|
||||
overlay_4.dtbo.o \
|
||||
overlay_5.dtbo.o \
|
||||
overlay_6.dtbo.o \
|
||||
overlay_7.dtbo.o \
|
||||
overlay_8.dtbo.o \
|
||||
overlay_9.dtbo.o \
|
||||
overlay_10.dtbo.o \
|
||||
overlay_11.dtbo.o \
|
||||
overlay_12.dtbo.o \
|
||||
overlay_13.dtbo.o \
|
||||
overlay_15.dtbo.o \
|
||||
overlay_16.dtbo.o \
|
||||
overlay_17.dtbo.o \
|
||||
overlay_18.dtbo.o \
|
||||
overlay_19.dtbo.o \
|
||||
overlay_20.dtbo.o \
|
||||
overlay_bad_add_dup_node.dtbo.o \
|
||||
overlay_bad_add_dup_prop.dtbo.o \
|
||||
overlay_bad_phandle.dtbo.o \
|
||||
overlay_bad_symbol.dtbo.o \
|
||||
overlay_base.dtbo.o \
|
||||
overlay_gpio_01.dtbo.o \
|
||||
overlay_gpio_02a.dtbo.o \
|
||||
overlay_gpio_02b.dtbo.o \
|
||||
overlay_gpio_03.dtbo.o \
|
||||
overlay_gpio_04a.dtbo.o \
|
||||
overlay_gpio_04b.dtbo.o
|
||||
|
||||
# enable creation of __symbols__ node
|
||||
DTC_FLAGS_overlay += -@
|
||||
|
|
|
@ -1423,12 +1423,12 @@ static int __init unittest_data_add(void)
|
|||
void *unittest_data_align;
|
||||
struct device_node *unittest_data_node = NULL, *np;
|
||||
/*
|
||||
* __dtb_testcases_begin[] and __dtb_testcases_end[] are magically
|
||||
* created by cmd_dt_S_dtb in scripts/Makefile.lib
|
||||
* __dtbo_testcases_begin[] and __dtbo_testcases_end[] are magically
|
||||
* created by cmd_dt_S_dtbo in scripts/Makefile.lib
|
||||
*/
|
||||
extern uint8_t __dtb_testcases_begin[];
|
||||
extern uint8_t __dtb_testcases_end[];
|
||||
const int size = __dtb_testcases_end - __dtb_testcases_begin;
|
||||
extern uint8_t __dtbo_testcases_begin[];
|
||||
extern uint8_t __dtbo_testcases_end[];
|
||||
const int size = __dtbo_testcases_end - __dtbo_testcases_begin;
|
||||
int rc;
|
||||
void *ret;
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ static int __init unittest_data_add(void)
|
|||
return -ENOMEM;
|
||||
|
||||
unittest_data_align = PTR_ALIGN(unittest_data, FDT_ALIGN_SIZE);
|
||||
memcpy(unittest_data_align, __dtb_testcases_begin, size);
|
||||
memcpy(unittest_data_align, __dtbo_testcases_begin, size);
|
||||
|
||||
ret = of_fdt_unflatten_tree(unittest_data_align, NULL, &unittest_data_node);
|
||||
if (!ret) {
|
||||
|
@ -3003,24 +3003,24 @@ static inline void __init of_unittest_overlay(void) { }
|
|||
#ifdef CONFIG_OF_OVERLAY
|
||||
|
||||
/*
|
||||
* __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb
|
||||
* in scripts/Makefile.lib
|
||||
* __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are
|
||||
* created by cmd_dt_S_dtbo in scripts/Makefile.lib
|
||||
*/
|
||||
|
||||
#define OVERLAY_INFO_EXTERN(name) \
|
||||
extern uint8_t __dtb_##name##_begin[]; \
|
||||
extern uint8_t __dtb_##name##_end[]
|
||||
#define OVERLAY_INFO_EXTERN(overlay_name) \
|
||||
extern uint8_t __dtbo_##overlay_name##_begin[]; \
|
||||
extern uint8_t __dtbo_##overlay_name##_end[]
|
||||
|
||||
#define OVERLAY_INFO(overlay_name, expected) \
|
||||
{ .dtb_begin = __dtb_##overlay_name##_begin, \
|
||||
.dtb_end = __dtb_##overlay_name##_end, \
|
||||
.expected_result = expected, \
|
||||
.name = #overlay_name, \
|
||||
#define OVERLAY_INFO(overlay_name, expected) \
|
||||
{ .dtbo_begin = __dtbo_##overlay_name##_begin, \
|
||||
.dtbo_end = __dtbo_##overlay_name##_end, \
|
||||
.expected_result = expected, \
|
||||
.name = #overlay_name, \
|
||||
}
|
||||
|
||||
struct overlay_info {
|
||||
uint8_t *dtb_begin;
|
||||
uint8_t *dtb_end;
|
||||
uint8_t *dtbo_begin;
|
||||
uint8_t *dtbo_end;
|
||||
int expected_result;
|
||||
int ovcs_id;
|
||||
char *name;
|
||||
|
@ -3094,7 +3094,7 @@ static struct overlay_info overlays[] = {
|
|||
OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
|
||||
OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
|
||||
/* end marker */
|
||||
{.dtb_begin = NULL, .dtb_end = NULL, .expected_result = 0, .name = NULL}
|
||||
{.dtbo_begin = NULL, .dtbo_end = NULL, .expected_result = 0, .name = NULL}
|
||||
};
|
||||
|
||||
static struct device_node *overlay_base_root;
|
||||
|
@ -3151,13 +3151,13 @@ void __init unittest_unflatten_overlay_base(void)
|
|||
return;
|
||||
}
|
||||
|
||||
data_size = info->dtb_end - info->dtb_begin;
|
||||
data_size = info->dtbo_end - info->dtbo_begin;
|
||||
if (!data_size) {
|
||||
pr_err("No dtb 'overlay_base' to attach\n");
|
||||
return;
|
||||
}
|
||||
|
||||
size = fdt_totalsize(info->dtb_begin);
|
||||
size = fdt_totalsize(info->dtbo_begin);
|
||||
if (size != data_size) {
|
||||
pr_err("dtb 'overlay_base' header totalsize != actual size");
|
||||
return;
|
||||
|
@ -3169,7 +3169,7 @@ void __init unittest_unflatten_overlay_base(void)
|
|||
return;
|
||||
}
|
||||
|
||||
memcpy(new_fdt, info->dtb_begin, size);
|
||||
memcpy(new_fdt, info->dtbo_begin, size);
|
||||
|
||||
__unflatten_device_tree(new_fdt, NULL, &overlay_base_root,
|
||||
dt_alloc_memory, true);
|
||||
|
@ -3204,11 +3204,11 @@ static int __init overlay_data_apply(const char *overlay_name, int *ovcs_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
size = info->dtb_end - info->dtb_begin;
|
||||
size = info->dtbo_end - info->dtbo_begin;
|
||||
if (!size)
|
||||
pr_err("no overlay data for %s\n", overlay_name);
|
||||
|
||||
ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->ovcs_id);
|
||||
ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id);
|
||||
if (ovcs_id)
|
||||
*ovcs_id = info->ovcs_id;
|
||||
if (ret < 0)
|
||||
|
|
|
@ -48,13 +48,13 @@ For Raspbian users only
|
|||
=======================
|
||||
Since Raspbian supports device tree overlays, you may use an overlay instead
|
||||
of editing your boards device tree.
|
||||
To use the overlay, you need to compile the file pi433-overlay.dts which can
|
||||
To use the overlay, you need to compile the file pi433-overlay.dtso which can
|
||||
be found alongside this documentation.
|
||||
The file needs to be compiled - either manually or by integration in your kernel
|
||||
source tree. For a manual compile, you may use a command line like the following:
|
||||
'linux/scripts/dtc/dtc -@ -I dts -O dtb -o pi433.dtbo pi433-overlay.dts'
|
||||
'linux/scripts/dtc/dtc -@ -I dts -O dtb -o pi433.dtbo pi433-overlay.dtso'
|
||||
|
||||
For compiling inside of the kernel tree, you need to copy pi433-overlay.dts to
|
||||
For compiling inside of the kernel tree, you need to copy pi433-overlay.dtso to
|
||||
arch/arm/boot/dts/overlays and you need to add the file to the list of files
|
||||
in the Makefile over there. Execute 'make dtbs' in kernel tree root to make the
|
||||
kernel make files compile the device tree overlay for you.
|
||||
|
|
|
@ -468,10 +468,12 @@ intermediate_targets = $(foreach sfx, $(2), \
|
|||
$(filter %$(strip $(1)), $(targets))))
|
||||
# %.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)
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
|
|||
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= DTB $@
|
||||
quiet_cmd_dt_S_dtb= DTBS $@
|
||||
cmd_dt_S_dtb= \
|
||||
{ \
|
||||
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
||||
|
@ -375,6 +375,24 @@ cmd_dt_S_dtb= \
|
|||
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
|
||||
$(call if_changed,dt_S_dtb)
|
||||
|
||||
# Generate an assembly file to wrap the output of the device tree compiler
|
||||
quiet_cmd_dt_S_dtbo= DTBOS $@
|
||||
cmd_dt_S_dtbo= \
|
||||
{ \
|
||||
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
||||
echo '.section .dtb.init.rodata,"a"'; \
|
||||
echo '.balign STRUCT_ALIGNMENT'; \
|
||||
echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
|
||||
echo '__dtbo_$(subst -,_,$(*F))_begin:'; \
|
||||
echo '.incbin "$<" '; \
|
||||
echo '__dtbo_$(subst -,_,$(*F))_end:'; \
|
||||
echo '.global __dtbo_$(subst -,_,$(*F))_end'; \
|
||||
echo '.balign STRUCT_ALIGNMENT'; \
|
||||
} > $@
|
||||
|
||||
$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
|
||||
$(call if_changed,dt_S_dtbo)
|
||||
|
||||
quiet_cmd_dtc = DTC $@
|
||||
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
||||
$(DTC) -o $@ -b 0 \
|
||||
|
@ -408,6 +426,9 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
|
|||
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
|
||||
$(call if_changed_dep,dtc)
|
||||
|
||||
$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
|
||||
$(call if_changed_dep,dtc)
|
||||
|
||||
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
|
||||
|
||||
# Bzip2
|
||||
|
|
Loading…
Reference in New Issue