Skip to contentSkip to conversation

final kbuild update before fix-only period

PATCH In review Sam Ravnborg 2 participants 11 messages Sep 10, 2005 – Sep 12, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 final kbuild update before fix-only period

Hi Linus.

Please pull from:
rsync://sync.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git

The updates are pushed to master.kernel.org - still waiting for mirroring to pick them up.

This update contains a fix with make O= for generic asm-offsets.h, plus additional patches from my queue.
This clears my queue of pending patches for 2.6.14.

I will try to follow-up with all patches.

Sam

Jan Beulich:
kbuild: adjust .version updating
kbuild: fix split-include dependency

Roland McGrath:
kbuild: ignore all debugging info sections in scripts/reference_discarded.pl

Sam Ravnborg:
kbuild: add objectify
kbuild: fix generic asm-offsets.h support

[email protected]:
kbuild: CF=<arguments> passes arguments to sparse

Zach Brown:
kbuild: add kernelrelease to 'make help'

 Makefile                         |   23 ++++++++++++++++-------
 b/Kbuild                         |    5 +++--
 b/Makefile                       |    2 +-
 b/scripts/Kbuild.include         |    3 +++
 b/scripts/reference_discarded.pl |    7 +------
 5 files changed, 24 insertions(+), 16 deletions(-)
#1 lore raw

PATCH 1/7 kbuild: add kernelrelease to 'make help'

It sems git-send-emails fooled me again.
So here follows the patches send manually.

Quoted 1 line

From nobody Mon Sep 17 00:00:00 2001

Subject: [PATCH 1/7] kbuild: add kernelrelease to 'make help'
From: Zach Brown <[email protected]>
Date: 1126120103 -0700

Dunno if there was a conscious decision to leave it out, but if you're happy with adding some help text for it here's a patch against 2.6.13-mm1..

---

 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

6d12884259ac65f74538b7819f5fadf4ebb0d569

Makefile +1 -0
@@ -1053,6 +1053,7 @@ help:
 	@echo  '  rpm		  - Build a kernel as an RPM package'
 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
+	@echo  '  kernelrelease	  - Output the release version string'
 	@echo  ''
 	@echo  'Static analysers'
 	@echo  '  buildcheck      - List dangling references to vmlinux discarded sections'
#2 lore raw

PATCH 2/7 kbuild: CF=<arguments> passes arguments to sparse

In reply to Sam Ravnborg

Allows to add to sparse arguments without mutilating makefiles - just pass CF=<arguments> and they will be added to CHECKFLAGS.

---

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

7b49bb9aff8b14d15da58111d8908c877c0a525e

Makefile +1 -1
@@ -334,7 +334,7 @@ KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
 
-CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
+CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF)
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
#3 lore raw

PATCH 3/7 kbuild: adjust .version updating

In reply to Sam Ravnborg

In order to maintain a more correct build number, updates to the version
number should only be commited after a successful link of vmlinux, not before (so that errors in the link process don't lead to pointless increments).

---

 Makefile |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

4e25d8bb9550fb5912165196fe8502cdb831a336

Makefile +8 -2
@@ -641,8 +641,13 @@ quiet_cmd_vmlinux__ ?= LD      $@
 # Generate new vmlinux version
 quiet_cmd_vmlinux_version = GEN     .version
       cmd_vmlinux_version = set -e;                     \
-	. $(srctree)/scripts/mkversion > .tmp_version;	\
-	mv -f .tmp_version .version;			\
+	if [ ! -r .version ]; then			\
+	  rm -f .version;				\
+	  echo 1 >.version;				\
+	else						\
+	  mv .version .old_version;			\
+	  expr 0$$(cat .old_version) + 1 >.version;	\
+	fi;						\
 	$(MAKE) $(build)=init
 
 # Generate System.map
@@ -756,6 +761,7 @@ endif # ifdef CONFIG_KALLSYMS
 # vmlinux image - including updated kernel symbols
 vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
 	$(call if_changed_rule,vmlinux__)
+	$(Q)rm -f .old_version
 
 # The actual objects are generated when descending, 
 # make sure no implicit rule kicks in
#4 lore raw

PATCH 4/7 kbuild: fix split-include dependency

In reply to Sam Ravnborg

Splitting of autoconf.h requires that split-include was built before, and
needs to be-re-done when split-include changes. This dependency was previously missing. Additionally, since autoconf.h is (suppoosed to be)
generated as a side effect of executing config targets, include/linux should be created prior to running the respective sub-make.

---

 Makefile |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

cd05e6bdc6001ac6e8ab13720693b7e1302d9848

Makefile +6 -4
@@ -382,6 +382,9 @@ RCS_TAR_IGNORE := --exclude SCCS --exclu
 scripts_basic:
 	$(Q)$(MAKE) $(build)=scripts/basic
 
+# To avoid any implicit rule to kick in, define an empty command.
+scripts/basic/%: scripts_basic ;
+
 .PHONY: outputmakefile
 # outputmakefile generate a Makefile to be placed in output directory, if
 # using a seperate output directory. This allows convinient use
@@ -444,9 +447,8 @@ ifeq ($(config-targets),1)
 include $(srctree)/arch/$(ARCH)/Makefile
 export KBUILD_DEFCONFIG
 
-config: scripts_basic outputmakefile FORCE
-	$(Q)$(MAKE) $(build)=scripts/kconfig $@
-%config: scripts_basic outputmakefile FORCE
+config %config: scripts_basic outputmakefile FORCE
+	$(Q)mkdir -p include/linux
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
 else
@@ -854,7 +856,7 @@ include/asm:
 
 # 	Split autoconf.h into include/linux/config/*
 
-include/config/MARKER: include/linux/autoconf.h
+include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h
 	@echo '  SPLIT   include/linux/autoconf.h -> include/config/*'
 	@scripts/basic/split-include include/linux/autoconf.h include/config
 	@touch $@
#5 lore raw

PATCH 5/7 kbuild: ignore all debugging info sections in scripts/reference_discarded.pl

In reply to Sam Ravnborg

GCC 4 emits more DWARF debugging information than before and there is now a .debug_loc section as well. This causes "make buildcheck" to fail. Rather than just add that one to the special case list, I used a regexp to ignore any .debug_ANYTHING sections in case more show up in the future.

---

 scripts/reference_discarded.pl |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

caba0233bc85ec311159a35f138d957d05cf2fe8

scripts/reference_discarded.pl +1 -6
@@ -91,12 +91,7 @@ foreach $object (keys(%object)) {
 		     $from !~ /\.exit\.data$/ &&
 		     $from !~ /\.altinstructions$/ &&
 		     $from !~ /\.pdr$/ &&
-		     $from !~ /\.debug_info$/ &&
-		     $from !~ /\.debug_aranges$/ &&
-		     $from !~ /\.debug_ranges$/ &&
-		     $from !~ /\.debug_line$/ &&
-		     $from !~ /\.debug_frame$/ &&
-		     $from !~ /\.debug_loc$/ &&
+		     $from !~ /\.debug_.*$/ &&
 		     $from !~ /\.exitcall\.exit$/ &&
 		     $from !~ /\.eh_frame$/ &&
 		     $from !~ /\.stab$/)) {
#6 lore raw

PATCH 6/7 kbuild: add objectify

In reply to Sam Ravnborg

Use foo := $(call objectify, $(foo)) to prefix $(foo) with $(obj)/ unless $(foo) is an absolute path.
For now no in-tree users - soon to come.

---

 scripts/Kbuild.include |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

0a504f259c90fb41d3495d490fc9dbe2530c8749

scripts/Kbuild.include +3 -0
@@ -49,6 +49,9 @@ build := -f $(if $(KBUILD_SRC),$(srctree
 cmd = @$(if $($(quiet)cmd_$(1)),\
       echo '  $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
 
+# Add $(obj)/ for paths that is not absolute
+objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
+
 ###
 # if_changed      - execute command if any prerequisite is newer than 
 #                   target, or command line has changed
#7 lore raw

PATCH 7/7 kbuild: fix generic asm-offsets.h support

In reply to Sam Ravnborg

This fixes a bug where the generated asm-offsets.h file was saved in the source tree even with make O=.
Thanks to Stephen Rothwell <[email protected]> for the report.

---

 Kbuild   |    5 +++--
 Makefile |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

8d36a62364b6b04dc7b0e9fe09f6968f4e5a1f0a

Kbuild +3 -2
@@ -4,7 +4,7 @@
 # 1) Generate asm-offsets.h
 
 #####
-# 1) Generate asm-offsets.h 
+# 1) Generate asm-offsets.h
 #
 
 offsets-file := include/asm-$(ARCH)/asm-offsets.h
@@ -22,6 +22,7 @@ sed-$(CONFIG_MIPS) := "/^@@@/s///p"
 
 quiet_cmd_offsets = GEN     $@
 define cmd_offsets
+	mkdir -p $(dir $@); \
 	cat $< | \
 	(set -e; \
 	 echo "#ifndef __ASM_OFFSETS_H__"; \
@@ -43,6 +44,6 @@ arch/$(ARCH)/kernel/asm-offsets.s: arch/
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cc_s_c)
 
-$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
+$(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
 	$(call cmd,offsets)
 
Makefile +1 -1
@@ -814,7 +814,7 @@ ifneq ($(KBUILD_MODULES),)
 endif
 
 prepare0: prepare prepare1 FORCE
-	$(Q)$(MAKE) $(build)=$(srctree)
+	$(Q)$(MAKE) $(build)=.
 
 # All the preparing..
 prepare-all: prepare0
#8 lore raw
In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg

Hi Linus.

Please pull from:
rsync://sync.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git

Quoted 8 lines

The updates are pushed to master.kernel.org - still waiting for mirroring to pick them up.

This update contains a fix with make O= for generic asm-offsets.h, plus additional patches from my queue.
This clears my queue of pending patches for 2.6.14.

I will try to follow-up with all patches.

Hi Sam,

BUG()s etc which are using __FILE__ to get source filename print horribly long names like

/.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c

if one builds kernel in separate object dir.
This is ugly and wastes space in kernel image. Any ideas how to fix this? --
vda

#9 lore raw
Quoted 9 lines

Hi Sam,

BUG()s etc which are using __FILE__ to get source filename print horribly long names like

/.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c

if one builds kernel in separate object dir.
This is ugly and wastes space in kernel image. Any ideas how to fix this?

I have once experimenting with this on request from Olaf. The only way I could fine was to pass a new define:
-DKBUILD_FILE='short-file-name' to gcc.
This has the sideeffect that we always accuse the main .c file for being the culprint.
gcc warns if we override __FILE__

__FILE__ is used in 123 files of wich 26 is within arch/ so it will take a while to change...

I can cook up something if there is interest.

Sam

#10 lore raw
Quoted 15 lines · Sam Ravnborg
Quoted 7 lines

BUG()s etc which are using __FILE__ to get source filename print horribly long names like

/.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c

if one builds kernel in separate object dir.
This is ugly and wastes space in kernel image. Any ideas how to fix this?

I have once experimenting with this on request from Olaf. The only way I could fine was to pass a new define:
-DKBUILD_FILE='short-file-name' to gcc.
This has the sideeffect that we always accuse the main .c file for being the culprint.
gcc warns if we override __FILE__

Quoted 2 lines

__FILE__ is used in 123 files of wich 26 is within arch/ so it will take a while to change...

I think the worst offender is BUG/BUG_ON():

# grep -r BUG . | grep -v DEBUG | wc -l
5208

~5000 copies of "/.share/usr/src2/kernel/linux-2.6.13-mm2.src" string in my kernel??! That's not funny...

Quoted 1 line

I can cook up something if there is interest.

/me is interested.
--
vda