[klibc] Call for help with release...

Arnd Bergmann arnd at arndb.de
Mon Feb 22 10:41:26 PST 2010


On Sunday 21 February 2010, H. Peter Anvin wrote:
> On 02/20/2010 06:00 PM, Américo Wang wrote:

> klibc, like other libcs, use the kernel headers because they describe
> the kernel ABI (system calls, constants, structures and so on.)  Because
> klibc was originally designed to build in the kernel tree itself, it
> uses the kernel headers directly, but now the kernel has a procedure for
> extracting the user-space relevant bits.

I've had some success with this patch, but it probably needs to be
refined a bit more. Unfortunately, include/linux/socket.h broke
in the meantime because of 9c501935 "net: Support inclusion of 
<linux/socket.h> before <sys/socket.h>" from Ben Hutchings, so more
changes are needed to get klibc working with current kernels.

The patch adds a new directory 'headers' in which we install the
kernel headers and uses it. There is no longer a .config, so the
patch also removes all references to that.

Signed-off-by: Arnd Bergmann <arnd at arndb.de>

diff --git a/Makefile b/Makefile
index 136d4e8..2b47071 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ export KLIBCINC := usr/include
 export KLIBCOBJ := usr/klibc
 export KLIBCKERNELSRC := linux/
 export KLIBCKERNELOBJ := linux/
+export KLIBCKERNELHEADERS := headers/
 include scripts/Kbuild.include
 
 KLIBCROSS	?= $(CROSS_COMPILE)
@@ -40,10 +41,6 @@ export mandir      = $(prefix)/man
 export INSTALLDIR  = $(prefix)/lib/klibc
 export INSTALLROOT =
 
-# Create a fake .config as present in the kernel tree
-# But if it exists leave it alone
-$(if $(wildcard $(objtree)/.config),,$(shell cp defconfig .config))
-
 # Prefix Make commands with $(Q) to silence them
 # Use quiet_cmd_xxx, cmd_xxx to create nice output
 # use make V=1 to get verbose output
@@ -84,9 +81,10 @@ klibc := -f $(srctree)/scripts/Kbuild.klibc obj
 .PHONY: all klcc klibc
 all: klcc klibc
 
-.config: defconfig linux
-	@echo "defconfig has changed, please remove or edit .config"
-	@false
+headers:
+	mkdir -p headers.tmp
+	make -C $(KLIBCKERNELSRC) O=$(PWD)/headers.tmp headers_install
+	mv headers.tmp headers
 
 linux:
 	@echo "The 'linux' symlink is missing; it should point to a kernel tree "
@@ -99,10 +97,10 @@ klibc.spec: klibc.spec.in $(KLIBCSRC)/version
 	sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
 
 # Build klcc - it is the first target
-klcc: .config
+klcc: headers
 	$(Q)$(MAKE) $(klibc)=klcc
 
-klibc: .config
+klibc: headers
 	$(Q)$(MAKE) $(klibc)=.
 
 test: klibc
@@ -124,10 +122,10 @@ test: klibc
 FORCE: ;
 ###
 # clean: remove generated files
-# mrproper does a full cleaning including .config and linux symlink
+# mrproper does a full cleaning including headers and linux symlink
 FIND_IGNORE := \( -name .git \) -prune -o
 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),RM     $(wildcard $(rm-files)))
-      cmd_rmfiles = rm -f $(rm-files)
+      cmd_rmfiles = rm -rf $(rm-files)
 clean:
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=.
 	$(Q)find . $(FIND_IGNORE) \
@@ -135,7 +133,7 @@ clean:
 		   -name '.*.d' -o -name '.*.tmp' \) \
 		-type f -print | xargs rm -f
 
-rm-files := .config linux
+rm-files := linux headers
 distclean mrproper: clean
 	 $(Q)find . $(FIND_IGNORE) \
 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
@@ -151,4 +149,4 @@ install: all
 # This does all the prep work needed to turn a freshly exported git repository
 # into a release tarball tree
 release: klibc.spec
-	rm -f maketar.sh .config
+	rm -f maketar.sh
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 227b9bd..49f4f09 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -57,9 +57,6 @@ targets :=
 .phony: __build
 __build:
 
-# Read .config if it exist, otherwise ignore
--include .config
-
 # Generic Kbuild routines
 include $(srctree)/scripts/Kbuild.include
 
@@ -102,9 +99,7 @@ KLIBCCPPFLAGS    := -nostdinc -iwithprefix include \
 		    -I$(KLIBCOBJ)/../include		\
                     -I$(KLIBCINC)
 # kernel include paths
-KLIBCKERNELSRC	 ?= $(srctree)/
-KLIBCCPPFLAGS    += -I$(KLIBCKERNELSRC)include		\
-                     $(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)include2 -I$(KLIBCKERNELOBJ)include -I$(srctree)/include)    \
+KLIBCCPPFLAGS    += -I$(KLIBCKERNELHEADERS)/usr/include	\
 		     $(KLIBCARCHINCFLAGS)
 
 # klibc definitions
@@ -137,9 +132,6 @@ export KLIBCLD KLIBCCC KLIBCAR KLIBCSTRIP KLIBCNM
 export KLIBCCFLAGS KLIBCAFLAGS KLIBCLIBGCC KLIBCSHAREDFLAGS KLIBCSTRIPFLAGS
 export KLIBCCRT0 KLIBCLIBC SHLIBDIR
 
-# kernel configuration
-include .config
-
 # Add $(obj)/ for paths that is not absolute
 objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
 



More information about the klibc mailing list