* [PATCH 2/5] kbuild: remove dead code for modpost
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
@ 2020-03-10 11:28 ` Masahiro Yamada
2020-03-10 11:28 ` [PATCH 3/5] kbuild: rename barebox-pbl-common to BAREBOX_PBL_OBJS Masahiro Yamada
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-10 11:28 UTC (permalink / raw)
To: barebox; +Cc: Masahiro Yamada
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)
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/Makefile b/Makefile
index 1fa09b041360..e9e412af0815 100644
--- a/Makefile
+++ b/Makefile
@@ -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
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/5] kbuild: rename barebox-pbl-common to BAREBOX_PBL_OBJS
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
2020-03-10 11:28 ` [PATCH 2/5] kbuild: remove dead code for modpost Masahiro Yamada
@ 2020-03-10 11:28 ` Masahiro Yamada
2020-03-10 11:28 ` [PATCH 4/5] kbuild: rename barebox-{common, lds} to BAREBOX_{OBJS, LDS} Masahiro Yamada
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-10 11:28 UTC (permalink / raw)
To: barebox; +Cc: 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.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 5 ++---
arch/mips/pbl/Makefile | 2 +-
images/Makefile | 4 ++--
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index e9e412af0815..20fa85ed8be4 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/arch/mips/pbl/Makefile b/arch/mips/pbl/Makefile
index 44ce3d1c922e..8f9e9fe5931c 100644
--- a/arch/mips/pbl/Makefile
+++ b/arch/mips/pbl/Makefile
@@ -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 $@
diff --git a/images/Makefile b/images/Makefile
index 650baf170f1b..fe29c75e27b1 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -57,12 +57,12 @@ quiet_cmd_elf__ ?= LD $@
cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections \
-e $(2) -Map $@.map $(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
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/5] kbuild: rename barebox-{common, lds} to BAREBOX_{OBJS, LDS}
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
2020-03-10 11:28 ` [PATCH 2/5] kbuild: remove dead code for modpost Masahiro Yamada
2020-03-10 11:28 ` [PATCH 3/5] kbuild: rename barebox-pbl-common to BAREBOX_PBL_OBJS Masahiro Yamada
@ 2020-03-10 11:28 ` Masahiro Yamada
2020-03-10 11:28 ` [PATCH 5/5] kbuild: replace barebox-all with BAREBOX_OBJS Masahiro Yamada
2020-03-11 15:11 ` [PATCH 1/5] kbuild: remove unused barebox-head Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-10 11:28 UTC (permalink / raw)
To: barebox; +Cc: Masahiro Yamada
The 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.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 22 +++++++++++-----------
arch/mips/Makefile | 6 +++---
arch/sandbox/Makefile | 4 ++--
arch/x86/Makefile | 4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
index 20fa85ed8be4..40d146e511ac 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 486dfd82533c..ee3364d27a89 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -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 $@
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index b127560a2b8c..b7470c3330eb 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -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)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 0751e6364999..4d471c2f8ae0 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -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 \
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/5] kbuild: replace barebox-all with BAREBOX_OBJS
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
` (2 preceding siblings ...)
2020-03-10 11:28 ` [PATCH 4/5] kbuild: rename barebox-{common, lds} to BAREBOX_{OBJS, LDS} Masahiro Yamada
@ 2020-03-10 11:28 ` Masahiro Yamada
2020-03-11 15:11 ` [PATCH 1/5] kbuild: remove unused barebox-head Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-10 11:28 UTC (permalink / raw)
To: barebox; +Cc: Masahiro Yamada
Replace $(barebox-all) with $(BAREBOX_OBJS), then delete barebox-all.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 40d146e511ac..c18244e761f9 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/5] kbuild: remove unused barebox-head
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
` (3 preceding siblings ...)
2020-03-10 11:28 ` [PATCH 5/5] kbuild: replace barebox-all with BAREBOX_OBJS Masahiro Yamada
@ 2020-03-11 15:11 ` Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2020-03-11 15:11 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: barebox
On Tue, Mar 10, 2020 at 08:28:12PM +0900, Masahiro Yamada wrote:
> This is not set by anyone.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
Applied, thanks
Sascha
>
> Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d923463ed5e3..1fa09b041360 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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
> --
> 2.17.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread