Skip to content

Commit eb90b4f

Browse files
committed
Merge branch 'dt/dtc-sync' into dt/next
2 parents 9183908 + ce88c9c commit eb90b4f

22 files changed

+372
-237
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*.c.[012]*.*
1919
*.dt.yaml
2020
*.dtb
21+
*.dtbo
2122
*.dtb.S
2223
*.dwo
2324
*.elf

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,9 @@ ifneq ($(dtstree),)
13371337
%.dtb: include/config/kernel.release scripts_dtc
13381338
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
13391339

1340+
%.dtbo: include/config/kernel.release scripts_dtc
1341+
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
1342+
13401343
PHONY += dtbs dtbs_install dtbs_check
13411344
dtbs: include/config/kernel.release scripts_dtc
13421345
$(Q)$(MAKE) $(build)=$(dtstree)
@@ -1816,7 +1819,7 @@ clean: $(clean-dirs)
18161819
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
18171820
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
18181821
-o -name '*.ko.*' \
1819-
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
1822+
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
18201823
-o -name '*.dwo' -o -name '*.lst' \
18211824
-o -name '*.su' -o -name '*.mod' \
18221825
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \

scripts/Makefile.dtbinst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ quiet_cmd_dtb_install = INSTALL $@
2929
$(dst)/%.dtb: $(obj)/%.dtb
3030
$(call cmd,dtb_install)
3131

32+
$(dst)/%.dtbo: $(obj)/%.dtbo
33+
$(call cmd,dtb_install)
34+
3235
PHONY += $(subdirs)
3336
$(subdirs):
3437
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)

scripts/Makefile.lib

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
8686

8787
ifneq ($(CHECK_DTBS),)
8888
extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
89+
extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y))
8990
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
91+
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-))
9092
endif
9193

9294
# Add subdir path
@@ -327,6 +329,9 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
327329
$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
328330
$(call if_changed_dep,dtc)
329331

332+
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
333+
$(call if_changed_dep,dtc)
334+
330335
DT_CHECKER ?= dt-validate
331336
DT_BINDING_DIR := Documentation/devicetree/bindings
332337
# DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile

scripts/dtc/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# SPDX-License-Identifier: GPL-2.0
22
# scripts/dtc makefile
33

4-
hostprogs-always-$(CONFIG_DTC) += dtc
4+
hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay
55
hostprogs-always-$(CHECK_DT_BINDING) += dtc
66

77
dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
88
srcpos.o checks.o util.o
99
dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
1010

11+
# The upstream project builds libfdt as a separate library. We are choosing to
12+
# instead directly link the libfdt object files into fdtoverlay.
13+
libfdt-objs := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
14+
libfdt = $(addprefix libfdt/,$(libfdt-objs))
15+
fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o
16+
1117
# Source files need to get at the userspace version of libfdt_env.h to compile
1218
HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
1319

scripts/dtc/data.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ void data_free(struct data d)
2121
free(d.val);
2222
}
2323

24-
struct data data_grow_for(struct data d, int xlen)
24+
struct data data_grow_for(struct data d, unsigned int xlen)
2525
{
2626
struct data nd;
27-
int newsize;
27+
unsigned int newsize;
2828

2929
if (xlen == 0)
3030
return d;
@@ -84,7 +84,7 @@ struct data data_copy_file(FILE *f, size_t maxlen)
8484
while (!feof(f) && (d.len < maxlen)) {
8585
size_t chunksize, ret;
8686

87-
if (maxlen == -1)
87+
if (maxlen == (size_t)-1)
8888
chunksize = 4096;
8989
else
9090
chunksize = maxlen - d.len;

scripts/dtc/dtc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
122122
return "dts";
123123
if (!strcasecmp(s, ".yaml"))
124124
return "yaml";
125+
if (!strcasecmp(s, ".dtbo"))
126+
return "dtb";
125127
if (!strcasecmp(s, ".dtb"))
126128
return "dtb";
127129
return fallback;
@@ -357,6 +359,8 @@ int main(int argc, char *argv[])
357359
#endif
358360
} else if (streq(outform, "dtb")) {
359361
dt_to_blob(outf, dti, outversion);
362+
} else if (streq(outform, "dtbo")) {
363+
dt_to_blob(outf, dti, outversion);
360364
} else if (streq(outform, "asm")) {
361365
dt_to_asm(outf, dti, outversion);
362366
} else if (streq(outform, "null")) {

scripts/dtc/dtc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ extern const char *markername(enum markertype markertype);
105105

106106
struct marker {
107107
enum markertype type;
108-
int offset;
108+
unsigned int offset;
109109
char *ref;
110110
struct marker *next;
111111
};
112112

113113
struct data {
114-
int len;
114+
unsigned int len;
115115
char *val;
116116
struct marker *markers;
117117
};
@@ -129,7 +129,7 @@ size_t type_marker_length(struct marker *m);
129129

130130
void data_free(struct data d);
131131

132-
struct data data_grow_for(struct data d, int xlen);
132+
struct data data_grow_for(struct data d, unsigned int xlen);
133133

134134
struct data data_copy_mem(const char *mem, int len);
135135
struct data data_copy_escape_string(const char *s, int len);
@@ -253,7 +253,7 @@ void append_to_property(struct node *node,
253253
const char *get_unitname(struct node *node);
254254
struct property *get_property(struct node *node, const char *propname);
255255
cell_t propval_cell(struct property *prop);
256-
cell_t propval_cell_n(struct property *prop, int n);
256+
cell_t propval_cell_n(struct property *prop, unsigned int n);
257257
struct property *get_property_by_label(struct node *tree, const char *label,
258258
struct node **node);
259259
struct marker *get_marker_label(struct node *tree, const char *label,

scripts/dtc/fdtdump.c

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)