Skip to contentSkip to conversation

Kbuild updates

DISCUSSION Sam Ravnborg 2 participants 9 messages Aug 18, 2004

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

Another bunch of smallish kbuild updates.

o Fix parrallel build
o Add make C=2 to force check of C code with sparse
o Fiw warnings in binoffset
o Removed dreadful check for undefined symbols in vmlinux
o Delete last occurence of HEAD in kbuild
o Add comments to Makefile.clean
o Introduce CHECKFLAGS enabling make CHECK=mysparse

Patches follows (most have been sent to lkml before).

Significant outstanding items in kbuild land is mainly package handling.
Several issues needs to be adressed:
- Rename debian directory to deb/debian
- Utilise parallel build with make rpm
- Add one more prm package variant
- Add tar-pkg, targz.pkg
- Find a better way to identify relevant binaries to include in rpm, deb
- Current KBUILD_IMAGE proves not to be good enough

And a patch relate to control alignment in gcc produced code. Needs to land some consolidation stuff first. Planning to rename check_gcc to gcc_option, and include a new one named gcc_option_ok.

For ppc we have a problem with as trashing /dev/null.
This is apperantly due to this code:
BAD_AGCC_AS := $(shell echo mftb 5 | $(AS) -mppc -many -o /dev/null >/dev/null 2>&1 && echo 0 || echo 1)

It seem like as deletes /dev/null and recreate it.
Not good if run as root - which is needed for modules_install for example.

Would it be considered acceptable to start using mktemp to generate temporary filenames as part of a normal kernel build?
I do not fully understand the eventual security issues around this!

Sam

#1 lore raw

kbuild: Fix warnings in binoffset.c

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/18 00:02:40+02:00 [email protected]
# fix warnings in scripts/binoffset.c
#
# Correct gcc warnings for function return type, printf argument
# types, and signed/unsigned compare.
#

#   Cross-compiled with no warnings/errors for alpha, ia64,
#   ppc32, ppc64, sparc32, sparc64, x86_64, and native on i386.
#   (-W -Wall)

#
# [pre-built tool chains are available from:
# http://developer.osdl.org/dev/plm/cross_compile/ ]
#
# Signed-off-by: Randy Dunlap <[email protected]>
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/binoffset.c
#   2004/08/10 05:28:01+02:00 [email protected] +6 -6
#   fix warnings in scripts/binoffset.c
# 
diff -Nru a/scripts/binoffset.c b/scripts/binoffset.c
--- a/scripts/binoffset.c	2004-08-19 01:06:15 +02:00
+++ b/scripts/binoffset.c	2004-08-19 01:06:15 +02:00
@@ -41,7 +41,7 @@
 char		*progname;
 char		*inputname;
 int		inputfd;
-int		bix;			/* buf index */
+unsigned int	bix;			/* buf index */
 unsigned char	patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */
 int		pat_len;		/* actual number of pattern bytes */
 unsigned char	*madr;			/* mmap address */
@@ -58,7 +58,7 @@
 	exit (1);
 }

-int get_pattern (int pat_count, char *pats [])
+void get_pattern (int pat_count, char *pats [])
{
int ix, err, tmp;

@@ -81,7 +81,7 @@
pat_len = pat_count;
}

-int search_pattern (void)
+void search_pattern (void)
{
for (bix = 0; bix < filesize; bix++) {
if (madr[bix] == patterns[0]) {
@@ -109,7 +109,7 @@
struct stat stat;

err = fstat (fd, &stat);
- fprintf (stderr, "filesize: %d\n", err < 0 ? err : stat.st_size);
+ fprintf (stderr, "filesize: %ld\n", err < 0 ? (long)err : stat.st_size);
if (err < 0)
return err;
return (size_t) stat.st_size;
@@ -154,8 +154,8 @@
fprintf (stderr, "number of pattern matches = %d\n", num_matches); if (num_matches == 0)
firstloc = ~0;
- printf ("%d\n", firstloc);
- fprintf (stderr, "%d\n", firstloc);
+ printf ("%ld\n", firstloc);
+ fprintf (stderr, "%ld\n", firstloc);

exit (num_matches ? 0 : 2);
}

#2 lore raw

kbuild: make C=2 forces sparse run

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/17 23:02:08+02:00 [email protected]
# kbuild: make C=2 now force sparse to be run for all .c files
#

#   With make C=2 sparse ($(CHECK)) will be run on all .c files also if they
#   do not need to be compiled.
#   Usefull to run sparse on a fully compiled kernel tree.
#   Implemented on request from Al Viro (although he liked to be able to
#   run sparse without building any source).

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.build
# 2004/08/17 23:01:51+02:00 [email protected] +9 -2
# Allow sparse to be forced to be used - for all .c files.
#
# Makefile
# 2004/08/17 23:01:51+02:00 [email protected] +2 -1
# Document how to force use of sparse, even when no source needs to be compiled.
#

Makefile +2 -1
diff -Nru a/Makefile b/Makefile
@@ -958,7 +958,8 @@
 
 	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
-	@echo  '  make C=1   [targets] Check all c source with checker tool'
+	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse)'
+	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK (sparse)'
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +9 -2
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
@@ -83,8 +83,13 @@
 
 # Linus' kernel sanity checking tool
 ifneq ($(KBUILD_CHECKSRC),0)
-quiet_cmd_checksrc = CHECK   $<
-      cmd_checksrc = $(CHECK) $(c_flags) $< ;
+  ifeq ($(KBUILD_CHECKSRC),2)
+    quiet_cmd_force_checksrc = CHECK   $<
+          cmd_force_checksrc = $(CHECK) $(c_flags) $< ;
+  else
+      quiet_cmd_checksrc     = CHECK   $<
+            cmd_checksrc     = $(CHECK) $(c_flags) $< ;
+  endif
 endif
 
 
@@ -182,11 +187,13 @@
 # Built-in and composite module parts
 
 %.o: %.c FORCE
+	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): %.o: %.c FORCE
+	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 	@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
 
#3 lore raw

kbuild: Remove last occurrence of HEAD

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/18 23:09:23+02:00 [email protected]
# kbuild: remove obsolete HEAD in kbuild
#
# Makefile: remove obsolete HEAD
# arch/cris/Makefile: replace HEAD with assignment to head-y
#
#
# Signed-off-by: Coywolf Qi Hunt <[email protected]>
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# arch/cris/Makefile
# 2004/08/18 04:48:40+02:00 [email protected] +1 -1
# kbuild: remove obsolete HEAD in kbuild
#
# Makefile
# 2004/08/15 11:46:41+02:00 [email protected] +0 -1
# kbuild: remove obsolete HEAD in kbuild
#

Makefile +0 -1
diff -Nru a/Makefile b/Makefile
@@ -510,7 +510,6 @@
 #       normal descending-into-subdirs phase, since at that time
 #       we cannot yet know if we will need to relink vmlinux.
 #	So we descend into init/ inside the rule for vmlinux again.
-head-y += $(HEAD)
 vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
 
 quiet_cmd_vmlinux__ = LD      $@
arch/cris/Makefile +1 -1
diff -Nru a/arch/cris/Makefile b/arch/cris/Makefile
@@ -39,7 +39,7 @@
 CFLAGS += -fno-omit-frame-pointer
 endif
 
-HEAD := arch/$(ARCH)/$(SARCH)/kernel/head.o
+head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
 
 LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a)
 
#4 lore raw

kbuild: Add comments to Makefile.clean

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/18 23:17:03+02:00 [email protected]
# kbuild: add comments to Makefile.clean
#

#   Chris Wedgwood <[email protected]> wrote:
#   > P.S. I'd love to see the rules in scripts/Makefile.* documented.  I
#   >      would offer a patch for this but I don't understand the rules
#   >      myself...
#   And provided the following patch, slightly modified by me.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.clean
# 2004/08/18 23:16:47+02:00 [email protected] +12 -0
# Add comments
#

scripts/Makefile.clean +12 -0
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
@@ -29,13 +29,25 @@
 # Add subdir path
 
 subdir-ymn	:= $(addprefix $(obj)/,$(subdir-ymn))
+
+# build a list of files to remove, usually releative to the current
+# directory
+
 __clean-files	:= $(extra-y) $(EXTRA_TARGETS) $(always) \
 		   $(targets) $(clean-files)             \
 		   $(host-progs)                         \
 		   $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
+
+# as clean-files is given relative to the current directory, this adds
+# a $(obj) prefix, except for absolute paths
+
 __clean-files   := $(wildcard                                               \
                    $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
 		   $(filter /%, $(__clean-files)))
+
+# as clean-dirs is given relative to the current directory, this adds
+# a $(obj) prefix, except for absolute paths
+
 __clean-dirs    := $(wildcard                                               \
                    $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs)))    \
 		   $(filter /%, $(clean-dirs)))
#5 lore raw

kbuild: Fix parallel build

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/17 22:35:04+02:00 [email protected]
# kbuild: Fix parallel build in a distclean'ed tree
#
# Fixes the following error:
# make: *** No rule to make target .tmp_kallsyms2.S', needed by .tmp_kallsyms2.o'.
#

#   Problem is that make does not know it have to visit scripts before it can use $(KALLSYMS)
#   $(KALLSYMS) is a dependency to .tmp_kallsyms% but make suddenly complains about
#   .tmp_kallsyms2 for some reasons.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# Makefile
# 2004/08/17 22:34:48+02:00 [email protected] +3 -0
# Needs to tell make that $(KALLSYMS) is only build after visiting scripts
#

Makefile +3 -0
diff -Nru a/Makefile b/Makefile
@@ -600,6 +600,9 @@
 .tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds FORCE
 	$(call if_changed_rule,vmlinux__)
 
+# Needs to visit scripts/ before $(KALLSYMS) can be used.
+$(KALLSYMS): scripts ;
+
 endif
 
 # Finally the vmlinux rule
#6 lore raw

kbuild: Added CHECKFLAGS to enable 'make CHECK=mysparse'

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/18 23:31:32+02:00 [email protected]
# kbuild/all archs: added CHECKFLAGS
#

#   Using separate assignment for CHECKFLAGS allows convenient redefinition of CHECK
#   on the command line:
#   make CHECK=~/bin64/sparse C=2
#   to use a special 64 bit version.
#   Introduced usage in all archs that assined values to CHECK.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.build
# 2004/08/18 23:31:15+02:00 [email protected] +2 -2
# Use CHECKFLAGS
#
# arch/x86_64/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/sparc64/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/sparc/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/ppc64/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/ppc/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/m68k/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/i386/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/arm/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# arch/alpha/Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +1 -1
# Replace assigment to CHECK with assignment to CHECKFLAGS
#
# Makefile
# 2004/08/18 23:31:15+02:00 [email protected] +2 -1
# Introduce CHECKFLAGS
#

Makefile +2 -1
diff -Nru a/Makefile b/Makefile
@@ -285,6 +285,7 @@
 KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
+CHECKFLAGS     :=
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
@@ -308,7 +309,7 @@
 export	VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
 	CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
 	CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
-	HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
+	HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK CHECKFLAGS
 
 export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 
arch/alpha/Makefile +1 -1
diff -Nru a/arch/alpha/Makefile b/arch/alpha/Makefile
@@ -11,7 +11,7 @@
 NM := $(NM) -B
 
 LDFLAGS_vmlinux	:= -static -N #-relax
-CHECK		:= $(CHECK) -D__alpha__=1
+CHECKFLAGS	+= -D__alpha__=1
 cflags-y	:= -pipe -mno-fp-regs -ffixed-8
 
 # Determine if we can use the BWX instructions with GAS.
arch/arm/Makefile +1 -1
diff -Nru a/arch/arm/Makefile b/arch/arm/Makefile
@@ -58,7 +58,7 @@
 CFLAGS		+=-mapcs-32 $(arch-y) $(tune-y) $(call check_gcc,-malignment-traps,-mshort-load-bytes) -msoft-float -Wa,-mno-fpu -Uarm
 AFLAGS		+=-mapcs-32 $(arch-y) $(tune-y) -msoft-float -Wa,-mno-fpu
 
-CHECK		:= $(CHECK) -D__arm__=1
+CHECKFLAGS	+= -D__arm__=1
 
 #Default value
 DATAADDR	:= .
arch/i386/Makefile +1 -1
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
@@ -18,7 +18,7 @@
 LDFLAGS		:= -m elf_i386
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux :=
-CHECK		:= $(CHECK) -D__i386__=1
+CHECKFLAGS	+= -D__i386__=1
 
 CFLAGS += -pipe -msoft-float
 
arch/m68k/Makefile +1 -1
diff -Nru a/arch/m68k/Makefile b/arch/m68k/Makefile
@@ -28,7 +28,7 @@
 LDFLAGS_vmlinux = -N
 endif
 
-CHECK := $(CHECK) -D__mc68000__=1 -I$(shell $(CC) -print-file-name=include)
+CHECKFLAGS += -D__mc68000__=1 -I$(shell $(CC) -print-file-name=include)
 
 # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
 CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
arch/ppc/Makefile +1 -1
diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
@@ -27,7 +27,7 @@
 		-ffixed-r2 -Wno-uninitialized -mmultiple
 CPP		= $(CC) -E $(CFLAGS)
 
-CHECK		:= $(CHECK) -D__powerpc__=1
+CHECKFLAGS	+= -D__powerpc__=1
 
 ifndef CONFIG_E500
 CFLAGS		+= -mstring
arch/ppc64/Makefile +1 -1
diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile
@@ -22,7 +22,7 @@
 CC		:= $(CC) -m64
 endif
 
-CHECK		:= $(CHECK) -m64 -D__powerpc__=1
+CHECKFLAGS	+= -m64 -D__powerpc__=1
 
 LDFLAGS		:= -m elf64ppc
 LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
arch/sparc/Makefile +1 -1
diff -Nru a/arch/sparc/Makefile b/arch/sparc/Makefile
@@ -13,7 +13,7 @@
 
 AS              := $(AS) -32
 LDFLAGS		:= -m elf32_sparc
-CHECK		:= $(CHECK) -D__sparc__=1
+CHECKFLAGS	+= -D__sparc__=1
 
 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
 CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
arch/sparc64/Makefile +1 -1
diff -Nru a/arch/sparc64/Makefile b/arch/sparc64/Makefile
@@ -8,7 +8,7 @@
 # Copyright (C) 1998 Jakub Jelinek ([email protected])
 #
 
-CHECK		:= $(CHECK) -D__sparc__=1 -D__sparc_v9__=1
+CHECKFLAGS	+= -D__sparc__=1 -D__sparc_v9__=1
 
 CPPFLAGS_vmlinux.lds += -Usparc
 
arch/x86_64/Makefile +1 -1
diff -Nru a/arch/x86_64/Makefile b/arch/x86_64/Makefile
@@ -37,7 +37,7 @@
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux := -e stext
 
-CHECK           := $(CHECK) -D__x86_64__=1
+CHECKFLAGS      += -D__x86_64__=1
 
 cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,)
 cflags-$(CONFIG_MPSC) += $(call check_gcc,-march=nocona,)
scripts/Makefile.build +2 -2
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
@@ -85,10 +85,10 @@
 ifneq ($(KBUILD_CHECKSRC),0)
   ifeq ($(KBUILD_CHECKSRC),2)
     quiet_cmd_force_checksrc = CHECK   $<
-          cmd_force_checksrc = $(CHECK) $(c_flags) $< ;
+          cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
   else
       quiet_cmd_checksrc     = CHECK   $<
-            cmd_checksrc     = $(CHECK) $(c_flags) $< ;
+            cmd_checksrc     = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
   endif
 endif
 
#8 lore raw

kernel 2.6 and networking enhancements

Hi,
I will really appreciate if someone can point me to documents, notes, papers etc. about the enhancements in the networking stack of kernel 2.6, guidelines for NIC driver development to make use of such enhancements, ipsec offload, tcp offload etc.

Thanks,
Imran.