Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
Hi Rob, 2018年10月1日(月) 22:26 Rob Herring : > > On Mon, Oct 1, 2018 at 12:49 AM Masahiro Yamada > wrote: > > > > Hi Rob, > > > > > > 2018年9月29日(土) 0:43 Rob Herring : > > > > > +# > > > --- > > > +# Devicetree files > > > + > > > +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > > > +dtstree := arch/$(SRCARCH)/boot/dts > > > +endif > > > + > > > +ifneq ($(dtstree),) > > > + > > > +%.dtb : scripts_dtc > > > > %.dtb: prepare3 prepare > > I assume you didn't mean to drop scripts_dtc as that doesn't work. > > Why "prepare" here and not on dtbs? Sorry, my mistake. %.dtb: prepare3 scripts_dtc is the correct one. > > because we need to make sure KERNELRELEASE > > is correctly defined before dtbs_install happens. > > Yes, indeed. With prepare3 added I get: > > cp: cannot create regular file > '/boot/dtbs/4.19.0-rc3-9-g0afba9b7b2ea-dirty': No such file or > directory > > vs. with it: > > cp: cannot create regular file '/boot/dtbs/': Not a directory > > > > > > > > + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > > > + > > > +PHONY += dtbs dtbs_install > > > +dtbs: scripts_dtc > > > > > > dtbs: prepare3 scripts_dtc > > > > > > > > > + $(Q)$(MAKE) $(build)=$(dtstree) > > > + > > > +dtbs_install: dtbs > > > > > > Please do not have dtbs_install to depend on dtbs. > > > > No install targets should ever trigger building anything > > in the source tree. > > > > > > For the background, see the commit log of > > 19514fc665ffbce624785f76ee7ad0ea6378a527 > > Okay, thanks. > > Rob -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
On Mon, Oct 1, 2018 at 12:49 AM Masahiro Yamada wrote: > > Hi Rob, > > > 2018年9月29日(土) 0:43 Rob Herring : > > > +# > > --- > > +# Devicetree files > > + > > +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > > +dtstree := arch/$(SRCARCH)/boot/dts > > +endif > > + > > +ifneq ($(dtstree),) > > + > > +%.dtb : scripts_dtc > > %.dtb: prepare3 prepare I assume you didn't mean to drop scripts_dtc as that doesn't work. Why "prepare" here and not on dtbs? > because we need to make sure KERNELRELEASE > is correctly defined before dtbs_install happens. Yes, indeed. With prepare3 added I get: cp: cannot create regular file '/boot/dtbs/4.19.0-rc3-9-g0afba9b7b2ea-dirty': No such file or directory vs. with it: cp: cannot create regular file '/boot/dtbs/': Not a directory > > > > + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > > + > > +PHONY += dtbs dtbs_install > > +dtbs: scripts_dtc > > > dtbs: prepare3 scripts_dtc > > > > > + $(Q)$(MAKE) $(build)=$(dtstree) > > + > > +dtbs_install: dtbs > > > Please do not have dtbs_install to depend on dtbs. > > No install targets should ever trigger building anything > in the source tree. > > > For the background, see the commit log of > 19514fc665ffbce624785f76ee7ad0ea6378a527 Okay, thanks. Rob ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
On Fri, Sep 28, 2018 at 8:42 PM Rob Herring wrote: > On Fri, Sep 28, 2018 at 12:21 PM Andreas Färber wrote: > > Am 13.09.18 um 17:51 schrieb Geert Uytterhoeven: > > > On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada > > > wrote: > > >> Even x86 can enable OF and OF_UNITTEST. > > >> > > >> Another solution might be, > > >> guard it by 'depends on ARCH_SUPPORTS_OF'. > > >> > > >> This is actually what ACPI does. > > >> > > >> menuconfig ACPI > > >> bool "ACPI (Advanced Configuration and Power Interface) Support" > > >> depends on ARCH_SUPPORTS_ACPI > > >> ... > > > > > > ACPI is a real platform feature, as it depends on firmware. > > > > > > CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, > > > even if it has ACPI ;-) > > > > How would loading a DT overlay work on an ACPI platform? I.e., what > > would it overlay against and how to practically load such a file? > > The DT unittests do just that. I run them on x86 and UM builds. In > this case, the loading source is built-in. > > > I wonder whether that could be helpful for USB devices and serdev... > > How to load the overlays is pretty orthogonal to the issues to be > solved here. It would certainly be possible to move forward with > prototyping this and just have the overlay built-in. It may not even > need to be an overlay if we can support multiple root nodes. You indeed need to refer to some anchors for most use cases, although a simple MMIO device could just be anchored to the root node. Topologies hanging off a USB device would be my first use case, too, for serdev, or for e.g. the mcp2210 USB-SPI bridge. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
Hi Rob, 2018年9月29日(土) 0:43 Rob Herring : > +# > --- > +# Devicetree files > + > +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > +dtstree := arch/$(SRCARCH)/boot/dts > +endif > + > +ifneq ($(dtstree),) > + > +%.dtb : scripts_dtc %.dtb: prepare3 prepare because we need to make sure KERNELRELEASE is correctly defined before dtbs_install happens. > + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > + > +PHONY += dtbs dtbs_install > +dtbs: scripts_dtc dtbs: prepare3 scripts_dtc > + $(Q)$(MAKE) $(build)=$(dtstree) > + > +dtbs_install: dtbs Please do not have dtbs_install to depend on dtbs. No install targets should ever trigger building anything in the source tree. For the background, see the commit log of 19514fc665ffbce624785f76ee7ad0ea6378a527 > + $(Q)$(MAKE) $(dtbinst)=$(dtstree) > + > +ifdef CONFIG_OF_EARLY_FLATTREE > +all: dtbs > +endif > + > +endif > + > +PHONY += scripts_dtc > +scripts_dtc: scripts_basic > + $(Q)$(MAKE) $(build)=scripts/dtc > + > # > --- > # Modules > -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
On Fri, Sep 28, 2018 at 12:21 PM Andreas Färber wrote: > > Hi Geert, > > Am 13.09.18 um 17:51 schrieb Geert Uytterhoeven: > > On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada > > wrote: > >> Even x86 can enable OF and OF_UNITTEST. > >> > >> Another solution might be, > >> guard it by 'depends on ARCH_SUPPORTS_OF'. > >> > >> This is actually what ACPI does. > >> > >> menuconfig ACPI > >> bool "ACPI (Advanced Configuration and Power Interface) Support" > >> depends on ARCH_SUPPORTS_ACPI > >> ... > > > > ACPI is a real platform feature, as it depends on firmware. > > > > CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, > > even if it has ACPI ;-) > > How would loading a DT overlay work on an ACPI platform? I.e., what > would it overlay against and how to practically load such a file? The DT unittests do just that. I run them on x86 and UM builds. In this case, the loading source is built-in. > I wonder whether that could be helpful for USB devices and serdev... How to load the overlays is pretty orthogonal to the issues to be solved here. It would certainly be possible to move forward with prototyping this and just have the overlay built-in. It may not even need to be an overlay if we can support multiple root nodes. Rob ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
Hi Geert, Am 13.09.18 um 17:51 schrieb Geert Uytterhoeven: > On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada > wrote: >> Even x86 can enable OF and OF_UNITTEST. >> >> Another solution might be, >> guard it by 'depends on ARCH_SUPPORTS_OF'. >> >> This is actually what ACPI does. >> >> menuconfig ACPI >> bool "ACPI (Advanced Configuration and Power Interface) Support" >> depends on ARCH_SUPPORTS_ACPI >> ... > > ACPI is a real platform feature, as it depends on firmware. > > CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, > even if it has ACPI ;-) How would loading a DT overlay work on an ACPI platform? I.e., what would it overlay against and how to practically load such a file? I wonder whether that could be helpful for USB devices and serdev... Cheers, Andreas -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
On Sun, Sep 23, 2018 at 06:31:14AM -0400, Masahiro Yamada wrote: > 2018-09-13 11:51 GMT-04:00 Geert Uytterhoeven : > > Hi Yamada-san, > > > > On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada > > wrote: > >> 2018-09-12 0:40 GMT+09:00 Rob Herring : > >> > On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: > >> >> There is nothing arch specific about building dtb files other than their > >> >> location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. > >> >> The dependencies and supported targets are all slightly different. > >> >> Also, a cross-compiler for each arch is needed, but really the host > >> >> compiler preprocessor is perfectly fine for building dtbs. Move the > >> >> build rules to a common location and remove the arch specific ones. This > >> >> is done in a single step to avoid warnings about overriding rules. > >> >> > >> >> The build dependencies had been a mixture of 'scripts' and/or 'prepare'. > >> >> These pull in several dependencies some of which need a target compiler > >> >> (specifically devicetable-offsets.h) and aren't needed to build dtbs. > >> >> All that is really needed is dtc, so adjust the dependencies to only be > >> >> dtc. > >> >> > >> >> This change enables support 'dtbs_install' on some arches which were > >> >> missing the target. > >> > > >> > [...] > >> > > >> >> @@ -1215,6 +1215,33 @@ kselftest-merge: > >> >> $(srctree)/tools/testing/selftests/*/config > >> >> +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig > >> >> > >> >> +# > >> >> --- > >> >> +# Devicetree files > >> >> + > >> >> +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > >> >> +dtstree := arch/$(SRCARCH)/boot/dts > >> >> +endif > >> >> + > >> >> +ifdef CONFIG_OF_EARLY_FLATTREE > >> > > >> > This can be true when dtstree is unset. So this line should be this > >> > instead to fix the 0-day reported error: > >> > > >> > ifneq ($(dtstree),) > >> > > >> >> + > >> >> +%.dtb : scripts_dtc > >> >> + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > >> >> + > >> >> +PHONY += dtbs dtbs_install > >> >> +dtbs: scripts_dtc > >> >> + $(Q)$(MAKE) $(build)=$(dtstree) > >> >> + > >> >> +dtbs_install: dtbs > >> >> + $(Q)$(MAKE) $(dtbinst)=$(dtstree) > >> >> + > >> >> +all: dtbs > >> >> + > >> >> +endif > >> > >> > >> Ah, right. > >> Even x86 can enable OF and OF_UNITTEST. > >> > >> > >> > >> Another solution might be, > >> guard it by 'depends on ARCH_SUPPORTS_OF'. > >> > >> > >> > >> This is actually what ACPI does. > >> > >> menuconfig ACPI > >> bool "ACPI (Advanced Configuration and Power Interface) Support" > >> depends on ARCH_SUPPORTS_ACPI > >> ... > > > > ACPI is a real platform feature, as it depends on firmware. > > > > CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, > > even if it has ACPI ;-) > > > > OK, understood. Any other comments on this? I'd like to get the series into linux-next soon. There was one other problem 0-day reported when building with CONFIG_OF=n while setting CONFIG_OF_ALL_DTBS=y on the kernel command line. The problem is dtc is not built as setting options on the command line doesn't invoke kconfig select(s). This can be fixed by also adding CONFIG_DTC=y to the command line, always building dtc regardless of Kconfig, or making 'all' conditionally dependent on 'dtbs'. I've gone with the last option as that is how this problem was avoided before. So the hunk in question with the 2 fixes now looks like this: @@ -1215,6 +1215,35 @@ kselftest-merge: $(srctree)/tools/testing/selftests/*/config +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig +# --- +# Devicetree files + +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) +dtstree := arch/$(SRCARCH)/boot/dts +endif + +ifneq ($(dtstree),) + +%.dtb : scripts_dtc + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ + +PHONY += dtbs dtbs_install +dtbs: scripts_dtc + $(Q)$(MAKE) $(build)=$(dtstree) + +dtbs_install: dtbs + $(Q)$(MAKE) $(dtbinst)=$(dtstree) + +ifdef CONFIG_OF_EARLY_FLATTREE +all: dtbs +endif + +endif + +PHONY += scripts_dtc +scripts_dtc: scripts_basic + $(Q)$(MAKE) $(build)=scripts/dtc + # --- # Modules ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
2018-09-13 11:51 GMT-04:00 Geert Uytterhoeven : > Hi Yamada-san, > > On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada > wrote: >> 2018-09-12 0:40 GMT+09:00 Rob Herring : >> > On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: >> >> There is nothing arch specific about building dtb files other than their >> >> location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. >> >> The dependencies and supported targets are all slightly different. >> >> Also, a cross-compiler for each arch is needed, but really the host >> >> compiler preprocessor is perfectly fine for building dtbs. Move the >> >> build rules to a common location and remove the arch specific ones. This >> >> is done in a single step to avoid warnings about overriding rules. >> >> >> >> The build dependencies had been a mixture of 'scripts' and/or 'prepare'. >> >> These pull in several dependencies some of which need a target compiler >> >> (specifically devicetable-offsets.h) and aren't needed to build dtbs. >> >> All that is really needed is dtc, so adjust the dependencies to only be >> >> dtc. >> >> >> >> This change enables support 'dtbs_install' on some arches which were >> >> missing the target. >> > >> > [...] >> > >> >> @@ -1215,6 +1215,33 @@ kselftest-merge: >> >> $(srctree)/tools/testing/selftests/*/config >> >> +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig >> >> >> >> +# >> >> --- >> >> +# Devicetree files >> >> + >> >> +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) >> >> +dtstree := arch/$(SRCARCH)/boot/dts >> >> +endif >> >> + >> >> +ifdef CONFIG_OF_EARLY_FLATTREE >> > >> > This can be true when dtstree is unset. So this line should be this >> > instead to fix the 0-day reported error: >> > >> > ifneq ($(dtstree),) >> > >> >> + >> >> +%.dtb : scripts_dtc >> >> + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ >> >> + >> >> +PHONY += dtbs dtbs_install >> >> +dtbs: scripts_dtc >> >> + $(Q)$(MAKE) $(build)=$(dtstree) >> >> + >> >> +dtbs_install: dtbs >> >> + $(Q)$(MAKE) $(dtbinst)=$(dtstree) >> >> + >> >> +all: dtbs >> >> + >> >> +endif >> >> >> Ah, right. >> Even x86 can enable OF and OF_UNITTEST. >> >> >> >> Another solution might be, >> guard it by 'depends on ARCH_SUPPORTS_OF'. >> >> >> >> This is actually what ACPI does. >> >> menuconfig ACPI >> bool "ACPI (Advanced Configuration and Power Interface) Support" >> depends on ARCH_SUPPORTS_ACPI >> ... > > ACPI is a real platform feature, as it depends on firmware. > > CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, > even if it has ACPI ;-) > OK, understood. Thanks! -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
Hi Yamada-san, On Wed, Sep 12, 2018 at 3:02 AM Masahiro Yamada wrote: > 2018-09-12 0:40 GMT+09:00 Rob Herring : > > On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: > >> There is nothing arch specific about building dtb files other than their > >> location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. > >> The dependencies and supported targets are all slightly different. > >> Also, a cross-compiler for each arch is needed, but really the host > >> compiler preprocessor is perfectly fine for building dtbs. Move the > >> build rules to a common location and remove the arch specific ones. This > >> is done in a single step to avoid warnings about overriding rules. > >> > >> The build dependencies had been a mixture of 'scripts' and/or 'prepare'. > >> These pull in several dependencies some of which need a target compiler > >> (specifically devicetable-offsets.h) and aren't needed to build dtbs. > >> All that is really needed is dtc, so adjust the dependencies to only be > >> dtc. > >> > >> This change enables support 'dtbs_install' on some arches which were > >> missing the target. > > > > [...] > > > >> @@ -1215,6 +1215,33 @@ kselftest-merge: > >> $(srctree)/tools/testing/selftests/*/config > >> +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig > >> > >> +# > >> --- > >> +# Devicetree files > >> + > >> +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > >> +dtstree := arch/$(SRCARCH)/boot/dts > >> +endif > >> + > >> +ifdef CONFIG_OF_EARLY_FLATTREE > > > > This can be true when dtstree is unset. So this line should be this > > instead to fix the 0-day reported error: > > > > ifneq ($(dtstree),) > > > >> + > >> +%.dtb : scripts_dtc > >> + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > >> + > >> +PHONY += dtbs dtbs_install > >> +dtbs: scripts_dtc > >> + $(Q)$(MAKE) $(build)=$(dtstree) > >> + > >> +dtbs_install: dtbs > >> + $(Q)$(MAKE) $(dtbinst)=$(dtstree) > >> + > >> +all: dtbs > >> + > >> +endif > > > Ah, right. > Even x86 can enable OF and OF_UNITTEST. > > > > Another solution might be, > guard it by 'depends on ARCH_SUPPORTS_OF'. > > > > This is actually what ACPI does. > > menuconfig ACPI > bool "ACPI (Advanced Configuration and Power Interface) Support" > depends on ARCH_SUPPORTS_ACPI > ... ACPI is a real platform feature, as it depends on firmware. CONFIG_OF can be enabled, and DT overlays can be loaded, on any platform, even if it has ACPI ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
2018-09-12 0:40 GMT+09:00 Rob Herring : > On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: >> >> There is nothing arch specific about building dtb files other than their >> location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. >> The dependencies and supported targets are all slightly different. >> Also, a cross-compiler for each arch is needed, but really the host >> compiler preprocessor is perfectly fine for building dtbs. Move the >> build rules to a common location and remove the arch specific ones. This >> is done in a single step to avoid warnings about overriding rules. >> >> The build dependencies had been a mixture of 'scripts' and/or 'prepare'. >> These pull in several dependencies some of which need a target compiler >> (specifically devicetable-offsets.h) and aren't needed to build dtbs. >> All that is really needed is dtc, so adjust the dependencies to only be >> dtc. >> >> This change enables support 'dtbs_install' on some arches which were >> missing the target. > > [...] > >> @@ -1215,6 +1215,33 @@ kselftest-merge: >> $(srctree)/tools/testing/selftests/*/config >> +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig >> >> +# >> --- >> +# Devicetree files >> + >> +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) >> +dtstree := arch/$(SRCARCH)/boot/dts >> +endif >> + >> +ifdef CONFIG_OF_EARLY_FLATTREE > > This can be true when dtstree is unset. So this line should be this > instead to fix the 0-day reported error: > > ifneq ($(dtstree),) > >> + >> +%.dtb : scripts_dtc >> + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ >> + >> +PHONY += dtbs dtbs_install >> +dtbs: scripts_dtc >> + $(Q)$(MAKE) $(build)=$(dtstree) >> + >> +dtbs_install: dtbs >> + $(Q)$(MAKE) $(dtbinst)=$(dtstree) >> + >> +all: dtbs >> + >> +endif Ah, right. Even x86 can enable OF and OF_UNITTEST. Another solution might be, guard it by 'depends on ARCH_SUPPORTS_OF'. This is actually what ACPI does. menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" depends on ARCH_SUPPORTS_ACPI ... -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: > > There is nothing arch specific about building dtb files other than their > location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. > The dependencies and supported targets are all slightly different. > Also, a cross-compiler for each arch is needed, but really the host > compiler preprocessor is perfectly fine for building dtbs. Move the > build rules to a common location and remove the arch specific ones. This > is done in a single step to avoid warnings about overriding rules. > > The build dependencies had been a mixture of 'scripts' and/or 'prepare'. > These pull in several dependencies some of which need a target compiler > (specifically devicetable-offsets.h) and aren't needed to build dtbs. > All that is really needed is dtc, so adjust the dependencies to only be > dtc. > > This change enables support 'dtbs_install' on some arches which were > missing the target. [...] > @@ -1215,6 +1215,33 @@ kselftest-merge: > $(srctree)/tools/testing/selftests/*/config > +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig > > +# --- > +# Devicetree files > + > +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) > +dtstree := arch/$(SRCARCH)/boot/dts > +endif > + > +ifdef CONFIG_OF_EARLY_FLATTREE This can be true when dtstree is unset. So this line should be this instead to fix the 0-day reported error: ifneq ($(dtstree),) > + > +%.dtb : scripts_dtc > + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ > + > +PHONY += dtbs dtbs_install > +dtbs: scripts_dtc > + $(Q)$(MAKE) $(build)=$(dtstree) > + > +dtbs_install: dtbs > + $(Q)$(MAKE) $(dtbinst)=$(dtstree) > + > +all: dtbs > + > +endif ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules
There is nothing arch specific about building dtb files other than their location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. The dependencies and supported targets are all slightly different. Also, a cross-compiler for each arch is needed, but really the host compiler preprocessor is perfectly fine for building dtbs. Move the build rules to a common location and remove the arch specific ones. This is done in a single step to avoid warnings about overriding rules. The build dependencies had been a mixture of 'scripts' and/or 'prepare'. These pull in several dependencies some of which need a target compiler (specifically devicetable-offsets.h) and aren't needed to build dtbs. All that is really needed is dtc, so adjust the dependencies to only be dtc. This change enables support 'dtbs_install' on some arches which were missing the target. Acked-by: Will Deacon Acked-by: Paul Burton Acked-by: Ley Foon Tan Cc: Masahiro Yamada Cc: Michal Marek Cc: Vineet Gupta Cc: Russell King Cc: Catalin Marinas Cc: Yoshinori Sato Cc: Michal Simek Cc: Ralf Baechle Cc: James Hogan Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Chris Zankel Cc: Max Filippov Cc: linux-kbu...@vger.kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux-arm-ker...@lists.infradead.org Cc: uclinux-h8-de...@lists.sourceforge.jp Cc: linux-m...@linux-mips.org Cc: nios2-...@lists.rocketboards.org Cc: linuxppc-...@lists.ozlabs.org Cc: linux-xte...@linux-xtensa.org Signed-off-by: Rob Herring --- Makefile | 35 ++- arch/arc/Makefile | 6 -- arch/arm/Makefile | 20 +- arch/arm64/Makefile | 17 +-- arch/c6x/Makefile | 2 -- arch/h8300/Makefile | 11 +- arch/microblaze/Makefile | 4 +--- arch/microblaze/boot/dts/Makefile | 2 ++ arch/mips/Makefile| 15 + arch/nds32/Makefile | 2 +- arch/nios2/Makefile | 7 --- arch/nios2/boot/Makefile | 4 arch/powerpc/Makefile | 3 --- arch/xtensa/Makefile | 12 +-- scripts/Makefile | 3 +-- scripts/Makefile.lib | 2 +- scripts/dtc/Makefile | 2 +- 17 files changed, 46 insertions(+), 101 deletions(-) diff --git a/Makefile b/Makefile index 19948e556941..c43859eba70f 100644 --- a/Makefile +++ b/Makefile @@ -1071,7 +1071,7 @@ include/config/kernel.release: $(srctree)/Makefile FORCE # Carefully list dependencies so we do not try to build scripts twice # in parallel PHONY += scripts -scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h) +scripts: scripts_basic scripts_dtc asm-generic gcc-plugins $(autoksyms_h) $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1215,6 +1215,33 @@ kselftest-merge: $(srctree)/tools/testing/selftests/*/config +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig +# --- +# Devicetree files + +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) +dtstree := arch/$(SRCARCH)/boot/dts +endif + +ifdef CONFIG_OF_EARLY_FLATTREE + +%.dtb : scripts_dtc + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ + +PHONY += dtbs dtbs_install +dtbs: scripts_dtc + $(Q)$(MAKE) $(build)=$(dtstree) + +dtbs_install: dtbs + $(Q)$(MAKE) $(dtbinst)=$(dtstree) + +all: dtbs + +endif + +PHONY += scripts_dtc +scripts_dtc: scripts_basic + $(Q)$(MAKE) $(build)=scripts/dtc + # --- # Modules @@ -1424,6 +1451,12 @@ help: @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing' @echo '.config.' @echo '' + @$(if $(dtstree), \ + echo 'Devicetree:'; \ + echo '* dtbs- Build device tree blobs for enabled boards'; \ + echo ' dtbs_install- Install dtbs to $(INSTALL_DTBS_PATH)'; \ + echo '') + @echo 'Userspace tools targets:' @echo ' use "make tools/help"' @echo ' or "cd tools; make help"' diff --git a/arch/arc/Makefile b/arch/arc/Makefile index fb026196aaab..5c7bc6d62f43 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -132,11 +132,5 @@ boot_targets += uImage uImage.bin uImage.gz $(boot_targets): vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ -%.dtb %.dtb.S %.dtb.o: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ - -dtbs: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts - archclean: $(Q)$(MAKE) $(clean)=$(boot) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index d1516f85f25d..161c2df6567e 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -307,