Skip to contentSkip to conversation

scripts: remove redundant setupmbr addition to subdir-

PATCH Applied Masahiro Yamada 2 participants 6 messages Aug 18, 2020 – Aug 19, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 scripts: remove redundant setupmbr addition to subdir-

This has already been added to subdir-$(CONFIG_X86) a few lines above. 'make mrproper' correctly descends into scripts/setupmbr/.

Remove the redundant addition.

---

 scripts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile +1 -1
index 75e68822d..238460fe2 100644
@@ -52,4 +52,4 @@ subdir-$(CONFIG_DTC)		+= dtc
 subdir-$(CONFIG_ARCH_TEGRA)	+= tegra
 
 # Let clean descend into subdirs
-subdir-	+= basic kconfig setupmbr
+subdir-	+= basic kconfig
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/5 kvx,riscv: remove unused $(dtb-y) assignment

dtb-y is not defined in these Makefiles. Remove the meaningless code.

---

 arch/kvx/dts/Makefile   | 1 -
 arch/riscv/dts/Makefile | 1 -
 2 files changed, 2 deletions(-)
arch/kvx/dts/Makefile +0 -1
index 391783c1e..d4221d2c1 100644
@@ -9,5 +9,4 @@ endif
 
 obj-$(CONFIG_BOARD_K200) += k200.dtb.o
 
-always := $(dtb-y)
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts
arch/riscv/dts/Makefile +0 -1
index 509f236cc..6bd4e5a92 100644
@@ -9,5 +9,4 @@ obj-$(CONFIG_BOARD_ERIZO_GENERIC) += erizo-generic.dtb.o
 # created.
 obj- += dummy.o
 
-always := $(dtb-y)
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/5 sandbox: add sandbox.dtb to always-y

In reply to Masahiro Yamada

Unlike Linux, Barebox does not support 'make dtbs_install'. There is no good reason to use dtb-y, which is not natively supported by the Barebox build system.

Sandbox is the special architecture that compiles DTB as a separate file. Add .dtb to always-y directly.

CONFIG_OFTREE is a bool option. Use a more Kbuild-ish style instead of ifeq ($(CONFIG_OFTREE),y).

---

 arch/sandbox/dts/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/sandbox/dts/Makefile +1 -4
index 6f6838857..6f4344da6 100644
@@ -1,11 +1,8 @@
-ifeq ($(CONFIG_OFTREE),y)
-dtb-y += \
+always-$(CONFIG_OFTREE) += \
 	sandbox.dtb
-endif
 
 # just to build a built-in.o. Otherwise compilation fails when no devicetree is
 # created.
 obj- += dummy.o
 
-always := $(dtb-y)
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 4/5 kbuild: sync the top level Kbuild file with Linux

In reply to Masahiro Yamada

- Convert 'always' to 'always-y'

- Remove redundant 'targets' assignment

- Use filechk for the offset generation to avoid unneeded rebuilds when the content of asm-offsets.h is not changed

- Remove the explicit build rule of asm-offsets.s because it can be built of the pattern rule in scripts/Makefile.build

---

 Kbuild | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
Kbuild +12 -16
index 329609604..519be4a3c 100644
@@ -1,14 +1,15 @@
-#####
-# 1) Generate asm-offsets.h
+# SPDX-License-Identifier: GPL-2.0
 #
+# Kbuild for top-level directory of Barebox
+
+#####
+# Generate asm-offsets.h
 
 offsets-file := include/generated/asm-offsets.h
 
-always  += $(offsets-file)
-targets += $(offsets-file)
+always-y += $(offsets-file)
 targets += arch/$(SRCARCH)/lib/asm-offsets.s
 
-
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
 	"/^->/{s:->#\(.*\):/* \1 */:; \
@@ -17,9 +18,9 @@ define sed-y
 	s:->::; p;}"
 endef
 
-quiet_cmd_offsets = GEN     $@
-define cmd_offsets
-	(set -e; \
+# Use filechk to avoid rebuilds when a header changes, but the resulting file
+# does not
+define filechk_offsets
 	 echo "#ifndef __ASM_OFFSETS_H__"; \
 	 echo "#define __ASM_OFFSETS_H__"; \
 	 echo "/*"; \
@@ -31,13 +32,8 @@ define cmd_offsets
 	 echo ""; \
 	 sed -ne $(sed-y) $<; \
 	 echo ""; \
-	 echo "#endif" ) > $@
+	 echo "#endif"
 endef
 
-# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(SRCARCH)/lib/asm-offsets.s: arch/$(SRCARCH)/lib/asm-offsets.c FORCE
-	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cc_s_c)
-
-$(obj)/$(offsets-file): arch/$(SRCARCH)/lib/asm-offsets.s Kbuild
-	$(call cmd,offsets)
+$(offsets-file): arch/$(SRCARCH)/lib/asm-offsets.s FORCE
+	$(call filechk,offsets)
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 5/5 kbuild: introduce hostprogs-always-y and userprogs-always-y

In reply to Masahiro Yamada

Linux commit faabed295cccc2aba2b67f2e7b309f2892d55004

You can use:

    hostprogs-always-y += foo

as a shorthand for:

    hostprogs += foo
    always-y += foo

Likewise,

    userprogs-always-y += foo

as a shorthand for:

    userprogs += foo
    always-y += foo

---

 scripts/Makefile          | 55 ++++++++++++++++++---------------------
 scripts/Makefile.build    |  2 +-
 scripts/Makefile.clean    |  9 ++++---
 scripts/Makefile.lib      | 11 ++++++++
 scripts/basic/Makefile    |  3 +--
 scripts/dtc/Makefile      |  3 +--
 scripts/imx/Makefile      |  6 ++---
 scripts/mod/Makefile      |  4 +--
 scripts/setupmbr/Makefile |  3 +--
 scripts/tegra/Makefile    |  4 +--
 10 files changed, 51 insertions(+), 49 deletions(-)
scripts/Makefile +25 -30
index 238460fe2..30b7ec540 100644
@@ -1,50 +1,45 @@
 ###
 # scripts contains sources for various helper programs used throughout
 # barebox for the build process.
-# ---------------------------------------------------------------------------
-# kallsyms:      Find all symbols in barebox
 
-hostprogs-y                      += bin2c
-hostprogs-y                      += mkimage
-hostprogs-y                      += fix_size
-hostprogs-y                      += bareboxenv
-hostprogs-y                      += bareboxcrc32
-hostprogs-y                      += kernel-install
-hostprogs-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
+hostprogs-always-y					+= bin2c
+hostprogs-always-y					+= mkimage
+hostprogs-always-y					+= fix_size
+hostprogs-always-y					+= bareboxenv
+hostprogs-always-y					+= bareboxcrc32
+hostprogs-always-y					+= kernel-install
+hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS)	+= rsatoc
 HOSTCFLAGS_rsatoc = `pkg-config --cflags openssl`
 HOSTLDLIBS_rsatoc = `pkg-config --libs openssl`
-hostprogs-$(CONFIG_IMD)          += bareboximd
-hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
-hostprogs-$(CONFIG_MIPS)         += mips-relocs
-hostprogs-$(CONFIG_MVEBU_HOSTTOOLS) += kwbimage kwboot mvebuimg
-hostprogs-$(CONFIG_ARCH_OMAP)    += omap_signGP mk-omap-image
-hostprogs-$(CONFIG_ARCH_S5PCxx)  += s5p_cksum
-hostprogs-$(CONFIG_ARCH_DAVINCI) += mkublheader
+hostprogs-always-$(CONFIG_IMD)				+= bareboximd
+hostprogs-always-$(CONFIG_KALLSYMS)			+= kallsyms
+hostprogs-always-$(CONFIG_MIPS)				+= mips-relocs
+hostprogs-always-$(CONFIG_MVEBU_HOSTTOOLS)		+= kwbimage kwboot mvebuimg
+hostprogs-always-$(CONFIG_ARCH_OMAP)			+= omap_signGP mk-omap-image
+hostprogs-always-$(CONFIG_ARCH_S5PCxx)			+= s5p_cksum
+hostprogs-always-$(CONFIG_ARCH_DAVINCI)			+= mkublheader
 HOSTCFLAGS_zynq_mkimage.o = -I$(srctree) -I$(srctree)/arch/arm/mach-zynq/include
-hostprogs-$(CONFIG_ARCH_ZYNQ)	 += zynq_mkimage
-hostprogs-$(CONFIG_ARCH_SOCFPGA) += socfpga_mkimage
-hostprogs-$(CONFIG_MXS_HOSTTOOLS)+= mxsimage mxsboot
-hostprogs-$(CONFIG_ARCH_LAYERSCAPE) += pblimage
-hostprogs-$(CONFIG_ARCH_STM32MP) += stm32image
+hostprogs-always-$(CONFIG_ARCH_ZYNQ)			+= zynq_mkimage
+hostprogs-always-$(CONFIG_ARCH_SOCFPGA)			+= socfpga_mkimage
+hostprogs-always-$(CONFIG_MXS_HOSTTOOLS)		+= mxsimage mxsboot
+hostprogs-always-$(CONFIG_ARCH_LAYERSCAPE)		+= pblimage
+hostprogs-always-$(CONFIG_ARCH_STM32MP)			+= stm32image
 KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
 HOSTLDLIBS_mxsimage  = `pkg-config --libs openssl`
 HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
 HOSTLDLIBS_omap3-usb-loader  = `pkg-config --libs libusb-1.0`
-hostprogs-$(CONFIG_OMAP3_USB_LOADER)  += omap3-usb-loader
+hostprogs-always-$(CONFIG_OMAP3_USB_LOADER)		+= omap3-usb-loader
 HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
 HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
-hostprogs-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT) += omap4_usbboot
+hostprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT)	+= omap4_usbboot
 
-userprogs-$(CONFIG_BAREBOXENV_TARGET)		+= bareboxenv-target
-userprogs-$(CONFIG_KERNEL_INSTALL_TARGET)	+= kernel-install-target
-userprogs-$(CONFIG_BAREBOXCRC32_TARGET)		+= bareboxcrc32-target
-userprogs-$(CONFIG_IMD_TARGET)			+= bareboximd-target
+userprogs-always-$(CONFIG_BAREBOXENV_TARGET)		+= bareboxenv-target
+userprogs-always-$(CONFIG_KERNEL_INSTALL_TARGET)	+= kernel-install-target
+userprogs-always-$(CONFIG_BAREBOXCRC32_TARGET)		+= bareboxcrc32-target
+userprogs-always-$(CONFIG_IMD_TARGET)			+= bareboximd-target
 
 userccflags += -I $(srctree)/$(src)/include
 
-userprogs	:= $(userprogs-y)
-always-y	:= $(hostprogs-y) $(hostprogs-m) $(userprogs-y)
-
 subdir-y			+= mod
 subdir-y			+= imx
 subdir-$(CONFIG_X86)		+= setupmbr
scripts/Makefile.build +1 -1
index a3dfe261a..1614a1ac5 100644
@@ -45,7 +45,7 @@ include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-di
 include scripts/Makefile.lib
 
 # Do not include host rules unless needed
-ifneq ($(hostprogs)$(hostprogs-y)$(hostprogs-m),)
+ifneq ($(hostprogs),)
 include scripts/Makefile.host
 endif
 
scripts/Makefile.clean +6 -3
index 97fd2ef48..3c4519fa8 100644
@@ -35,9 +35,12 @@ subdir-ymn	:= $(addprefix $(obj)/,$(subdir-ymn))
 # build a list of files to remove, usually relative to the current
 # directory
 
-__clean-files	:= $(extra-y) $(extra-m) $(extra-)       \
-		   $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files)   \
-		   $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) $(userprogs)
+__clean-files	:= \
+	$(clean-files) $(targets) $(hostprogs) $(userprogs) \
+	$(extra-y) $(extra-m) $(extra-) \
+	$(always-y) $(always-m) $(always-) \
+	$(hostprogs-always-y) $(hostprogs-always-m) $(hostprogs-always-) \
+	$(userprogs-always-y) $(userprogs-always-m) $(userprogs-always-)
 
 # as clean-files is given relative to the current directory, this adds
 # a $(obj) prefix, except for absolute paths
scripts/Makefile.lib +11 -0
index 3799e777c..3c95384f9 100644
@@ -89,6 +89,17 @@ real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))
 
 always-y += $(always-m)
 
+# hostprogs-always-y += foo
+# ... is a shorthand for
+# hostprogs += foo
+# always-y  += foo
+hostprogs += $(hostprogs-always-y) $(hostprogs-always-m)
+always-y += $(hostprogs-always-y) $(hostprogs-always-m)
+
+# userprogs-always-y is likewise.
+userprogs += $(userprogs-always-y) $(userprogs-always-m)
+always-y += $(userprogs-always-y) $(userprogs-always-m)
+
 # Add subdir path
 
 extra-y		:= $(addprefix $(obj)/,$(extra-y))
scripts/basic/Makefile +1 -2
index 290dd27d2..eeb6a38c5 100644
@@ -2,5 +2,4 @@
 #
 # fixdep: used to generate dependency information during build process
 
-hostprogs	:= fixdep
-always-y	:= $(hostprogs)
+hostprogs-always-y	+= fixdep
scripts/dtc/Makefile +1 -2
index 69b0f6a0e..0c857c9cc 100644
@@ -1,8 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # scripts/dtc makefile
 
-hostprogs-$(CONFIG_DTC) := dtc fdtget
-always		:= $(hostprogs-y)
+hostprogs-always-$(CONFIG_DTC)		+= dtc
 
 dtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
 		   srcpos.o checks.o util.o
scripts/imx/Makefile +2 -4
index e7af2c98e..029f9ca9f 100644
@@ -1,7 +1,5 @@
-hostprogs-$(CONFIG_ARCH_IMX_IMXIMAGE) += imx-image
-hostprogs-$(CONFIG_ARCH_IMX_USBLOADER) += imx-usb-loader
-
-always          := $(hostprogs-y)
+hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
+hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
 
 HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0`
 HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
scripts/mod/Makefile +2 -2
index e02b9f4ce..9926ed08d 100644
@@ -1,5 +1,5 @@
-hostprogs-y	:= modpost mk_elfconfig
-always		:= $(hostprogs-y) empty.o
+hostprogs-always-y	+= modpost mk_elfconfig
+always-y		+= empty.o
 
 modpost-objs	:= modpost.o sumversion.o
 
scripts/setupmbr/Makefile +1 -2
index 8680fedce..6e33d1536 100644
@@ -1,4 +1,3 @@
 HOST_EXTRACFLAGS=-I$(srctree)
 
-hostprogs-y  := setupmbr
-always       := $(hostprogs-y)
+hostprogs-always-y += setupmbr
scripts/tegra/Makefile +1 -3
index 8ebc27ca7..dec0b529d 100644
@@ -1,6 +1,4 @@
-hostprogs-$(CONFIG_ARCH_TEGRA) += cbootimage
-
-always          := $(hostprogs-y)
+hostprogs-always-$(CONFIG_ARCH_TEGRA) += cbootimage
 
 HOSTLDLIBS_cbootimage  = '-lm'
 
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#5 lore raw
In reply to Masahiro Yamada
Quoted 7 lines · Masahiro Yamada

This has already been added to subdir-$(CONFIG_X86) a few lines above. 'make mrproper' correctly descends into scripts/setupmbr/.

Remove the redundant addition.

---

Applied, thanks

Sascha

Quoted 23 lines
 scripts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile +1 -1
index 75e68822d..238460fe2 100644
@@ -52,4 +52,4 @@ subdir-$(CONFIG_DTC)		+= dtc
 subdir-$(CONFIG_ARCH_TEGRA)	+= tegra
 
 # Let clean descend into subdirs
-subdir-	+= basic kconfig setupmbr
+subdir-	+= basic kconfig
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox