Skip to contentSkip to conversation

dts: re-write dts/Makefile more simply with Kbuild

PATCH Superseded Masahiro Yamada 2 participants 5 messages Jan 30, 2014 – Feb 18, 2014

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

---

This patch uses my Kbuild series as a prerequisite. "Switch over to real Kbuild" series must be applied beforehand.

 .gitignore                  |  1 -
 Makefile                    | 16 +++++-----
 arch/arm/lib/board.c        |  2 +-
 arch/microblaze/lib/board.c |  2 +-
 arch/x86/lib/init_helpers.c |  2 +-
 common/board_f.c            |  2 +-
 dts/.gitignore              |  2 ++
 dts/Makefile                | 72 +++++++++++++--------------------------------
 include/common.h            |  2 +-
 scripts/Makefile.lib        | 12 ++++----
 10 files changed, 41 insertions(+), 72 deletions(-)
 create mode 100644 dts/.gitignore
.gitignore +0 -1
index 24019b3..5882ff5 100644
@@ -48,7 +48,6 @@
 /u-boot.lds
 /u-boot.ubl
 /u-boot.ais
-/u-boot.dtb
 /u-boot.sb
 
 #
Makefile +8 -8
index 3bf759a..ab82ed4 100644
@@ -743,7 +743,7 @@ ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
 ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
-ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
 endif
@@ -767,11 +767,11 @@ endif
 
 all:		$(ALL-y)
 
-u-boot.dtb:	checkdtc u-boot
-		$(MAKE) $(build)=dts binary
-		mv dts/dt.dtb $@
+PHONY += dtbs
+dtbs dts/dt.dtb: checkdtc u-boot
+	$(Q)$(MAKE) $(build)=dts dtbs
 
-u-boot-dtb.bin:	u-boot.bin u-boot.dtb
+u-boot-dtb.bin: u-boot.bin dts/dt.dtb
 		cat $^ >$@
 
 u-boot.hex:	u-boot
@@ -898,8 +898,8 @@ u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
 		rm spl/u-boot-spl-pad.bin
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
-u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb
-		cat u-boot-nodtb-tegra.bin u-boot.dtb > $@
+u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb
+		cat $^ > $@
 endif
 endif
 
@@ -1184,7 +1184,7 @@ CLOBBER_DIRS  += tpl \
 			$(shell ls -1 --file-type spl 2>/dev/null))))
 CLOBBER_FILES += u-boot u-boot.elf u-boot.hex u-boot.img  \
 		 u-boot.kwb u-boot.pbl u-boot.ldr \
-		 u-boot.ubl u-boot.ais u-boot.dtb \
+		 u-boot.ubl u-boot.ais \
 		 u-boot.sb u-boot.spr MLO MLO.byteswap SPL \
 		 $(patsubst %,spl/%, $(filter-out Makefile %/, \
 			$(shell ls -1 --file-type spl 2>/dev/null))) \
arch/arm/lib/board.c +1 -1
index b770e25..c8cb049 100644
@@ -280,7 +280,7 @@ void board_init_f(ulong bootflag)
 	gd->mon_len = _bss_end_ofs;
 #ifdef CONFIG_OF_EMBED
 	/* Get a pointer to the FDT */
-	gd->fdt_blob = _binary_dt_dtb_start;
+	gd->fdt_blob = __dtb_db_begin
 #elif defined CONFIG_OF_SEPARATE
 	/* FDT is at end of image */
 	gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
arch/microblaze/lib/board.c +1 -1
index 896e73a..0f10c88 100644
@@ -76,7 +76,7 @@ void board_init_f(ulong not_used)
 
 #ifdef CONFIG_OF_EMBED
 	/* Get a pointer to the FDT */
-	gd->fdt_blob = _binary_dt_dtb_start;
+	gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
 	/* FDT is at end of image */
 	gd->fdt_blob = (void *)__end;
arch/x86/lib/init_helpers.c +1 -1
index 582c0ff..b5d937f 100644
@@ -92,7 +92,7 @@ int find_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
 	/* Get a pointer to the FDT */
-	gd->fdt_blob = _binary_dt_dtb_start;
+	gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
 	/* FDT is at end of image */
 	gd->fdt_blob = (ulong *)&_end;
common/board_f.c +1 -1
index aa70c3e..d0ee6f7 100644
@@ -360,7 +360,7 @@ static int setup_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
 	/* Get a pointer to the FDT */
-	gd->fdt_blob = _binary_dt_dtb_start;
+	gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
 	/* FDT is at end of image */
 # ifdef CONFIG_SYS_SYM_OFFSETS
dts/.gitignore new file +2 -0
new file mode 100644
index 0000000..1b37180
@@ -0,0 +1,2 @@
+*.dtb
+*.dtb.S
dts/Makefile +20 -52

84 lines not on this page · raw message

include/common.h +1 -1
index c15e5a4..b590f3a 100644
@@ -302,7 +302,7 @@ int	checkdram     (void);
 int	last_stage_init(void);
 extern ulong monitor_flash_len;
 int mac_read_from_eeprom(void);
-extern u8 _binary_dt_dtb_start[];	/* embedded device tree blob */
+extern u8 __dtb_dt_begin[];	/* embedded device tree blob */
 int set_cpu_clk_info(void);
 int print_cpuinfo(void);
 int update_flash_size(int flash_size);
scripts/Makefile.lib +6 -6
index d4b5cb5..ee3ceac 100644
@@ -151,9 +151,10 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
+# Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
-		 -I$(srctree)/arch/$(SRCARCH)/boot/dts                   \
-		 -I$(srctree)/arch/$(SRCARCH)/boot/dts/include           \
+		 -I$(srctree)/board/$(VENDOR)/dts/                       \
+		 -I$(srctree)/arch/$(ARCH)/dts                           \
 		 -undef -D__DTS__
 
 # Finds the multi-part object the current object will be linked into
@@ -247,25 +248,24 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
 
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@
+# Modified for U-Boot
 cmd_dt_S_dtb=						\
 (							\
-	echo '\#include <asm-generic/vmlinux.lds.h>'; 	\
 	echo '.section .dtb.init.rodata,"a"';		\
-	echo '.balign STRUCT_ALIGNMENT';		\
 	echo '.global __dtb_$(*F)_begin';		\
 	echo '__dtb_$(*F)_begin:';			\
 	echo '.incbin "$<" ';				\
 	echo '__dtb_$(*F)_end:';			\
 	echo '.global __dtb_$(*F)_end';			\
-	echo '.balign STRUCT_ALIGNMENT'; 		\
 ) > $@
 
 $(obj)/%.dtb.S: $(obj)/%.dtb
 	$(call cmd,dt_S_dtb)
 
 quiet_cmd_dtc = DTC     $@
+# Modified for U-Boot
 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
-	$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
+	dtc -O dtb -o $@ -b 0 \
 		-i $(dir $<) $(DTC_FLAGS) \
 		-d $(depfile).dtc.tmp $(dtc-tmp) ; \
 	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 dts: re-write dts/Makefile more simply with Kbuild

Hi Masahiro,

Quoted 6 lines · Masahiro Yamada

Useful rules in scripts/Makefile.lib allows us to easily generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

Great, another benefit from the Kbuild changes!

Quoted 24 lines

---

This patch uses my Kbuild series as a prerequisite. "Switch over to real Kbuild" series must be applied beforehand.

 .gitignore                  |  1 -
 Makefile                    | 16 +++++-----
 arch/arm/lib/board.c        |  2 +-
 arch/microblaze/lib/board.c |  2 +-
 arch/x86/lib/init_helpers.c |  2 +-
 common/board_f.c            |  2 +-
 dts/.gitignore              |  2 ++
 dts/Makefile                | 72 +++++++++++++--------------------------------
 include/common.h            |  2 +-
 scripts/Makefile.lib        | 12 ++++----
 10 files changed, 41 insertions(+), 72 deletions(-)
 create mode 100644 dts/.gitignore
.gitignore +0 -0
index 24019b3..5882ff5 100644

.gitignore line 51

Quoted 4 lines
.gitignore +0 -1
@@ -48,7 +48,6 @@
 /u-boot.lds
 /u-boot.ubl
 /u-boot.ais
-/u-boot.dtb

I think we should still generate this file in the root directory, since some build systems will need to use it.

Ultimately we should support generating multiple .dtbs with the U-Boot build system. I will see if I have a patch for that somewhere...

Quoted 57 lines
.gitignore +0 -0
 /u-boot.sb
 
 #
Makefile +8 -8
index 3bf759a..ab82ed4 100644
@@ -743,7 +743,7 @@ ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
 ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
-ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
 endif
@@ -767,11 +767,11 @@ endif
 
 all:           $(ALL-y)
 
-u-boot.dtb:    checkdtc u-boot
-               $(MAKE) $(build)=dts binary
-               mv dts/dt.dtb $@
+PHONY += dtbs
+dtbs dts/dt.dtb: checkdtc u-boot
+       $(Q)$(MAKE) $(build)=dts dtbs
 
-u-boot-dtb.bin:        u-boot.bin u-boot.dtb
+u-boot-dtb.bin: u-boot.bin dts/dt.dtb
                cat $^ >$@
 
 u-boot.hex:    u-boot
@@ -898,8 +898,8 @@ u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
                rm spl/u-boot-spl-pad.bin
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
-u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb
-               cat u-boot-nodtb-tegra.bin u-boot.dtb > $@
+u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb
+               cat $^ > $@
 endif
 endif
 
@@ -1184,7 +1184,7 @@ CLOBBER_DIRS  += tpl \
                        $(shell ls -1 --file-type spl 2>/dev/null))))
 CLOBBER_FILES += u-boot u-boot.elf u-boot.hex u-boot.img  \
                 u-boot.kwb u-boot.pbl u-boot.ldr \
-                u-boot.ubl u-boot.ais u-boot.dtb \
+                u-boot.ubl u-boot.ais \
                 u-boot.sb u-boot.spr MLO MLO.byteswap SPL \
                 $(patsubst %,spl/%, $(filter-out Makefile %/, \
                        $(shell ls -1 --file-type spl 2>/dev/null))) \
arch/arm/lib/board.c +0 -0
index b770e25..c8cb049 100644

arch/arm/lib/board.c void board_init_f(ulong bootflag) · line 283

Quoted 5 lines
arch/arm/lib/board.c +1 -1
@@ -280,7 +280,7 @@ void board_init_f(ulong bootflag)
        gd->mon_len = _bss_end_ofs;
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_db_begin

Needs ; on the end I think.

Quoted 199 lines
arch/arm/lib/board.c +0 -0
 #elif defined CONFIG_OF_SEPARATE
        /* FDT is at end of image */
        gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
arch/microblaze/lib/board.c +1 -1
index 896e73a..0f10c88 100644
@@ -76,7 +76,7 @@ void board_init_f(ulong not_used)
 
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
        /* FDT is at end of image */
        gd->fdt_blob = (void *)__end;
arch/x86/lib/init_helpers.c +1 -1
index 582c0ff..b5d937f 100644
@@ -92,7 +92,7 @@ int find_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
        /* FDT is at end of image */
        gd->fdt_blob = (ulong *)&_end;
common/board_f.c +1 -1
index aa70c3e..d0ee6f7 100644
@@ -360,7 +360,7 @@ static int setup_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_dt_begin;
 #elif defined CONFIG_OF_SEPARATE
        /* FDT is at end of image */
 # ifdef CONFIG_SYS_SYM_OFFSETS
dts/.gitignore new file +2 -0
new file mode 100644
index 0000000..1b37180
@@ -0,0 +1,2 @@
+*.dtb
+*.dtb.S
dts/Makefile +20 -52
index 1e7609a..c47fba7 100644
@@ -7,64 +7,32 @@
 # This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
 # enabled. See doc/README.fdt-control for more details.
 
-DTS_INCDIRS =  $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
-DTS_INCDIRS += $(SRCTREE)/board/$(VENDOR)/dts
-DTS_INCDIRS += $(SRCTREE)/arch/$(ARCH)/dts
+DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
+ifeq ($(DEVICE_TREE),)
+DEVICE_TREE := notfound
+endif
 
-DTS_CPPFLAGS := -x assembler-with-cpp -undef -D__DTS__ \
-               -nostdinc $(addprefix -I,$(DTS_INCDIRS))
+DTS := $(srctree)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
 
-DTC_FLAGS := -R 4 -p 0x1000 \
-       $(addprefix -i ,$(DTS_INCDIRS))
+DTC_FLAGS += -i $(srctree)/arch/$(ARCH)/dts -R 4 -p 0x1000
 
-# Use a constant name for this so we can access it from C code.
-# objcopy doesn't seem to allow us to set the symbol name independently of
-# the filename.
-DT_BIN := $(obj)/dt.dtb
+$(obj)/dt.dtb: $(DTS) FORCE
+       $(call if_changed_dep,dtc)
 
-DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
-ifeq ($(DEVICE_TREE),)
-$(DT_BIN): FORCE
-       echo >&2 "Please define CONFIG_DEFAULT_DEVICE_TREE in your board header file"
-else
-$(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
-       $(CPP) $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
-       $(DTC) $(DTC_FLAGS) -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
-endif
+targets += dt.dtb
 
-process_lds = \
-       $(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'
+$(DTS):
+       @echo >&2
+       @echo >&2 "Device Tree Source is not specified."
+       @echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'"
+       @echo >&2 "or build with 'DEVICE_TREE=<dts-file-name>' argument"
+       @/bin/false
 
-# Run the compiler and get the link script from the linker
-GET_LDS = $(CC) $(c_flags) $(ld_flags) -Wl,--verbose 2>&1
+.SECONDARY: $(obj)/dt.dtb.S
 
-$(obj)/dt.o: $(DT_BIN)
-       # We want the output format and arch.
-       # We also hope to win a prize for ugliest Makefile / shell interaction
-       # We look in the LDSCRIPT first.
-       # Then try the linker which should give us the answer.
-       # Then check it worked.
-       [ -n "$(LDSCRIPT)" ] && \
-               oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` && \
-               oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\
-       \
-       [ -z $${oformat} ] && \
-               oformat=`$(call process_lds,$(GET_LDS),FORMAT)` ;\
-       [ -z $${oarch} ] && \
-               oarch=`$(call process_lds,$(GET_LDS),ARCH)` ;\
-       \
-       [ -z $${oformat} ] && \
-               echo "Cannot read OUTPUT_FORMAT from lds file $(LDSCRIPT)" && \
-               exit 1 || true ;\
-       [ -z $${oarch} ] && \
-               echo "Cannot read OUTPUT_ARCH from lds file $(LDSCRIPT)" && \
-               exit 1 || true ;\
-       \
-       cd $(dir ${DT_BIN}) && \
-       $(OBJCOPY) -I binary -O $${oformat} -B $${oarch} \
-               $(notdir ${DT_BIN}) $(notdir $@)
-       rm $(DT_BIN)
+obj-$(CONFIG_OF_EMBED) := dt.dtb.o
 
-obj-$(CONFIG_OF_EMBED) := dt.o
+dtbs: $(obj)/dt.dtb
+       @:
 
-binary:        $(DT_BIN)
+clean-files := dt.dtb.S
include/common.h +1 -1
index c15e5a4..b590f3a 100644
@@ -302,7 +302,7 @@ int checkdram     (void);
 int    last_stage_init(void);
 extern ulong monitor_flash_len;
 int mac_read_from_eeprom(void);
-extern u8 _binary_dt_dtb_start[];      /* embedded device tree blob */
+extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
 int set_cpu_clk_info(void);
 int print_cpuinfo(void);
 int update_flash_size(int flash_size);
scripts/Makefile.lib +6 -7
index d4b5cb5..ee3ceac 100644
@@ -151,9 +151,10 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
+# Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
-                -I$(srctree)/arch/$(SRCARCH)/boot/dts                   \
-                -I$(srctree)/arch/$(SRCARCH)/boot/dts/include           \
+                -I$(srctree)/board/$(VENDOR)/dts/                       \
+                -I$(srctree)/arch/$(ARCH)/dts                           \
                 -undef -D__DTS__
 
 # Finds the multi-part object the current object will be linked into
@@ -247,25 +248,24 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
 
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@
+# Modified for U-Boot
 cmd_dt_S_dtb=                                          \
 (                                                      \
-       echo '\#include <asm-generic/vmlinux.lds.h>';   \
        echo '.section .dtb.init.rodata,"a"';           \
-       echo '.balign STRUCT_ALIGNMENT';                \
        echo '.global __dtb_$(*F)_begin';               \
        echo '__dtb_$(*F)_begin:';                      \
        echo '.incbin "$<" ';                           \
        echo '__dtb_$(*F)_end:';                        \
        echo '.global __dtb_$(*F)_end';                 \
-       echo '.balign STRUCT_ALIGNMENT';                \
 ) > $@
 
 $(obj)/%.dtb.S: $(obj)/%.dtb
        $(call cmd,dt_S_dtb)
 
 quiet_cmd_dtc = DTC     $@
+# Modified for U-Boot
 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
-       $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
+       dtc -O dtb -o $@ -b 0 \
                -i $(dir $<) $(DTC_FLAGS) \
                -d $(depfile).dtc.tmp $(dtc-tmp) ; \
        cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
--
Quoted 2 lines

1.8.3.2

Regards,
Simon

#2 lore raw

PATCH 1/1 dts: re-write dts/Makefile more simply with Kbuild

Hello Simon,

I saw the patch you posted
http://patchwork.ozlabs.org/patch/315846/
and I understood what you want to do.
(But I don't like to search similar device trees
with file name prefixes.)

Do you like ARM Linux style?

  dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
        exynos5250-snow.dtb \
        exynos5250-smdk5250.dtb \
        exynos5420-smdk5420.dtb

Please check v2.

Quoted 2 lines

I think we should still generate this file in the root directory, since some build systems will need to use it.

I vote for removal of ./u-boot.dts
because I do not want to have many copies.

If we adopt multiple DTBs generation, we will have three copies:
- arch/arm/dts/exynosXXX.dtb
- dts/dt.dtb
- ./u-boot.dtb

But, if you really need a DTB at the top directory, I can revive u-boot.dtb at version 3.

Quoted 11 lines

arch/arm/lib/board.c void board_init_f(ulong bootflag) · line 283

Quoted 8 lines
arch/arm/lib/board.c +1 -1
@@ -280,7 +280,7 @@ void board_init_f(ulong bootflag)
        gd->mon_len = _bss_end_ofs;
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_db_begin

Needs ; on the end I think.

Good catch!
I fixed it at v2. Thanks.

Best Regards
Masahiro Yamada

#3 lore raw

PATCH 1/1 dts: re-write dts/Makefile more simply with Kbuild

Hi Masahiro,

Quoted 9 lines · Masahiro Yamada

Hello Simon,

I saw the patch you posted
http://patchwork.ozlabs.org/patch/315846/
and I understood what you want to do.
(But I don't like to search similar device trees
with file name prefixes.)

Quoted 7 lines

Do you like ARM Linux style?

  dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
        exynos5250-snow.dtb \
        exynos5250-smdk5250.dtb \
        exynos5420-smdk5420.dtb

Please check v2.

Agreed, I don't like the prefix idea either.

Quoted 7 lines
Quoted 4 lines

I think we should still generate this file in the root directory, since some build systems will need to use it.

I vote for removal of ./u-boot.dts
because I do not want to have many copies.

u-boot.dtb you mean?

Quoted 3 lines

If we adopt multiple DTBs generation, we will have three copies:
- arch/arm/dts/exynosXXX.dtb

This is the correct one

Quoted 1 line

- dts/dt.dtb

This is a temporary file, probably deleted during the build. I'm not even sure if it is created when you are building multiple files. Perhaps it use just used for CONFIG_OF_EMBED?

Quoted 4 lines

- ./u-boot.dtb

But, if you really need a DTB at the top directory, I can revive u-boot.dtb at version 3.

For now I think there is a 'default' .dtb for each board config. After all U-Boot does not have a way to select between several of them at runtime. So it makes sense for this one to be made available as it currently is I think. Perhaps it could be a symlink to the real one?

Quoted 14 lines
Quoted 13 lines

arch/arm/lib/board.c void board_init_f(ulong bootflag) · line 283

Quoted 10 lines
arch/arm/lib/board.c +1 -1
@@ -280,7 +280,7 @@ void board_init_f(ulong bootflag)
        gd->mon_len = _bss_end_ofs;
 #ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-       gd->fdt_blob = _binary_dt_dtb_start;
+       gd->fdt_blob = __dtb_db_begin

Needs ; on the end I think.

Quoted 8 lines

Good catch!
I fixed it at v2. Thanks.

Best Regards
Masahiro Yamada

Regards,
Simon

#4 lore raw

PATCH 1/1 dts: re-write dts/Makefile more simply with Kbuild

Hello Simon,

Quoted 4 lines
Quoted 2 lines

- dts/dt.dtb

This is a temporary file, probably deleted during the build.

No.
It is a temporary file, but it must not be deleted during the build. Otherwise, dts/dt.dtb will be re-generated at every build even when it shouldn't.

Quoted 3 lines

I'm not
even sure if it is created when you are building multiple files. Perhaps it use just used for CONFIG_OF_EMBED?

My patch is using dts/dt.dtb for both CONFIG_OF_EMBED and CONFIG_OF_SEPARTE.

If you don't want to generate dts/dt.dtb at all,
most of lines in dts/Makefile must be moved to the top Makefile, which leads we get the top Makefile fatter and dirtier.

Quoted 9 lines
Quoted 4 lines

- ./u-boot.dtb

But, if you really need a DTB at the top directory, I can revive u-boot.dtb at version 3.

For now I think there is a 'default' .dtb for each board config. After all U-Boot does not have a way to select between several of them at runtime. So it makes sense for this one to be made available as it currently is I think. Perhaps it could be a symlink to the real one?

Creating a symbolic link during the build is generally troublesome and a bad idea, I think.

Best Regards
Masahiro Yamada