Skip to contentSkip to conversation

kbuild updates

PATCH In review Sam Ravnborg 2 participants 14 messages Aug 13, 2004 – Aug 14, 2004

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

This is the accumulated list of kbuild patches.
Mostly trivial stuff but also a bit of interest:

o replaced host-progs with hostprogs-y
o Use a shell script to generate System.map
Includes check for undefined symbols in vmlinux Filter out __crc_ from System.map
-> This replaces two other patches in -mm
- rmk's ldchk function
- wli btfixup patch, number 13 in his serie
This patch replaces both
o Randy's patch to put version in .config
o One patch to a few files so we use POSIX header in some of the tools.
This is a slow start on improving the build on non-linux platforms.

This does in no way clear my kbuild queue - but the rest is put on hold for a while.

Everything pushed to:
bk://linux-sam.bkbits.net/kbuild

When the patches has been in -mm for a while they will be pushed to Linus.
None of this is pre 2.6.8 material.

Patches will follow in seperate mails.

Sam

Files touched:

 Documentation/DocBook/Makefile     |    4 
 Documentation/kbuild/makefiles.txt |   50 ++++++++----
 Makefile                           |   37 ++++++--
 arch/alpha/boot/Makefile           |    2 
 arch/i386/boot/Makefile            |    4 
 arch/ppc/boot/Makefile             |    4 
 arch/ppc64/boot/Makefile           |    4 
 arch/sparc/boot/Makefile           |   42 +++++++---
 arch/sparc64/boot/Makefile         |    2 
 arch/um/sys-i386/util/Makefile     |    4 
 arch/x86_64/boot/Makefile          |    2 
 drivers/atm/Makefile               |    2 
 drivers/md/Makefile                |    2 
 drivers/media/dvb/ttpci/Makefile   |    2 
 drivers/pci/Makefile               |    2 
 drivers/zorro/Makefile             |    2 
 lib/Makefile                       |    2 
 scripts/Makefile                   |   17 ++--
 scripts/Makefile.build             |   94 ++--------------------
 scripts/Makefile.clean             |   32 +++++--
 scripts/Makefile.host              |  154 +++++++++++++++++++++++++++++++++++++
 scripts/Makefile.lib               |   49 -----------
 scripts/basic/Makefile             |    4 
 scripts/basic/fixdep.c             |    2 
 scripts/genksyms/Makefile          |    4 
 scripts/kconfig/Makefile           |    2 
 scripts/kconfig/confdata.c         |   17 +++-
 scripts/lxdialog/Makefile          |    4 
 scripts/mksysmap                   |   61 ++++++++++++++
 scripts/mod/Makefile               |    4 
 scripts/mod/sumversion.c           |    2 
 scripts/package/Makefile           |    6 -
 sound/oss/Makefile                 |    2 
 usr/Makefile                       |    2 
 34 files changed, 406 insertions(+), 217 deletions(-)

through these ChangeSets:

<[email protected]> (04/08/13 1.1912)
kbuild: __crc_* symbols in System.map

David S. Miller <[email protected]> wrote:
Shouldn't we be grepping __crc_ symbols out of the System.map file?

For one thing, these can confuse readprofile. It's algorithm is to start at _stext, then stop when it sees a line in the System.map which is not text (mode is one of 'T' 't' 'W' or 'w')

It will exit early if there are some intermixed __crc_* things in there (since they are are mode 'A').

For example, in my current sparc64 kernel I have this:

00000000004cef80 t do_split
00000000004cf2a0 t add_dirent_to_buf
00000000004cf5a7 A __crc_init_special_inode
00000000004cf640 t make_indexed_dir
00000000004cf900 t ext3_add_entry

So no symbols after add_dirent_to_buf will be shown in the profiling output of readprofile.

Implementation ported to mksysmap by Sam.
Included two System.map related fixes:
- Print "SYSMAP System.map" during build
- Sort symbols in System.map

<[email protected]> (04/08/10 1.1911)
kbuild: Use POSIX headers for ntoh functions

From: Benno <[email protected]>
When compiling Linux on Mac OSX I had trouble with scripts/sumversion.c. It includes <netinet/in.h> to obtain to definitions of htonl and ntohl.

On Mac OSX these are found in <arpa/inet.h>. After checking the POSIX specification it appears that this is the correct place to get the definitons for these functions.

(http://www.opengroup.org/onlinepubs/009695399/functions/htonl.html)

Using this header also appears to work on Linux (at least with Glibc-2.3.2).

It seems clearer to me to go with the POSIX standard than implementing #if __APPLE__ style macros, but if such an approach is preferred I can supply patches for that instead.

<[email protected]> (04/08/10 1.1910)
kbuild: Fix hostprogs-y

Allow the same target to be specified more than once without causing a warnign from make. The same target may be specified twice when using the following pattern:
hostprogs-$(CONFIG_FOO) += program
hostprogs-$(CONFIG_BAR) += program

<[email protected]> (04/08/10 1.1909)
kbuild: Replace host-progs with hostprogs-y

<[email protected]> (04/08/10 1.1908)
kbuild: Introduce hostprogs-y, deprecate host-progs

Introducing hostprogs-y allows a user to use the typical Kbuild pattern in a Kbuild file:
hostprogs-$(CONFIG_KALLSYMS) += ...

And then during cleaning the referenced file are still deleted. Deprecate the old host-progs assignment but kept the functionlity.

External modules will continue to use host-progs for a while - drawback is that they now see a warning.
Workaround - just assign both variables:
hostprogs-y := foo
host-progs := $(hostprogs-y)

All in-kernel users will be converted in next patch.

<[email protected]> (04/08/10 1.1907)
kbuild: Separate out host-progs handling

Concentrating all host-progs functionality in one file made a more readable Makefile.lib - and allow for potential reuse of host-progs functionality.
Processing of host-progs related stuff are avoided when no host-progs are specified.

<[email protected]> (04/08/09 1.1906)
kbuild: Accept absolute paths in clean-files and introduce clean-dirs

Teach kbuild to accept absolute paths in clean-files. This avoids using clean-rules in several places.
Introduced clean-dirs to delete complete directories.
Kept clean-rule - but do not print anything when used. Cleaned up a few places now the infrastructure are improved.

<[email protected]> (04/08/08 1.1905)
kbuild: Use LINUXINCLUDE to specify include/ directory

Peter Chubb <[email protected]> reported that building i386 on a non-i386 platform failed, because gcc could not locate boot.h. Root cause was the extra include2 directory used when using O= to specify the output directory.
Added LINUXINCLUDE as a portable way to specify the include/ directory, and changed the two users.
This avoids hardcoding 'include2' in non-kbuild core files.

<[email protected]> (04/08/08 1.1904)
kbuild: Selective compile of targets in scripts/

Do not build executables unless needed.
Same goes for scripts/mod/, descend only when CONFIG_MODULES are enabled.
With inputs form: Russell King <[email protected]> and Brian Gerst <[email protected]>

<[email protected]> (04/08/08 1.1903)
kconfig: save kernel version in .config file

Save kernel version info and date when writing .config file. Tested with 'make {menuconfig|xconfig|gconfig}'.

<[email protected]> (04/08/08 1.1902)
kbuild/sparc: Use new generic mksysmap script to generate System.map

o Introduced usage of the mksysmap script.
o Improved the non-verbose output to look like this:

     BTFIX   arch/sparc/boot/btfix.S
     AS      arch/sparc/boot/btfix.o
     LD      arch/sparc/boot/image
     SYSMAP  arch/sparc/boot/System.map

o No longer generate System.map for each build
o Use normal AS rule to compile btfix.S

<[email protected]> (04/08/07 1.1901)
kbuild: Check for undefined symbols in vmlinux

At least one bin-utils version for ARM is know to ignore undefined symbols when performing the final link of vmlinux.
Add an explicit check for undefined symbols to catch this. The check is made in combination with generating the System.map file and the actual algorithm is moved to a small shell script - mksysmap.

External symbols with three leading underscores are ignored - sparc uses them for the BTFIXUP logic.

#1 lore raw

PATCH 1/12 kbuild: Check for undefined symbols in vmlinux

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/07 21:35:44+02:00 [email protected]
# kbuild: Check for undefined symbols in vmlinux
#

#   At least one bin-utils version for ARM is know to ignore undefined
#   symbols when performing the final link of vmlinux.
#   Add an explicit check for undefined symbols to catch this.
#   The check is made in combination with generating the System.map file
#   and the actual algorithm is moved to a small shell script - mksysmap.

#
# External symbols with three leading underscores are ignored - sparc
# uses them for the BTFIXUP logic.
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/mksysmap
#   2004/08/07 21:35:27+02:00 [email protected] +54 -0
# 
# scripts/mksysmap
#   2004/08/07 21:35:27+02:00 [email protected] +0 -0
#   BitKeeper file /home/sam/bk/kbuild/scripts/mksysmap
# 
# Makefile
#   2004/08/07 21:35:27+02:00 [email protected] +18 -7
#   Use new mksysmap script when generating System.map
#   Also make nice printout when executing in non-verbose mode.
# 
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-08-13 21:09:35 +02:00
+++ b/Makefile	2004-08-13 21:09:35 +02:00
@@ -538,8 +538,9 @@
 	echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
 endef

-do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(2) -
+quiet_cmd_sysmap = SYSMAP
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+
LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s

# Generate section listing all symbols and add it into vmlinux
@@ -570,8 +571,10 @@
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o

define rule_verify_kallsyms
- @$(call do_system_map, .tmp_vmlinux$(last_kallsyms), .tmp_System.map)
- @cmp -s System.map .tmp_System.map || \
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
+ $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
+ $(Q)cmp -s System.map .tmp_System.map || \
(echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
endef

@@ -595,11 +598,19 @@

endif

-# Finally the vmlinux rule
+# Finally the vmlinux rule
+# This rule is also used to generate System.map +# and to verify that the content of kallsyms are consistent

define rule_vmlinux
- $(rule_vmlinux__); \
- $(call do_system_map, $@, System.map)
+ $(rule_vmlinux__);

+	$(Q)$(if $($(quiet)cmd_sysmap),          \
+	  echo '  $($(quiet)cmd_sysmap) $@' &&)  \
+	$(cmd_sysmap) $@ System.map;             \
+	if [ $$? -ne 0 ]; then                   \

+ rm -f $@; \
+ /bin/false; \
+ fi;
$(rule_verify_kallsyms)
endef

scripts/mksysmap new file +54 -0
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
@@ -0,0 +1,54 @@
+#!/bin/sh -x
+# Based on the vmlinux file create the System.map file
+# System.map is used by module-init tools and some debugging
+# tools to retreive the actual addresses of symbols in the kernel.
+#
+# Before creating the System.map file as a sideeffect check for
+# undefined symbols.
+# At least one version of the ARM bin-utils did not error out on
+# undefined symbols, so catch them here instead.
+
+# Usage
+# mksysmap vmlinux System.map
+
+
+#####
+# Check for undefined symbols.
+# Undefined symbols with three leading underscores are ignored since
+# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
+
+
+if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+	echo "$1: error: undefined symbol(s) found:"
+	$NM -u $1 | grep -v ' ___'
+	exit 1
+fi
+
+#####
+# Generate System.map (actual filename passed as second argument)
+
+# $NM produces the following output:
+# f0081e80 T alloc_vfsmnt
+
+#   The second row specify the type of the symbol:
+#   A = Absolute
+#   B = Uninitialised data (.bss)
+#   C = Comon symbol
+#   D = Initialised data
+#   G = Initialised data for small objects
+#   I = Indirect reference to another symbol
+#   N = Debugging symbol
+#   R = Read only
+#   S = Uninitialised data for small objects
+#   T = Text code symbol
+#   U = Undefined symbol
+#   V = Weak symbol
+#   W = Weak symbol
+#   Corresponding small letters are local symbols
+
+# For System.map filter away:
+#   a - local absolute symbols
+#   U - undefined global symbols
+#   w - local weak symbols
+
+nm $1 | grep -v ' [aUw] ' > $2
#2 lore raw

PATCH 2/12 kbuild/sparc: Use new generic mksysmap script to generate System.map

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/08 09:34:43+02:00 [email protected]
# kbuild/sparc: Use new generic mksysmap script to generate System.map
#
# o Introduced usage of the mksysmap script.
# o Improved the non-verbose output to look like this:

#     BTFIX   arch/sparc/boot/btfix.S
#     AS      arch/sparc/boot/btfix.o
#     LD      arch/sparc/boot/image
#     SYSMAP  arch/sparc/boot/System.map

#
# o No longer generate System.map for each build
# o Use normal AS rule to compile btfix.S
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/mksysmap
#   2004/08/08 09:34:27+02:00 [email protected] +1 -1
#   Three, not four underscores
# 
# arch/sparc/boot/Makefile
#   2004/08/08 09:34:27+02:00 [email protected] +32 -8
#   Use the new mksysmap script
#   Do not generate System.map for every build
#   Use normal AS rule for btfix.S
# 
diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
--- a/arch/sparc/boot/Makefile	2004-08-13 21:09:21 +02:00
+++ b/arch/sparc/boot/Makefile	2004-08-13 21:09:21 +02:00
@@ -8,27 +8,51 @@
 ELFTOAOUT	:= elftoaout

host-progs := piggyback btfixupprep
-targets := tftpboot.img btfix.o btfix.s image
+targets := tftpboot.img btfix.o btfix.S image

quiet_cmd_elftoaout = ELFTOAOUT $@

       cmd_elftoaout	= $(ELFTOAOUT) $(obj)/image -o $@
-quiet_cmd_piggy		= PIGGY $@
+quiet_cmd_piggy		= PIGGY   $@
       cmd_piggy		= $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
-quiet_cmd_btfix		= BTFIX $@
+quiet_cmd_btfix		= BTFIX   $@
       cmd_btfix		= $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@

+quiet_cmd_sysmap = SYSMAP $(obj)/System.map
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+quiet_cmd_image = LD $@
+ cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
+
+define rule_image

+	$(if $($(quiet)cmd_image),               \
+	  echo '  $($(quiet)cmd_image)' &&)      \
+	  $(cmd_image);                          \
+	$(if $($(quiet)cmd_sysmap),              \

+ echo ' $($(quiet)cmd_sysmap)' &&) \
+ $(cmd_sysmap) $@ $(obj)/System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
+ fi; \
+ echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
+endef

BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
-LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group $(kallsyms.o) +LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) \
+ --start-group $(BTLIBS) --end-group \
+ $(kallsyms.o) $(obj)/btfix.o

-# Actual linking
+# Link the final image including btfixup'ed symbols.
+# This is a replacement for the link done in the top-level Makefile. +# Note: No dependency on the prerequisite files since that would require +# make to try check if they are updated - and due to changes +# in gcc options (path for example) this would result in
+# these files being recompiled for each build.
$(obj)/image: $(obj)/btfix.o FORCE
- $(call if_changed,ld)
- $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(obj)/System.map
+ $(call if_changed_rule,image)

$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
$(call if_changed,elftoaout)
$(call if_changed,piggy)

-$(obj)/btfix.s: $(obj)/btfixupprep vmlinux FORCE
+$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
$(call if_changed,btfix)

scripts/mksysmap +1 -1
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
@@ -18,7 +18,7 @@
 # they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
 
 
-if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+if [ "`$NM -u $1 | grep -v ' ___'`" != "" ]; then
 	echo "$1: error: undefined symbol(s) found:"
 	$NM -u $1 | grep -v ' ___'
 	exit 1
#3 lore raw

PATCH 3/12 kconfig: save kernel version in .config file

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/08 16:29:57+02:00 [email protected]
# kconfig: save kernel version in .config file
#
# Save kernel version info and date when writing .config file.
# Tested with 'make {menuconfig|xconfig|gconfig}'.
#
# Signed-off-by: Randy Dunlap <[email protected]>
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/kconfig/confdata.c
#   2004/06/20 06:14:24+02:00 [email protected] +15 -2
#   kconfig: save kernel version in .config file
# 
diff -Nru a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
--- a/scripts/kconfig/confdata.c	2004-08-13 21:09:11 +02:00
+++ b/scripts/kconfig/confdata.c	2004-08-13 21:09:11 +02:00
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>

#define LKC_DIRECT_LINK
@@ -268,6 +269,7 @@
char dirname[128], tmpname[128], newname[128]; int type, l;
const char *str;
+ time_t now;

dirname[0] = 0;
if (name && name[0]) {
@@ -301,14 +303,25 @@
if (!out_h)
return 1;
}
+ sym = sym_lookup("KERNELRELEASE", 0);
+ sym_calc_value(sym);
+ time(&now);
fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n"

-		     "#\n");
+		     "# Linux kernel version: %s\n"
+		     "# %s"
+		     "#\n",
+		     sym_get_string_value(sym),
+		     ctime(&now));

if (out_h)
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
+ " * Linux kernel version: %s\n"
+ " * %s"
" */\n"

-			       "#define AUTOCONF_INCLUDED\n");
+			       "#define AUTOCONF_INCLUDED\n",
+			       sym_get_string_value(sym),
+			       ctime(&now));

if (!sym_change_count)
sym_clear_all_valid();

#4 lore raw

PATCH 4/12 kbuild: Selective compile of targets in scripts/

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/08 21:01:05+02:00 [email protected]
# kbuild: Selective compile of targets in scripts/
#

#   Do not build executables unless needed.
#   Same goes for scripts/mod/, descend only when CONFIG_MODULES are enabled.
#   With inputs form: Russell King <[email protected]> and  Brian Gerst <[email protected]>

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile

#   2004/08/08 21:00:50+02:00 [email protected] +12 -4
#   Only build required host-progs.
#   Descend into mod/ only when modules are enabled

#
# Makefile
# 2004/08/08 21:00:50+02:00 [email protected] +1 -1
# Add dependency on kallsyms, so recompile is done when script changes
#

Makefile +1 -1
diff -Nru a/Makefile b/Makefile
@@ -584,7 +584,7 @@
 .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
 	$(call if_changed_dep,as_o_S)
 
-.tmp_kallsyms%.S: .tmp_vmlinux%
+.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
 	$(call cmd,kallsyms)
 
 .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
scripts/Makefile +12 -4
diff -Nru a/scripts/Makefile b/scripts/Makefile
@@ -2,14 +2,22 @@
 # scripts contains sources for various helper programs used throughout
 # the kernel for the build process.
 # ---------------------------------------------------------------------------
-# docproc: 	 Preprocess .tmpl file in order to generate .sgml docs
+# kallsyms:      Find all symbols in vmlinux
+# pnmttologo:    Convert pnm files to logo files
+# conmakehash:   Create chartable
 # conmakehash:	 Create arrays for initializing the kernel console tables
 
-host-progs	:= conmakehash kallsyms pnmtologo bin2c
+hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
+hostprogs-$(CONFIG_LOGO)         += pnmtologo
+hostprogs-$(CONFIG_VT)           += conmakehash
+hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
+hostprogs-$(CONFIG_IKCONFIG)     += bin2c
+
+host-progs	:= $(sort $(hostprogs-y))
 always		:= $(host-progs)
 
-subdir-$(CONFIG_MODVERSIONS)	+= genksyms
-subdir-y	+= mod
+subdir-$(CONFIG_MODVERSIONS) += genksyms
+subdir-$(CONFIG_MODULES)     += mod
 
 # Let clean descend into subdirs
 subdir-	+= basic lxdialog kconfig package
#5 lore raw

PATCH 5/12 kbuild: Use LINUXINCLUDE to specify include/ directory

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/08 21:54:01+02:00 [email protected]
# kbuild: Use LINUXINCLUDE to specify include/ directory
#

#   Peter Chubb <[email protected]> reported that building i386
#   on a non-i386 platform failed, because gcc could not locate boot.h.
#   Root cause was the extra include2 directory used when using O=
#   to specify the output directory.
#   Added LINUXINCLUDE as a portable way to specify the include/
#   directory, and changed the two users.
#   This avoids hardcoding 'include2' in non-kbuild core files.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# arch/ppc64/boot/Makefile
# 2004/08/08 21:53:44+02:00 [email protected] +1 -1
# Introduce usage of LINUXINCLUDE
#
# arch/i386/boot/Makefile

#   2004/08/08 21:53:44+02:00 [email protected] +1 -1
#   Use LINUXINCLUDE to enable cross compilation.
#   This alos makes build locate the same boot.h when built with and wihtout O=
# 
# Makefile
#   2004/08/08 21:53:44+02:00 [email protected] +7 -3
#   Introduced LINUXINCLUDE - to allow portable reference to the include/
#   directory when assing to HOSTCFLAGS

#

Makefile +7 -3
diff -Nru a/Makefile b/Makefile
@@ -294,8 +294,12 @@
 
 NOSTDINC_FLAGS  = -nostdinc -iwithprefix include
 
-CPPFLAGS        := -D__KERNEL__ -Iinclude \
-		   $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+# Use LINUXINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+LINUXINCLUDE    := -Iinclude \
+                   $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+
+CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
 
 CFLAGS 		:= -Wall -Wstrict-prototypes -Wno-trigraphs \
 	  	   -fno-strict-aliasing -fno-common
@@ -306,7 +310,7 @@
 	CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
 	HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
 
-export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
+export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 
 export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
 
arch/i386/boot/Makefile +1 -1
diff -Nru a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
@@ -31,7 +31,7 @@
 
 host-progs	:= tools/build
 
-HOSTCFLAGS_build.o := -Iinclude
+HOSTCFLAGS_build.o := $(LINUXINCLUDE)
 
 # ---------------------------------------------------------------------------
 
arch/ppc64/boot/Makefile +1 -1
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
@@ -25,7 +25,7 @@
 
 BOOTCC		:= $(CROSS32_COMPILE)gcc
 HOSTCC		:= gcc
-BOOTCFLAGS	:= $(HOSTCFLAGS) -Iinclude -fno-builtin 
+BOOTCFLAGS	:= $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin 
 BOOTAS		:= $(CROSS32_COMPILE)as
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
 BOOTLD		:= $(CROSS32_COMPILE)ld
#6 lore raw

PATCH 6/12 kbuild: Accept absolute paths in clean-files and introduce clean-dirs

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/09 20:01:02+02:00 [email protected]
# kbuild: Accept absolute paths in clean-files and introduce clean-dirs
#

#   Teach kbuild to accept absolute paths in clean-files. This avoids using
#   clean-rules in several places.
#   Introduced clean-dirs to delete complete directories.
#   Kept clean-rule - but do not print anything when used.
#   Cleaned up a few places now the infrastructure are improved.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/package/Makefile

#   2004/08/09 20:00:46+02:00 [email protected] +3 -3
#   Use the fact that kbuild now knows of absolute paths in clean-files, and also
#   know how to delete directories.
#   This killed use of clean-rule in this file - good.
# 
# scripts/Makefile.clean
#   2004/08/09 20:00:46+02:00 [email protected] +22 -8
#   Teach Makefile.clean about absolute pathnames in clean-files.
#   Introduce clean-dirs.

#
# Documentation/kbuild/makefiles.txt
# 2004/08/09 20:00:46+02:00 [email protected] +11 -2
# Document the new clean-dirs variable, and the changed behaviour of clean-files.
#
# Documentation/DocBook/Makefile
# 2004/08/09 20:00:46+02:00 [email protected] +1 -3
# Use clean-dirs to remove directories
#

Documentation/DocBook/Makefile +1 -3
diff -Nru a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
@@ -185,9 +185,7 @@
 	$(patsubst %.sgml, %.9,    $(DOCBOOKS)) \
 	$(C-procfs-example)
 
-ifneq ($(wildcard $(patsubst %.html,%,$(HTML))),)
-clean-rule := rm -rf $(wildcard $(patsubst %.html,%,$(HTML)))
-endif
+clean-dirs := $(patsubst %.sgml,%,$(DOCBOOKS))
 
 #man put files in man subdir - traverse down
 subdir- := man/
Documentation/kbuild/makefiles.txt +11 -2
diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
@@ -547,8 +547,17 @@
 		clean-files := devlist.h classlist.h
 
 When executing "make clean", the two files "devlist.h classlist.h" will
-be deleted. Kbuild knows that files specified by $(clean-files) are
-located in the same directory as the makefile.
+be deleted. Kbuild will assume files to be in same relative directory as the
+Makefile except if an absolute path is specified (path starting with '/').
+
+To delete a directory hirachy use:
+	Example:
+		#scripts/package/Makefile
+		clean-dirs := $(objtree)/debian/
+
+This will delete the directory debian, including all subdirectories.
+Kbuild will assume the directories to be in the same relative path as the
+Makefile if no absolute path is specified (path does not start with '/').
 
 Usually kbuild descends down in subdirectories due to "obj-* := dir/",
 but in the architecture makefiles where the kbuild infrastructure
scripts/Makefile.clean +22 -8
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
@@ -29,21 +29,35 @@
 # Add subdir path
 
 subdir-ymn	:= $(addprefix $(obj)/,$(subdir-ymn))
-__clean-files	:= $(wildcard $(addprefix $(obj)/, \
-		   $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
-		   $(targets) $(clean-files)))
+__clean-files	:= $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
+		   $(targets) $(clean-files)
+__clean-files   := $(wildcard                                               \
+                   $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
+		   $(filter /%, $(__clean-files)))
+__clean-dirs    := $(wildcard                                               \
+                   $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs)))    \
+		   $(filter /%, $(clean-dirs)))
 
 # ==========================================================================
 
-quiet_cmd_clean = CLEAN   $(obj)
-      cmd_clean = rm -f $(__clean-files); $(clean-rule)
+quiet_cmd_clean    = CLEAN   $(obj)
+      cmd_clean    = rm -f $(__clean-files)
+quiet_cmd_cleandir = CLEAN   $(__clean-dirs)
+      cmd_cleandir = rm -rf $(__clean-dirs)
+
 
 __clean: $(subdir-ymn)
-ifneq ($(strip $(__clean-files) $(clean-rule)),)
+ifneq ($(strip $(__clean-files)),)
 	+$(call cmd,clean)
-else
-	@:
 endif
+ifneq ($(strip $(__clean-dirs)),)
+	+$(call cmd,cleandir)
+endif
+ifneq ($(strip $(clean-rule)),)
+	+$(clean-rule)
+endif
+	@:
+
 
 # ===========================================================================
 # Generic stuff
scripts/package/Makefile +3 -3
diff -Nru a/scripts/package/Makefile b/scripts/package/Makefile
@@ -51,7 +51,7 @@
 	$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
 	rm ../$(KERNELPATH).tar.gz
 
-clean-rule +=  rm -f $(objtree)/kernel.spec
+clean-files := $(objtree)/kernel.spec
 
 # binrpm-pkg
 .PHONY: binrpm-pkg
@@ -67,7 +67,7 @@
 
 	$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
 
-clean-rule += rm -f $(objtree)/binkernel.spec
+clean-files += $(objtree)/binkernel.spec
 
 # Deb target
 # ---------------------------------------------------------------------------
@@ -77,7 +77,7 @@
 	$(MAKE)
 	$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
 
-clean-rule += && rm -rf $(objtree)/debian/
+clean-dirs += $(objtree)/debian/
 
 
 # Help text displayed when executing 'make help'
#7 lore raw

PATCH 7/12 kbuild: Separate out host-progs handling

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/10 20:09:55+02:00 [email protected]
# kbuild: Separate out host-progs handling
#

#   Concentrating all host-progs functionality in one file made a more
#   readable Makefile.lib - and allow for potential reuse of host-progs
#   functionality.
#   Processing of host-progs related stuff are avoided when no host-progs are specified. 

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 [email protected] +152 -0
#
# scripts/Makefile.lib
# 2004/08/10 20:09:38+02:00 [email protected] +0 -49
# Move host-progs functionality to scripts/Makefile.host
#
# scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 [email protected] +0 -0
# BitKeeper file /home/sam/bk/kbuild/scripts/Makefile.host
#
# scripts/Makefile.build
# 2004/08/10 20:09:38+02:00 [email protected] +5 -84
# Move host-progs functionality to scripts/Makefile.host
#

scripts/Makefile.build +5 -84
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
@@ -14,6 +14,11 @@
 
 include scripts/Makefile.lib
 
+# Do not include host-progs rules unles needed
+ifdef host-progs
+include scripts/Makefile.host
+endif
+
 ifneq ($(KBUILD_SRC),)
 # Create output directory if not already present
 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
@@ -275,90 +280,6 @@
 
 targets += $(multi-used-y) $(multi-used-m)
 
-# Compile programs on the host
-# ===========================================================================
-# host-progs := bin2hex
-# Will compile bin2hex.c and create an executable named bin2hex
-#
-# host-progs    := lxdialog
-# lxdialog-objs := checklist.o lxdialog.o
-# Will compile lxdialog.c and checklist.c, and then link the executable
-# lxdialog, based on checklist.o and lxdialog.o
-#
-# host-progs      := qconf
-# qconf-cxxobjs   := qconf.o
-# qconf-objs      := menu.o
-# Will compile qconf as a C++ program, and menu as a C program.
-# They are linked as C++ code to the executable qconf
-
-# host-progs := conf
-# conf-objs  := conf.o libkconfig.so
-# libkconfig-objs := expr.o type.o
-# Will create a shared library named libkconfig.so that consist of
-# expr.o and type.o (they are both compiled as C code and the object file
-# are made as position independent code).
-# conf.c is compiled as a c program, and conf.o is linked together with
-# libkconfig.so as the executable conf.
-# Note: Shared libraries consisting of C++ files are not supported  
-#
-
-# Create executable from a single .c file
-# host-csingle -> Executable
-quiet_cmd_host-csingle 	= HOSTCC  $@
-      cmd_host-csingle	= $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<
-$(host-csingle): %: %.c FORCE
-	$(call if_changed_dep,host-csingle)
-
-# Link an executable based on list of .o files, all plain c
-# host-cmulti -> executable
-quiet_cmd_host-cmulti	= HOSTLD  $@
-      cmd_host-cmulti	= $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
-			  $(addprefix $(obj)/,$($(@F)-objs)) \
-			  $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
-	$(call if_changed,host-cmulti)
-
-# Create .o file from a single .c file
-# host-cobjs -> .o
-quiet_cmd_host-cobjs	= HOSTCC  $@
-      cmd_host-cobjs	= $(HOSTCC) $(hostc_flags) -c -o $@ $<
-$(host-cobjs): %.o: %.c FORCE
-	$(call if_changed_dep,host-cobjs)
-
-# Link an executable based on list of .o files, a mixture of .c and .cc
-# host-cxxmulti -> executable
-quiet_cmd_host-cxxmulti	= HOSTLD  $@
-      cmd_host-cxxmulti	= $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
-			  $(foreach o,objs cxxobjs,\
-			  $(addprefix $(obj)/,$($(@F)-$(o)))) \
-			  $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
-	$(call if_changed,host-cxxmulti)
-
-# Create .o file from a single .cc (C++) file
-quiet_cmd_host-cxxobjs	= HOSTCXX $@
-      cmd_host-cxxobjs	= $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
-$(host-cxxobjs): %.o: %.cc FORCE
-	$(call if_changed_dep,host-cxxobjs)
-
-# Compile .c file, create position independent .o file
-# host-cshobjs -> .o
-quiet_cmd_host-cshobjs	= HOSTCC  -fPIC $@
-      cmd_host-cshobjs	= $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
-$(host-cshobjs): %.o: %.c FORCE
-	$(call if_changed_dep,host-cshobjs)
-
-# Link a shared library, based on position independent .o files
-# *.o -> .so shared library (host-cshlib)
-quiet_cmd_host-cshlib	= HOSTLLD -shared $@
-      cmd_host-cshlib	= $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
-			  $(addprefix $(obj)/,$($(@F:.so=-objs))) \
-			  $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cshlib): %: $(host-cshobjs) FORCE
-	$(call if_changed,host-cshlib)
-
-targets += $(host-csingle)  $(host-cmulti) $(host-cobjs)\
-	   $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) 
 
 # Descending
 # ---------------------------------------------------------------------------
scripts/Makefile.host new file +152 -0

152 lines not on this page · raw message

scripts/Makefile.lib +0 -49

92 lines not on this page · raw message

#8 lore raw

Re: [7/12] kbuild: Separate out host-progs handling

Quoted 26 lines · Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2004/08/10 20:09:55+02:00 [email protected] #   kbuild: Separate out host-progs handling
#   #   Concentrating all host-progs functionality in one file made a more
#   readable Makefile.lib - and allow for potential reuse of host-progs
#   functionality.
#   Processing of host-progs related stuff are avoided when no host-progs are specified. #   #   Signed-off-by: Sam Ravnborg <[email protected]>

# # scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 [email protected] +152 -0
# # scripts/Makefile.lib
# 2004/08/10 20:09:38+02:00 [email protected] +0 -49
# Move host-progs functionality to scripts/Makefile.host
# # scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 [email protected] +0 -0
# BitKeeper file /home/sam/bk/kbuild/scripts/Makefile.host
# # scripts/Makefile.build
# 2004/08/10 20:09:38+02:00 [email protected] +5 -84
# Move host-progs functionality to scripts/Makefile.host

# diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
scripts/Makefile.build +0 -0
@@ -14,6 +14,11 @@
 

include scripts/Makefile.lib

Quoted 3 lines

+# Do not include host-progs rules unles needed

A typo: unless

Signature · 3 lines
Coywolf Qi Hunt
Homepage http://greatcn.org/~coywolf/
Admin of http://GreatCN.org and http://LoveCN.org
#9 lore raw

PATCH 8/12 kbuild: Introduce hostprogs-y, deprecate host-progs

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/10 21:38:42+02:00 [email protected]
# kbuild: Introduce hostprogs-y, deprecate host-progs
#

#   Introducing hostprogs-y allows a user to use the typical Kbuild
#   pattern in a Kbuild file:
#   hostprogs-$(CONFIG_KALLSYMS) += ...

#
# And then during cleaning the referenced file are still deleted.
# Deprecate the old host-progs assignment but kept the functionlity.
#

#   External modules will continue to use host-progs for a while - drawback is
#   that they now see a warning.
#   Workaround - just assign both variables:
#   hostprogs-y := foo
#   host-progs  := $(hostprogs-y)

#
# All in-kernel users will be converted in next patch.
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.host
# 2004/08/10 21:38:27+02:00 [email protected] +14 -12
# Replace host-progs with hostprogs-y (and hostprogs-m)
#
# scripts/Makefile.clean
# 2004/08/10 21:38:27+02:00 [email protected] +4 -2
# Introduced the new hostprogs variant, and kept the old one
#
# scripts/Makefile.build
# 2004/08/10 21:38:27+02:00 [email protected] +6 -1
# Deprecate host-progs, replace it with hostprogs-y.
#
# Documentation/kbuild/makefiles.txt
# 2004/08/10 21:38:27+02:00 [email protected] +26 -11
# Replcae host-progs with hostprogs-y
#

Documentation/kbuild/makefiles.txt +26 -11
diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
@@ -25,6 +25,7 @@
 	   --- 4.4 Using C++ for host programs
 	   --- 4.5 Controlling compiler options for host programs
 	   --- 4.6 When host programs are actually built
+	   --- 4.7 Using hostprogs-$(CONFIG_FOO)
 
 	=== 5 Kbuild clean infrastructure
 
@@ -387,7 +388,7 @@
 Two steps are required in order to use a host executable.
 
 The first step is to tell kbuild that a host program exists. This is
-done utilising the variable host-prog.
+done utilising the variable hostprogs-y.
 
 The second step is to add an explicit dependency to the executable.
 This can be done in two ways. Either add the dependency in a rule, 
@@ -402,7 +403,7 @@
 	built on the build host.
 
 	Example:
-		host-progs := bin2hex
+		hostprogs-y := bin2hex
 
 	Kbuild assumes in the above example that bin2hex is made from a single
 	c-source file named bin2hex.c located in the same directory as
@@ -418,7 +419,7 @@
 
 	Example:
 		#scripts/lxdialog/Makefile
-		host-progs    := lxdialog  
+		hostprogs-y   := lxdialog  
 		lxdialog-objs := checklist.o lxdialog.o
 
 	Objects with extension .o are compiled from the corresponding .c
@@ -438,7 +439,7 @@
 
 	Example:
 		#scripts/kconfig/Makefile
-		host-progs      := conf
+		hostprogs-y     := conf
 		conf-objs       := conf.o libkconfig.so
 		libkconfig-objs := expr.o type.o
   
@@ -457,7 +458,7 @@
 
 	Example:
 		#scripts/kconfig/Makefile
-		host-progs    := qconf
+		hostprogs-y   := qconf
 		qconf-cxxobjs := qconf.o
 
 	In the example above the executable is composed of the C++ file
@@ -468,7 +469,7 @@
 
 	Example:
 		#scripts/kconfig/Makefile
-		host-progs    := qconf
+		hostprogs-y   := qconf
 		qconf-cxxobjs := qconf.o
 		qconf-objs    := check.o
 	
@@ -509,7 +510,7 @@
 
 	Example:
 		#drivers/pci/Makefile
-		host-progs := gen-devlist
+		hostprogs-y := gen-devlist
 		$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
 			( cd $(obj); ./gen-devlist ) < $<
 
@@ -524,18 +525,32 @@
 
 	Example:
 		#scripts/lxdialog/Makefile
-		host-progs    := lxdialog
-		always        := $(host-progs)
+		hostprogs-y   := lxdialog
+		always        := $(hostprogs-y)
 
 	This will tell kbuild to build lxdialog even if not referenced in
 	any rule.
 
+--- 4.7 Using hostprogs-$(CONFIG_FOO)
+
+	A typcal pattern in a Kbuild file lok like this:
+
+	Example:
+		#scripts/Makefile
+		hostprogs-$(CONFIG_KALLSYMS) += kallsyms
+
+	Kbuild knows about both 'y' for built-in and 'm' for module.
+	So if a config symbol evaluate to 'm', kbuild will still build
+	the binary. In other words Kbuild handle hostprogs-m exactly
+	like hostprogs-y. But only hostprogs-y is recommend used
+	when no CONFIG symbol are involved.
+
 === 5 Kbuild clean infrastructure
 
 "make clean" deletes most generated files in the src tree where the kernel
 is compiled. This includes generated files such as host programs.
-Kbuild knows targets listed in $(host-progs), $(always), $(extra-y) and
-$(targets). They are all deleted during "make clean".
+Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always),
+$(extra-y) and $(targets). They are all deleted during "make clean".
 Files matching the patterns "*.[oas]", "*.ko", plus some additional files
 generated by kbuild are deleted all over the kernel src tree when
 "make clean" is executed.
scripts/Makefile.build +6 -1
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
@@ -14,8 +14,13 @@
 
 include scripts/Makefile.lib
 
-# Do not include host-progs rules unles needed
 ifdef host-progs
+$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!)
+hostprogs-y += $(host-progs)
+endif
+
+# Do not include host rules unles needed
+ifneq ($(hostprogs-y)$(hostprogs-m),)
 include scripts/Makefile.host
 endif
 
scripts/Makefile.clean +4 -2
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
@@ -29,8 +29,10 @@
 # Add subdir path
 
 subdir-ymn	:= $(addprefix $(obj)/,$(subdir-ymn))
-__clean-files	:= $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
-		   $(targets) $(clean-files)
+__clean-files	:= $(extra-y) $(EXTRA_TARGETS) $(always) \
+		   $(targets) $(clean-files)             \
+		   $(host-progs)                         \
+		   $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
 __clean-files   := $(wildcard                                               \
                    $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
 		   $(filter /%, $(__clean-files)))
scripts/Makefile.host +14 -12
diff -Nru a/scripts/Makefile.host b/scripts/Makefile.host
@@ -6,21 +6,21 @@
 # Both C and C++ is supported, but preferred language is C for such utilities.
 #
 # Samle syntax (see Documentation/kbuild/makefile.txt for reference)
-# host-progs := bin2hex
+# hostprogs-y := bin2hex
 # Will compile bin2hex.c and create an executable named bin2hex
 #
-# host-progs    := lxdialog
+# hostprogs-y    := lxdialog
 # lxdialog-objs := checklist.o lxdialog.o
 # Will compile lxdialog.c and checklist.c, and then link the executable
 # lxdialog, based on checklist.o and lxdialog.o
 #
-# host-progs      := qconf
+# hostprogs-y      := qconf
 # qconf-cxxobjs   := qconf.o
 # qconf-objs      := menu.o
 # Will compile qconf as a C++ program, and menu as a C program.
 # They are linked as C++ code to the executable qconf
 
-# host-progs := conf
+# hostprogs-y := conf
 # conf-objs  := conf.o libkconfig.so
 # libkconfig-objs := expr.o type.o
 # Will create a shared library named libkconfig.so that consist of
@@ -28,28 +28,30 @@
 # are made as position independent code).
 # conf.c is compiled as a c program, and conf.o is linked together with
 # libkconfig.so as the executable conf.
-# Note: Shared libraries consisting of C++ files are not supported  
+# Note: Shared libraries consisting of C++ files are not supported
 
-# host-progs := tools/build may have been specified. Retreive directory
-obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f))))
+__hostprogs := $(hostprogs-y)$(hostprogs-m)
+
+# hostprogs-y := tools/build may have been specified. Retreive directory
+obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
 obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
 
 
 # C code
 # Executables compiled from a single .c file
-host-csingle	:= $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
+host-csingle	:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
 
 # C executables linked based on several .o files
-host-cmulti	:= $(foreach m,$(host-progs),\
+host-cmulti	:= $(foreach m,$(__hostprogs),\
 		   $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
 
 # Object (.o) files compiled from .c files
-host-cobjs	:= $(sort $(foreach m,$(host-progs),$($(m)-objs)))
+host-cobjs	:= $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
 
 # C++ code
 # C++ executables compiled from at least on .cc file
 # and zero or more .c files
-host-cxxmulti	:= $(foreach m,$(host-progs),$(if $($(m)-cxxobjs),$(m)))
+host-cxxmulti	:= $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
 
 # C++ Object (.o) files compiled from .cc files
 host-cxxobjs	:= $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
@@ -63,7 +65,7 @@
 #Object (.o) files used by the shared libaries
 host-cshobjs	:= $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
 
-host-progs      := $(addprefix $(obj)/,$(host-progs))
+__hostprogs     := $(addprefix $(obj)/,$(__hostprogs))
 host-csingle	:= $(addprefix $(obj)/,$(host-csingle))
 host-cmulti	:= $(addprefix $(obj)/,$(host-cmulti))
 host-cobjs	:= $(addprefix $(obj)/,$(host-cobjs))
#10 lore raw

PATCH 9/12 kbuild: Replace host-progs with hostprogs-y

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/10 21:42:56+02:00 [email protected]
# kbuild: Replace host-progs with hostprogs-y
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# usr/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# sound/oss/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# scripts/mod/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/lxdialog/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/kconfig/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# scripts/genksyms/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/basic/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -2
# Replace host-progs with hostprogs-y
#
# lib/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/zorro/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/pci/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/media/dvb/ttpci/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/md/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/atm/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/x86_64/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/um/sys-i386/util/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# arch/sparc64/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/sparc/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/ppc64/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/ppc/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +2 -2
# Replace host-progs with hostprogs-y
#
# arch/i386/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#
# arch/alpha/boot/Makefile
# 2004/08/10 21:42:40+02:00 [email protected] +1 -1
# Replace host-progs with hostprogs-y
#

arch/alpha/boot/Makefile +1 -1
diff -Nru a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile
@@ -8,7 +8,7 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
-host-progs	:= tools/mkbb tools/objstrip
+hostprogs-y	:= tools/mkbb tools/objstrip
 targets		:= vmlinux.gz vmlinux \
 		   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
 		   tools/bootpzh bootloader bootpheader bootpzheader 
arch/i386/boot/Makefile +1 -1
diff -Nru a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
@@ -29,7 +29,7 @@
 		   zImage bzImage
 subdir- 	:= compressed
 
-host-progs	:= tools/build
+hostprogs-y	:= tools/build
 
 HOSTCFLAGS_build.o := $(LINUXINCLUDE)
 
arch/ppc/boot/Makefile +2 -2
diff -Nru a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
@@ -23,12 +23,12 @@
 # for cleaning
 subdir-				+= simple openfirmware
 
-host-progs := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
+hostprogs-y := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
 
 .PHONY: $(BOOT_TARGETS) $(bootdir-y)
 
 $(BOOT_TARGETS): $(bootdir-y)
 
 $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
-		$(addprefix $(obj)/,$(host-progs))
+		$(addprefix $(obj)/,$(hostprogs-y))
 	$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
arch/ppc64/boot/Makefile +1 -1
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
@@ -58,7 +58,7 @@
 src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
 gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
 
-host-progs		:= piggy addnote addSystemMap addRamDisk
+hostprogs-y		:= piggy addnote addSystemMap addRamDisk
 targets 		+= zImage zImage.initrd imagesize.c \
 			   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 			   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
arch/sparc/boot/Makefile +1 -1
diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
@@ -7,7 +7,7 @@
 ROOT_IMG	:= /usr/src/root.img
 ELFTOAOUT	:= elftoaout
 
-host-progs	:= piggyback btfixupprep
+hostprogs-y	:= piggyback btfixupprep
 targets		:= tftpboot.img btfix.o btfix.S image
 
 quiet_cmd_elftoaout	= ELFTOAOUT $@
arch/sparc64/boot/Makefile +1 -1
diff -Nru a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile
@@ -7,7 +7,7 @@
 ROOT_IMG	:= /usr/src/root.img
 ELFTOAOUT	:= elftoaout
 
-host-progs	:= piggyback
+hostprogs-y	:= piggyback
 targets		:= image tftpboot.img vmlinux.aout
 
 quiet_cmd_elftoaout = ELF2AOUT $@
arch/um/sys-i386/util/Makefile +2 -2
diff -Nru a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile
@@ -1,6 +1,6 @@
 
-host-progs	:= mk_sc
-always		:= $(host-progs) mk_thread
+hostprogs-y	:= mk_sc
+always		:= $(hostprogs-y) mk_thread
 targets		:= mk_thread_kern.o mk_thread_user.o
 
 mk_sc-objs	:= mk_sc.o
arch/x86_64/boot/Makefile +1 -1
diff -Nru a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile
@@ -30,7 +30,7 @@
 
 EXTRA_CFLAGS := -m32
 
-host-progs	:= tools/build
+hostprogs-y	:= tools/build
 subdir-		:= compressed/	#Let make clean descend in compressed/
 # ---------------------------------------------------------------------------
 
drivers/atm/Makefile +1 -1
diff -Nru a/drivers/atm/Makefile b/drivers/atm/Makefile
@@ -3,7 +3,7 @@
 #
 
 fore_200e-objs	:= fore200e.o
-host-progs	:= fore200e_mkfirm
+hostprogs-y	:= fore200e_mkfirm
 
 # Files generated that shall be removed upon make clean
 clean-files := atmsar11.bin atmsar11.bin1 atmsar11.bin2 pca200e.bin \
drivers/md/Makefile +1 -1
diff -Nru a/drivers/md/Makefile b/drivers/md/Makefile
@@ -10,7 +10,7 @@
 		   raid6int1.o raid6int2.o raid6int4.o \
 		   raid6int8.o raid6int16.o raid6int32.o \
 		   raid6mmx.o raid6sse1.o raid6sse2.o
-host-progs	:= mktables
+hostprogs-y	:= mktables
 
 # Note: link order is important.  All raid personalities
 # and xor.o must come before md.o, as they each initialise 
drivers/media/dvb/ttpci/Makefile +1 -1
diff -Nru a/drivers/media/dvb/ttpci/Makefile b/drivers/media/dvb/ttpci/Makefile
@@ -13,7 +13,7 @@
 
 EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
 
-host-progs	:= fdump
+hostprogs-y	:= fdump
 
 ifdef CONFIG_DVB_AV7110_FIRMWARE
 $(obj)/av7110.o: $(obj)/fdump $(obj)/av7110_firm.h 
drivers/pci/Makefile +1 -1
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
@@ -35,7 +35,7 @@
 obj-y += syscall.o
 endif
 
-host-progs := gen-devlist
+hostprogs-y := gen-devlist
 
 # Dependencies on generated files need to be listed explicitly
 $(obj)/names.o: $(obj)/devlist.h $(obj)/classlist.h
drivers/zorro/Makefile +1 -1
diff -Nru a/drivers/zorro/Makefile b/drivers/zorro/Makefile
@@ -5,7 +5,7 @@
 obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o names.o
 obj-$(CONFIG_PROC_FS)	+= proc.o
 
-host-progs 		:= gen-devlist
+hostprogs-y 		:= gen-devlist
 
 # Files generated that shall be removed upon make clean
 clean-files := devlist.h
lib/Makefile +1 -1
diff -Nru a/lib/Makefile b/lib/Makefile
@@ -25,7 +25,7 @@
 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
 obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
 
-host-progs	:= gen_crc32table
+hostprogs-y	:= gen_crc32table
 clean-files	:= crc32table.h
 
 $(obj)/crc32.o: $(obj)/crc32table.h
scripts/Makefile +1 -2
diff -Nru a/scripts/Makefile b/scripts/Makefile
@@ -13,8 +13,7 @@
 hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
 hostprogs-$(CONFIG_IKCONFIG)     += bin2c
 
-host-progs	:= $(sort $(hostprogs-y))
-always		:= $(host-progs)
+always		:= $(hostprogs-y)
 
 subdir-$(CONFIG_MODVERSIONS) += genksyms
 subdir-$(CONFIG_MODULES)     += mod
scripts/basic/Makefile +2 -2
diff -Nru a/scripts/basic/Makefile b/scripts/basic/Makefile
@@ -11,8 +11,8 @@
 #                include/config/...
 # docproc:	 Used in Documentation/docbook
 
-host-progs	:= fixdep split-include docproc
-always		:= $(host-progs)
+hostprogs-y	:= fixdep split-include docproc
+always		:= $(hostprogs-y)
 
 # fixdep is needed to compile other host programs
 $(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep
scripts/genksyms/Makefile +2 -2
diff -Nru a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
@@ -1,6 +1,6 @@
 
-host-progs	:= genksyms
-always		:= $(host-progs)
+hostprogs-y	:= genksyms
+always		:= $(hostprogs-y)
 
 genksyms-objs	:= genksyms.o parse.o lex.o
 
scripts/kconfig/Makefile +1 -1
diff -Nru a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
@@ -67,7 +67,7 @@
 
 libkconfig-objs := zconf.tab.o
 
-host-progs	:= conf mconf qconf gconf
+hostprogs-y	:= conf mconf qconf gconf
 conf-objs	:= conf.o  libkconfig.so
 mconf-objs	:= mconf.o libkconfig.so
 
scripts/lxdialog/Makefile +2 -2
diff -Nru a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile
@@ -15,8 +15,8 @@
 endif
 endif
 
-host-progs	:= lxdialog
-always		:= ncurses $(host-progs)
+hostprogs-y	:= lxdialog
+always		:= ncurses $(hostprogs-y)
 
 lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \
 		 util.o lxdialog.o msgbox.o
scripts/mod/Makefile +2 -2
diff -Nru a/scripts/mod/Makefile b/scripts/mod/Makefile
@@ -1,5 +1,5 @@
-host-progs	:= modpost mk_elfconfig
-always		:= $(host-progs) empty.o
+hostprogs-y	:= modpost mk_elfconfig
+always		:= $(hostprogs-y) empty.o
 
 modpost-objs	:= modpost.o file2alias.o sumversion.o
 
sound/oss/Makefile +1 -1
diff -Nru a/sound/oss/Makefile b/sound/oss/Makefile
@@ -103,7 +103,7 @@
 vidc_mod-objs	:= vidc.o vidc_fill.o
 wavefront-objs  := wavfront.o wf_midi.o yss225.o
 
-host-progs	:= bin2hex hex2hex
+hostprogs-y	:= bin2hex hex2hex
 
 # Files generated that shall be removed upon make clean
 clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \
usr/Makefile +1 -1
diff -Nru a/usr/Makefile b/usr/Makefile
@@ -1,7 +1,7 @@
 
 obj-y := initramfs_data.o
 
-host-progs  := gen_init_cpio
+hostprogs-y  := gen_init_cpio
 
 clean-files := initramfs_data.cpio.gz
 
#11 lore raw

PATCH 10/12 kbuild: Fix hostprogs-y

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/10 21:56:40+02:00 [email protected]
# kbuild: Fix hostprogs-y
#

#   Allow the same target to be specified more than once without causing a warnign from make.
#   The same target may be specified twice when using the following pattern:
#   hostprogs-$(CONFIG_FOO) += program
#   hostprogs-$(CONFIG_BAR) += program

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/Makefile.host
# 2004/08/10 21:56:24+02:00 [email protected] +1 -1
# Allow same target to be specified more than once
#

scripts/Makefile.host +1 -1
diff -Nru a/scripts/Makefile.host b/scripts/Makefile.host
@@ -30,7 +30,7 @@
 # libkconfig.so as the executable conf.
 # Note: Shared libraries consisting of C++ files are not supported
 
-__hostprogs := $(hostprogs-y)$(hostprogs-m)
+__hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
 
 # hostprogs-y := tools/build may have been specified. Retreive directory
 obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
#12 lore raw

PATCH 11/12 kbuild: Use POSIX headers for ntoh functions

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/10 22:11:50+02:00 [email protected]
# kbuild: Use POSIX headers for ntoh functions
#

#   From: Benno <[email protected]>
#   When compiling Linux on Mac OSX I had trouble with scripts/sumversion.c.
#   It includes <netinet/in.h> to obtain to definitions of htonl and ntohl.
#   
#   On Mac OSX these are found in <arpa/inet.h>. After checking the POSIX
#   specification it appears that this is the correct place to get
#   the definitons for these functions.

#
# (http://www.opengroup.org/onlinepubs/009695399/functions/htonl.html)
#
# Using this header also appears to work on Linux (at least with
# Glibc-2.3.2).
#

#   It seems clearer to me to go with the POSIX standard than implementing
#   #if __APPLE__ style macros, but if such an approach is preferred I can
#   supply patches for that instead.
#   
#   Signed-off-by: Sam Ravnborg <[email protected]>
# 
# scripts/mod/sumversion.c
#   2004/08/10 22:11:33+02:00 [email protected] +1 -1
#   Use correct POSIX header for ntoh functions
# 
# scripts/basic/fixdep.c
#   2004/08/10 22:11:33+02:00 [email protected] +1 -1
#   Use correct POSIX header for ntoh functions
# 
diff -Nru a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
--- a/scripts/basic/fixdep.c	2004-08-13 21:07:40 +02:00
+++ b/scripts/basic/fixdep.c	2004-08-13 21:07:40 +02:00
@@ -104,7 +104,7 @@
 #include <stdio.h>
 #include <limits.h>
 #include <ctype.h>
-#include <netinet/in.h>
+#include <arpa/inet.h>

#define INT_CONF ntohl(0x434f4e46)
#define INT_ONFI ntohl(0x4f4e4649)

scripts/mod/sumversion.c +1 -1
diff -Nru a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
@@ -1,4 +1,4 @@
-#include <netinet/in.h>
+#include <arpa/inet.h>
 #include <stdint.h>
 #include <ctype.h>
 #include <errno.h>
#13 lore raw

PATCH 12/12 kbuild: __crc_* symbols in System.map

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/08/13 20:14:30+02:00 [email protected]
# kbuild: __crc_* symbols in System.map
#
# David S. Miller <[email protected]> wrote:
# Shouldn't we be grepping __crc_ symbols out of the System.map file?
#

#   For one thing, these can confuse readprofile.  It's algorithm is
#   to start at _stext, then stop when it sees a line in the System.map
#   which is not text (mode is one of 'T' 't' 'W' or 'w')

#
# It will exit early if there are some intermixed __crc_* things in
# there (since they are are mode 'A').
#
# For example, in my current sparc64 kernel I have this:
#

#   00000000004cef80 t do_split
#   00000000004cf2a0 t add_dirent_to_buf
#   00000000004cf5a7 A __crc_init_special_inode
#   00000000004cf640 t make_indexed_dir
#   00000000004cf900 t ext3_add_entry

#
# So no symbols after add_dirent_to_buf will be shown in the profiling
# output of readprofile.
#

#   Implementation ported to mksysmap by Sam.
#   Included two System.map related fixes:
#   - Print "SYSMAP  System.map" during build
#   - Sort symbols in System.map
#   
#   Signed-off-by: Sam Ravnborg <[email protected]>
# 
# scripts/mksysmap
#   2004/08/13 20:14:14+02:00 [email protected] +8 -1
#   Remove __crc_ symbols from System.map
#   Now also sort the output; '-n' option to nm
# 
# Makefile
#   2004/08/13 20:14:14+02:00 [email protected] +6 -6
#   Print out:
#   SYSMAP  System.map
#   during build.
# 
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-08-13 21:07:25 +02:00
+++ b/Makefile	2004-08-13 21:07:25 +02:00
@@ -608,12 +608,12 @@

define rule_vmlinux
$(rule_vmlinux__);

-	$(Q)$(if $($(quiet)cmd_sysmap),          \
-	  echo '  $($(quiet)cmd_sysmap) $@' &&)  \
-	$(cmd_sysmap) $@ System.map;             \
-	if [ $$? -ne 0 ]; then                   \
-		rm -f $@;                        \
-		/bin/false;                      \
+	$(Q)$(if $($(quiet)cmd_sysmap),                  \
+	  echo '  $($(quiet)cmd_sysmap) System.map' &&)  \
+	$(cmd_sysmap) $@ System.map;                     \
+	if [ $$? -ne 0 ]; then                           \

+ rm -f $@; \
+ /bin/false; \
fi;
$(rule_verify_kallsyms)
endef

scripts/mksysmap +8 -1
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
@@ -51,4 +51,11 @@
 #   U - undefined global symbols
 #   w - local weak symbols
 
-nm $1 | grep -v ' [aUw] ' > $2
+# readprofile starts reading symbols when _stext is found, and
+# continue until it finds a symbol which is not either of 'T', 't',
+# 'W' or 'w'. __crc_ are 'A' and placed in the middle
+# so we just ignore them to let readprofile continue to work.
+# (At least sparc64 has __crc_ in the middle).
+
+$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)' > $2
+