kbuild: remove unused barebox-head
PATCH 1/5 kbuild: remove unused barebox-head
This is not set by anyone.
---
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -781,7 +781,7 @@ barebox.S barebox.s: barebox FORCE endif # barebox image -barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE +barebox: $(barebox-lds) $(barebox-common) $(kallsyms.o) FORCE $(call barebox-modpost) $(call if_changed_rule,barebox__) $(Q)rm -f .old_version
@@ -791,7 +791,7 @@ barebox.srec: barebox # The actual objects are generated when descending, # make sure no implicit rule kicks in -$(sort $(barebox-head) $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; +$(sort $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; # Handle descending into subdirectories listed in $(barebox-dirs) # Preset locale variables to speed up the build process. Limit locale
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/5 kbuild: remove dead code for modpost
rule_barebox-modpost is dead code since it is not invoked by anyone.
$(call barebox-modpost) is dead code too since there is no variable named 'barebox-modpost'.
We could fix it to $(call rule_barebox-modpost) to invoke the rules, but I hesitate to enable the code that has never been tested.
barebox-init, barebox-main are not set by anyone, so this code does not seem to work.
The code is completely out of sync from the upstream Linux, so there is no good reason to keep this rotten code.
If barebox needs modpost, this should be re-implemented correctly. (preferably, by re-syncing with the latest Linux)
---
Makefile | 14 -------------- 1 file changed, 14 deletions(-)
Makefile +0 -14
@@ -716,19 +716,6 @@ debug_kallsyms: .tmp_map$(last_kallsyms) endif # ifdef CONFIG_KALLSYMS -# Do modpost on a prelinked vmlinux. The finally linked vmlinux has -# relevant sections renamed as per the linker script. -quiet_cmd_barebox-modpost = LD $@ - cmd_barebox-modpost = $(LD) $(LDFLAGS) -r -o $@ \ - $(vmlinux-init) --start-group $(barebox-main) --end-group \ - $(filter-out $(barebox-init) $(barebox-main) $(barebox-lds) FORCE ,$^) -define rule_barebox-modpost - : - +$(call cmd,barebox-modpost) - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@ - $(Q)echo 'cmd_$@ := $(cmd_barebox-modpost)' > $(dot-target).cmd -endef - OBJCOPYFLAGS_barebox.bin = -O binary barebox.bin: barebox FORCE
@@ -782,7 +769,6 @@ endif # barebox image barebox: $(barebox-lds) $(barebox-common) $(kallsyms.o) FORCE - $(call barebox-modpost) $(call if_changed_rule,barebox__) $(Q)rm -f .old_version
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/5 kbuild: rename barebox-pbl-common to BAREBOX_PBL_OBJS
In reply to Masahiro Yamada'export barebox-pbl-common' does not work reliably because hyphens are disallowed in shell variables.
This caused a problem in Linux in the past. See Linux commit 2bfbe7881ee0 ("kbuild: Do not use hyphen in exported variable name").
The same problem occurs when you build barebox with O= and the directory path to the source tree contains a shell special character like '~'.
The maintainer of GNU Make stated that there is no consistent way to export variables that do not meet the shell's naming criteria.
(https://savannah.gnu.org/bugs/?55719)
Consequently, you cannot use hyphens in exported variables.
Rename barebox-pbl-common to BAREBOX_PBL_OBJS.
I named it after KBUILD_VMLINUX_OBJS in the Linux top Makefile.
---
Makefile | 5 ++--- arch/mips/pbl/Makefile | 2 +- images/Makefile | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-)
Makefile +2 -3
@@ -584,8 +584,7 @@ export DEFAULT_COMPRESSION_SUFFIX # System.map is generated to document addresses of all kernel symbols barebox-common := $(common-y) -barebox-pbl-common := $(pbl-common-y) -export barebox-pbl-common +export BAREBOX_PBL_OBJS := $(pbl-common-y) barebox-all := $(barebox-common) barebox-lds := $(lds-y)
@@ -777,7 +776,7 @@ barebox.srec: barebox # The actual objects are generated when descending, # make sure no implicit rule kicks in -$(sort $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; +$(sort $(barebox-common) ) $(barebox-lds) $(BAREBOX_PBL_OBJS): $(barebox-dirs) ; # Handle descending into subdirectories listed in $(barebox-dirs) # Preset locale variables to speed up the build process. Limit locale
arch/mips/pbl/Makefile +1 -1
@@ -25,7 +25,7 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE PBL_CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map LDFLAGS_zbarebox += -static --gc-sections -zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) +zbarebox-common := $(BAREBOX_PBL_OBJS) $(obj)/$(piggy_o) zbarebox-lds := $(obj)/zbarebox.lds quiet_cmd_zbarebox__ ?= LD $@
images/Makefile +2 -2
@@ -57,12 +57,12 @@ quiet_cmd_elf__ ?= LD $@ cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections \ -e $(2) -Map [email protected] $(LDFLAGS_$(@F)) -o $@ \ -T $(pbl-lds) \ - --start-group $(barebox-pbl-common) $(obj)/piggy.o \ + --start-group $(BAREBOX_PBL_OBJS) $(obj)/piggy.o \ $(obj)/sha_sum.o --end-group PBL_CPPFLAGS += -fdata-sections -ffunction-sections -$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) $(obj)/piggy.o $(obj)/sha_sum.o FORCE +$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE $(call if_changed,elf__,$(*F)) $(obj)/%.pblb: $(obj)/%.pbl FORCE
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/5 kbuild: rename barebox-{common, lds} to BAREBOX_{OBJS, LDS}
In reply to Masahiro YamadaThe previous commit renamed barebox-pbl-common because you cannot export a variable that contain hyphens.
These variables are not exported for now. I am just renaming them for consistency.
barebox-common -> BAREBOX_OBJS
barebox-lds -> BAREBOX_LDS
If barebox moves the link rules into scripts/link-barebox.sh like Linux did, these two must be exported anyway.
---
Makefile | 22 +++++++++++----------- arch/mips/Makefile | 6 +++--- arch/sandbox/Makefile | 4 ++-- arch/x86/Makefile | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-)
Makefile +11 -11
@@ -583,18 +583,18 @@ export DEFAULT_COMPRESSION_SUFFIX # # System.map is generated to document addresses of all kernel symbols -barebox-common := $(common-y) +BAREBOX_OBJS := $(common-y) export BAREBOX_PBL_OBJS := $(pbl-common-y) -barebox-all := $(barebox-common) -barebox-lds := $(lds-y) +barebox-all := $(BAREBOX_OBJS) +BAREBOX_LDS := $(lds-y) # Rule to link barebox # May be overridden by arch/$(ARCH)/Makefile quiet_cmd_barebox__ ?= LD $@ cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \ - -T $(barebox-lds) \ - --start-group $(barebox-common) --end-group \ - $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^) + -T $(BAREBOX_LDS) \ + --start-group $(BAREBOX_OBJS) --end-group \ + $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^) # Generate new barebox version quiet_cmd_barebox_version = GEN .version
@@ -691,13 +691,13 @@ quiet_cmd_kallsyms = KSYM $@ $(call cmd,kallsyms) # .tmp_barebox1 must be complete except kallsyms, so update barebox version -.tmp_barebox1: $(barebox-lds) $(barebox-all) FORCE +.tmp_barebox1: $(BAREBOX_LDS) $(barebox-all) FORCE $(call if_changed_rule,ksym_ld) -.tmp_barebox2: $(barebox-lds) $(barebox-all) .tmp_kallsyms1.o FORCE +.tmp_barebox2: $(BAREBOX_LDS) $(barebox-all) .tmp_kallsyms1.o FORCE $(call if_changed,barebox__) -.tmp_barebox3: $(barebox-lds) $(barebox-all) .tmp_kallsyms2.o FORCE +.tmp_barebox3: $(BAREBOX_LDS) $(barebox-all) .tmp_kallsyms2.o FORCE $(call if_changed,barebox__) # Needs to visit scripts/ before $(KALLSYMS) can be used.
@@ -767,7 +767,7 @@ barebox.S barebox.s: barebox FORCE endif # barebox image -barebox: $(barebox-lds) $(barebox-common) $(kallsyms.o) FORCE +barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE $(call if_changed_rule,barebox__) $(Q)rm -f .old_version
@@ -776,7 +776,7 @@ barebox.srec: barebox # The actual objects are generated when descending, # make sure no implicit rule kicks in -$(sort $(barebox-common) ) $(barebox-lds) $(BAREBOX_PBL_OBJS): $(barebox-dirs) ; +$(sort $(BAREBOX_OBJS)) $(BAREBOX_LDS) $(BAREBOX_PBL_OBJS): $(barebox-dirs) ; # Handle descending into subdirectories listed in $(barebox-dirs) # Preset locale variables to speed up the build process. Limit locale
arch/mips/Makefile +3 -3
@@ -118,9 +118,9 @@ CFLAGS += $(cflags-y) lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/mips/lib/barebox.lds cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \ - -T $(barebox-lds) \ - --start-group $(barebox-common) --end-group \ - $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^); \ + -T $(BAREBOX_LDS) \ + --start-group $(BAREBOX_OBJS) --end-group \ + $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^); \ $(objtree)/scripts/mips-relocs $@
arch/sandbox/Makefile +2 -2
@@ -56,8 +56,8 @@ ifeq ($(CONFIG_UBSAN),y) SANITIZER_LIBS += -fsanitize=undefined endif -cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \ - -Wl,--start-group $(barebox-common) -Wl,--end-group \ +cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(BAREBOX_LDS) \ + -Wl,--start-group $(BAREBOX_OBJS) -Wl,--end-group \ -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) \ $(SANITIZER_LIBS)
arch/x86/Makefile +2 -2
@@ -77,9 +77,9 @@ lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \ -T $(lds-y) \ -shared -Bsymbolic -nostdlib -znocombreloc \ - --start-group $(barebox-common) \ + --start-group $(BAREBOX_OBJS) \ --end-group \ - $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^) + $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^) quiet_cmd_efi_image = EFI-IMG $@ cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/5 kbuild: replace barebox-all with BAREBOX_OBJS
In reply to Masahiro YamadaReplace $(barebox-all) with $(BAREBOX_OBJS), then delete barebox-all.
---
Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Makefile +3 -4
@@ -585,7 +585,6 @@ export DEFAULT_COMPRESSION_SUFFIX BAREBOX_OBJS := $(common-y) export BAREBOX_PBL_OBJS := $(pbl-common-y) -barebox-all := $(BAREBOX_OBJS) BAREBOX_LDS := $(lds-y) # Rule to link barebox
@@ -691,13 +690,13 @@ quiet_cmd_kallsyms = KSYM $@ $(call cmd,kallsyms) # .tmp_barebox1 must be complete except kallsyms, so update barebox version -.tmp_barebox1: $(BAREBOX_LDS) $(barebox-all) FORCE +.tmp_barebox1: $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE $(call if_changed_rule,ksym_ld) -.tmp_barebox2: $(BAREBOX_LDS) $(barebox-all) .tmp_kallsyms1.o FORCE +.tmp_barebox2: $(BAREBOX_LDS) $(BAREBOX_OBJS) .tmp_kallsyms1.o FORCE $(call if_changed,barebox__) -.tmp_barebox3: $(BAREBOX_LDS) $(barebox-all) .tmp_kallsyms2.o FORCE +.tmp_barebox3: $(BAREBOX_LDS) $(BAREBOX_OBJS) .tmp_kallsyms2.o FORCE $(call if_changed,barebox__) # Needs to visit scripts/ before $(KALLSYMS) can be used.
Signature · 7 lines
2.17.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 4 lines · Masahiro Yamada
This is not set by anyone.
Signed-off-by Masahiro Yamada <[email protected]>---
Applied, thanks
Sascha
Quoted 35 lines
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -781,7 +781,7 @@ barebox.S barebox.s: barebox FORCE endif # barebox image -barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE +barebox: $(barebox-lds) $(barebox-common) $(kallsyms.o) FORCE $(call barebox-modpost) $(call if_changed_rule,barebox__) $(Q)rm -f .old_version@@ -791,7 +791,7 @@ barebox.srec: barebox # The actual objects are generated when descending, # make sure no implicit rule kicks in -$(sort $(barebox-head) $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; +$(sort $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; # Handle descending into subdirectories listed in $(barebox-dirs) # Preset locale variables to speed up the build process. Limit localeSignature · 7 lines
2.17.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