Message ID | 1391567307-27434-2-git-send-email-yamada.m@jp.panasonic.com |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Hi, On 4 February 2014 19:28, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: > 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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Sorry I left comments on v2. Regards, Simon
On Wed, Feb 05, 2014 at 11:28:25AM +0900, Masahiro Yamada wrote: > 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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Applied to u-boot/master, thanks!
Hello Tom, Simon, On Wed, 19 Feb 2014 16:11:11 -0500 Tom Rini <trini@ti.com> wrote: > On Wed, Feb 05, 2014 at 11:28:25AM +0900, Masahiro Yamada wrote: > > > 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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. > > > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> > > Applied to u-boot/master, thanks! > > -- > Tom Ditto. Possibly it was missed because Simon and I were discussing in version 2 thread. > > > > > > Besides, dts/dt.dtb is a prerequisite of dts/dt.dtb.S > > > when CONFIG_OF_EMBED is enabled. > > > > > > I believe keeping dts/dt.dtb is reasonable enough. > > > > > > Better to keep both? > > > > Yes I think so. > > > OK. > I will revive ./u-boot.dtb and post a new version. > > And I will send it as a single patch > dropping 2/3 and 3/3. > Do you think it's better? > > Many kbuild-related patches are being stuck on patchwork > and my local branch is getting messed up. > I don't want to delay this patch any more. I was planning to post a new version. But before that, version 3 was applied. So, what should I do? Shall I post a follow-up patch to revive a device tree at the top directory (./u-boot.dtb) ? Best Regards Masahiro Yamada
On Thu, Feb 20, 2014 at 06:30:44PM +0900, Masahiro Yamada wrote: > Hello Tom, Simon, > > On Wed, 19 Feb 2014 16:11:11 -0500 > Tom Rini <trini@ti.com> wrote: > > > On Wed, Feb 05, 2014 at 11:28:25AM +0900, Masahiro Yamada wrote: > > > > > 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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. > > > > > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> > > > > Applied to u-boot/master, thanks! > > > > -- > > Tom > > > Ditto. > Possibly it was missed because Simon and I were discussing > in version 2 thread. > > > > > > > > > > Besides, dts/dt.dtb is a prerequisite of dts/dt.dtb.S > > > > when CONFIG_OF_EMBED is enabled. > > > > > > > > I believe keeping dts/dt.dtb is reasonable enough. > > > > > > > > Better to keep both? > > > > > > Yes I think so. > > > > > > OK. > > I will revive ./u-boot.dtb and post a new version. > > > > And I will send it as a single patch > > dropping 2/3 and 3/3. > > Do you think it's better? > > > > Many kbuild-related patches are being stuck on patchwork > > and my local branch is getting messed up. > > I don't want to delay this patch any more. > > > I was planning to post a new version. > But before that, version 3 was applied. > > So, what should I do? > Shall I post a follow-up patch to revive a > device tree at the top directory (./u-boot.dtb) ? heh, so this is what happens when I try and get ahead of the curve :) Just do a follow up to bring things into line with what you and Simon had agreed on.
On 02/04/2014 06:28 PM, Masahiro Yamada wrote: > 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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. > > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> > --- > > Changes in v3: None > Changes in v2: > - Rebase on Kbuild series v9 > - Add ';' which was missing in arch/arm/lib/board.c > <snip> > > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c > index b770e25..38b9c7d 100644 > --- a/arch/arm/lib/board.c > +++ b/arch/arm/lib/board.c > @@ -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; Is this a typo? I believe it should be __dtb_dt_begin. Did anyone see the compiling error? York
Hi York, > > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c > > index b770e25..38b9c7d 100644 > > --- a/arch/arm/lib/board.c > > +++ b/arch/arm/lib/board.c > > @@ -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; > > Is this a typo? I believe it should be __dtb_dt_begin. Did anyone see the > compiling error? Yes, it's a typo. I had already posted a patch. http://patchwork.ozlabs.org/patch/342815/ Even such a simple one has been waiting for more than one month in Patchwork queue. :-( For now, CONFIG_OF_EMBED is defined for MicroBlaze. I guess nobody saw the compile error. Best Regards Masahiro Yamada]
Hi, On 27 May 2014 18:54, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: > Hi York, > >> > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c >> > index b770e25..38b9c7d 100644 >> > --- a/arch/arm/lib/board.c >> > +++ b/arch/arm/lib/board.c >> > @@ -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; >> >> Is this a typo? I believe it should be __dtb_dt_begin. Did anyone see the >> compiling error? > > > Yes, it's a typo. > I had already posted a patch. > http://patchwork.ozlabs.org/patch/342815/ > > Even such a simple one has been waiting for more than one month > in Patchwork queue. > :-( > > For now, CONFIG_OF_EMBED is defined for MicroBlaze. > I guess nobody saw the compile error. I suspect all boards that use CONFIG_OF_CONTROL also use generic board now. I expect that this file will be deleted at the end of the year. Regards, Simon
On 06/01/2014 06:34 PM, Simon Glass wrote: > Hi, > > On 27 May 2014 18:54, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote: >> Hi York, >> >>>> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c >>>> index b770e25..38b9c7d 100644 >>>> --- a/arch/arm/lib/board.c >>>> +++ b/arch/arm/lib/board.c >>>> @@ -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; >>> >>> Is this a typo? I believe it should be __dtb_dt_begin. Did anyone see the >>> compiling error? >> >> >> Yes, it's a typo. >> I had already posted a patch. >> http://patchwork.ozlabs.org/patch/342815/ >> >> Even such a simple one has been waiting for more than one month >> in Patchwork queue. >> :-( >> >> For now, CONFIG_OF_EMBED is defined for MicroBlaze. >> I guess nobody saw the compile error. > > I suspect all boards that use CONFIG_OF_CONTROL also use generic board > now. I expect that this file will be deleted at the end of the year. No. Microblaze has no generic board support yet. For zynq I have sent patches out but they will be merged in the next merge window. Thanks, Michal
diff --git a/.gitignore b/.gitignore index 24019b3..5882ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ /u-boot.lds /u-boot.ubl /u-boot.ais -/u-boot.dtb /u-boot.sb # diff --git a/Makefile b/Makefile index cb9c243..b425bfb 100644 --- a/Makefile +++ b/Makefile @@ -722,7 +722,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 @@ -746,11 +746,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 @@ -877,8 +877,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 @@ -1173,7 +1173,7 @@ include/license.h: tools/bin2header COPYING # Directories & files removed with 'make clean' CLEAN_DIRS += $(MODVERDIR) CLEAN_FILES += u-boot.lds include/bmp_logo.h include/bmp_logo_data.h \ - board/*/config.tmp board/*/*/config.tmp dts/*.tmp \ + board/*/config.tmp board/*/*/config.tmp \ include/autoconf.mk* include/spl-autoconf.mk \ include/tpl-autoconf.mk diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index b770e25..38b9c7d 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -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); diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index 59956a8..fafeeae 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -87,7 +87,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; diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 582c0ff..b5d937f 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -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; diff --git a/common/board_f.c b/common/board_f.c index aa70c3e..d0ee6f7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -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 diff --git a/dts/.gitignore b/dts/.gitignore new file mode 100644 index 0000000..1b37180 --- /dev/null +++ b/dts/.gitignore @@ -0,0 +1,2 @@ +*.dtb +*.dtb.S diff --git a/dts/Makefile b/dts/Makefile index 1e7609a..c47fba7 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -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 diff --git a/include/common.h b/include/common.h index c15e5a4..b590f3a 100644 --- a/include/common.h +++ b/include/common.h @@ -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); diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index d4b5cb5..ee3ceac 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -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)
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 commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> --- Changes in v3: None Changes in v2: - Rebase on Kbuild series v9 - Add ';' which was missing in arch/arm/lib/board.c .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