* Support arch/$ARCH/include in kbuild
@ 2008-06-21 22:07 Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-21 22:07 UTC (permalink / raw)
To: LKML, linux-kbuild; +Cc: Linus Torvalds
Linus hinted that he liked to have all arch specific
header files moved from include/asm-$ARCH to
arch/$ARCH/include/asm.
The following two patches implement the basic support
for this.
I have used sparc for my testing and to some degree
I also used i386.
For sparc I just had to do a simple:
mkdir -p arch/sparc/include/asm
mv include/asm-sparc/* arch/sparc/include/asm
to build sparc with the new directory layout.
For i386 I had to do a few trivial path fixes in
arch/x86/Makefile and to fix the include of unistd_32.h
in one place to fix the build.
I expect a few additional bits to show up when people
start to move their header files but this should
be a good starting point.
To support arch/$ARCH/include/ was done in two steps.
First was to teach make headers_* about the new layout.
And second step was to get the build fixed with the new
layout.
Patches are on top of kbuild-next.git and follows.
Sam
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] kbuild: prepare headers_* for arch/$ARCH/include
2008-06-21 22:07 Support arch/$ARCH/include in kbuild Sam Ravnborg
@ 2008-06-21 22:08 ` Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: support arch/$ARCH/include/ Sam Ravnborg
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-21 22:08 UTC (permalink / raw)
To: LKML, linux-kbuild; +Cc: Linus Torvalds
From dbe54b86ff10b0f6d0a5d1b8e706696f87b9b42a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 21 Jun 2008 00:24:17 +0200
Subject: [PATCH] kbuild: prepare headers_* for arch/$ARCH/include
Factor out the headers_*_all support to a seperate
shell script and add support for arch specific
header files can be located in either
arch/$ARCH/include/asm
or
include/asm-$ARCH/
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 37 ++++++++++++++++++-------------------
| 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 19 deletions(-)
create mode 100755 scripts/headers.sh
diff --git a/Makefile b/Makefile
index 309f49d..e309a87 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,9 @@ ifeq ($(ARCH),x86_64)
SRCARCH := x86
endif
+# Where to locate arch specific headers
+hdr-arch := $(SRCARCH)
+
KCONFIG_CONFIG ?= .config
# SHELL used by kbuild
@@ -1000,43 +1003,39 @@ depend dep:
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
-hdr-filter := generic um ppc sparc64 cris
-hdr-archs := $(filter-out $(hdr-filter), \
- $(patsubst $(srctree)/include/asm-%/Kbuild,%, \
- $(wildcard $(srctree)/include/asm-*/Kbuild)))
hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+# Find out where the Kbuild file is located to support
+# arch/$(ARCH)/include/asm
+hdr-dir = $(strip \
+ $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
+ arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
+
+# If we do an all arch process set dst to asm-$(hdr-arch)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
PHONY += __headers
__headers: include/linux/version.h scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
PHONY += headers_install_all
-headers_install_all: __headers
- $(Q)$(MAKE) $(hdr-inst)=include
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) $(hdr-inst)=include/asm-$$arch \
- SRCARCH=$$arch dst=include/asm-$$arch; \
- done
+headers_install_all:
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
PHONY += headers_install
headers_install: __headers
- $(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \
- $(error Headers not exportable for this architecture ($(SRCARCH))))
+ $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
+ $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
PHONY += headers_check_all
headers_check_all: headers_install_all
- $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
- done
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
- dst=include/asm HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
# ---------------------------------------------------------------------------
# Modules
--git a/scripts/headers.sh b/scripts/headers.sh
new file mode 100755
index 0000000..d33426f
--- /dev/null
+++ b/scripts/headers.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Run headers_$1 command for all suitable architectures
+
+# Stop on error
+set -e
+
+do_command()
+{
+ if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ else
+ printf "Ignoring arch: %s\n" ${arch}
+ fi
+}
+
+# Do not try this architecture
+drop="generic um ppc sparc64 cris"
+
+archs=$(ls ${srctree}/arch)
+
+for arch in ${archs}; do
+ case ${arch} in
+ um) # no userspace export
+ ;;
+ ppc) # headers exported by powerpc
+ ;;
+ sparc64) # headers exported by sparc
+ ;;
+ cris) # headers export are known broken
+ ;;
+ *)
+ if [ -d ${srctree}/arch/${arch} ]; then
+ do_command $1 ${arch}
+ fi
+ ;;
+ esac
+done
+
+
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH] kbuild: support arch/$ARCH/include/...
2008-06-21 22:07 Support arch/$ARCH/include in kbuild Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
@ 2008-06-21 22:08 ` Sam Ravnborg
2008-06-21 22:11 ` Support arch/$ARCH/include in kbuild Sam Ravnborg
2008-06-22 22:05 ` Sam Ravnborg
3 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-21 22:08 UTC (permalink / raw)
To: LKML, linux-kbuild; +Cc: Linus Torvalds
From d888d09887a0231e494e7009d855bd3e3c35bfd9 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 21 Jun 2008 01:07:38 +0200
Subject: [PATCH] kbuild: support arch/$ARCH/include/...
Unconditionally add arch/$ARCH/include to the gcc search path.
Create asm symlink only when we need them
Save asm-offset in include/asm
Delete include/asm during mrproper being it a link or a directory
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Kbuild | 2 +-
Makefile | 35 ++++++++++++++++++++---------------
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/Kbuild b/Kbuild
index e750e9c..254a6af 100644
--- a/Kbuild
+++ b/Kbuild
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
# 2) Generate asm-offsets.h
#
-offsets-file := include/asm-$(SRCARCH)/asm-offsets.h
+offsets-file := include/asm/asm-offsets.h
always += $(offsets-file)
targets += $(offsets-file)
diff --git a/Makefile b/Makefile
index e309a87..70dc0a8 100644
--- a/Makefile
+++ b/Makefile
@@ -329,7 +329,8 @@ AFLAGS_KERNEL =
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude \
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
- -include include/linux/autoconf.h
+ -I$(srctree)/arch/$(hdr-arch)/include \
+ -include include/linux/autoconf.h
KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
@@ -921,7 +922,9 @@ ifneq ($(KBUILD_SRC),)
/bin/false; \
fi;
$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
- $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm
+ $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
+ ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
+ fi
endif
# prepare2 creates a makefile if using a separate output directory
@@ -949,19 +952,21 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
# Detect this and ask user to run make mrproper
include/asm: FORCE
- $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
- if [ -L include/asm ]; then \
- if [ "$$asmlink" != "$(SRCARCH)" ]; then \
+ $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
+ if [ -L include/asm ]; then \
+ if [ "$$asmlink" != "$(SRCARCH)" ]; then \
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
- exit 1; \
- fi; \
- else \
- echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
- if [ ! -d include ]; then \
- mkdir -p include; \
- fi; \
- ln -fsn asm-$(SRCARCH) $@; \
+ exit 1; \
+ fi; \
+ else \
+ if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
+ echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
+ if [ ! -d include ]; then \
+ mkdir -p include; \
+ fi; \
+ ln -fsn asm-$(SRCARCH) $@; \
+ fi \
fi
# Generate some files
@@ -1120,8 +1125,8 @@ CLEAN_FILES += vmlinux System.map \
.tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
# Directories & files removed with 'make mrproper'
-MRPROPER_DIRS += include/config include2 usr/include
-MRPROPER_FILES += .config .config.old include/asm .version .old_version \
+MRPROPER_DIRS += include/config include2 usr/include include/asm
+MRPROPER_FILES += .config .config.old .version .old_version \
include/linux/autoconf.h include/linux/version.h \
include/linux/utsrelease.h \
include/linux/bounds.h include/asm*/asm-offsets.h \
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: Support arch/$ARCH/include in kbuild
2008-06-21 22:07 Support arch/$ARCH/include in kbuild Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: support arch/$ARCH/include/ Sam Ravnborg
@ 2008-06-21 22:11 ` Sam Ravnborg
2008-06-22 22:05 ` Sam Ravnborg
3 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-21 22:11 UTC (permalink / raw)
To: LKML, linux-kbuild; +Cc: Linus Torvalds
>
> Patches are on top of kbuild-next.git and follows.
Just to make it crystal clear.
These patches are for comment and I will await feedback before
pushing to kbuild-next.git (and thus -next).
And archs are not forced to move their header files now.
They can wait until it fits their schedule.
Sam
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Support arch/$ARCH/include in kbuild
2008-06-21 22:07 Support arch/$ARCH/include in kbuild Sam Ravnborg
` (2 preceding siblings ...)
2008-06-21 22:11 ` Support arch/$ARCH/include in kbuild Sam Ravnborg
@ 2008-06-22 22:05 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
` (5 more replies)
3 siblings, 6 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:05 UTC (permalink / raw)
To: LKML, linux-kbuild; +Cc: Linus Torvalds
On Sun, Jun 22, 2008 at 12:07:03AM +0200, Sam Ravnborg wrote:
> Linus hinted that he liked to have all arch specific
> header files moved from include/asm-$ARCH to
> arch/$ARCH/include/asm.
>
> The following two patches implement the basic support
> for this.
>
> I have used sparc for my testing and to some degree
> I also used i386.
>
> For sparc I just had to do a simple:
>
> mkdir -p arch/sparc/include/asm
> mv include/asm-sparc/* arch/sparc/include/asm
>
> to build sparc with the new directory layout.
>
> For i386 I had to do a few trivial path fixes in
> arch/x86/Makefile and to fix the include of unistd_32.h
> in one place to fix the build.
>
> I expect a few additional bits to show up when people
> start to move their header files but this should
> be a good starting point.
>
>
> To support arch/$ARCH/include/ was done in two steps.
>
> First was to teach make headers_* about the new layout.
> And second step was to get the build fixed with the new
> layout.
>
> Patches are on top of kbuild-next.git and follows.
I redid this and ended up with 5 small patches.
Sam Ravnborg (5):
kbuild: prepare headers_* for arch/$ARCH/include
kbuild: include/asm may be a file - fix mrproper for this
kbuild: support arch/$ARCH/include for tags, cscope
kbuild: asm symlink support for arch/$ARCH/include
kbuild: add arch/$ARCH/include to search path
This patchset is tested a more than
the previous one and is now also pushed out
to kbuild-next.git so it will apprear in -next shortly.
There were a few bugs around the symlink handling
and make tags is now also functional.
So I consider this ready for merging.
Any comments are welcome!
Patches will follow as reply to this one, but they
are only sent to kbuild and lkml.
Sam
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include
2008-06-22 22:05 ` Sam Ravnborg
@ 2008-06-22 22:08 ` Sam Ravnborg
2008-06-24 14:31 ` Arnd Bergmann
2008-06-22 22:08 ` [PATCH 2/5] kbuild: include/asm may be a file - fix mrproper for this Sam Ravnborg
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:08 UTC (permalink / raw)
To: linux-kbuild, LKML; +Cc: Sam Ravnborg
Factor out the headers_*_all support to a seperate
shell script and add support for arch specific
header files can be located in either
arch/$ARCH/include/asm
or
include/asm-$ARCH/
In "make help" always display the headers_* targets.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 49 ++++++++++++++++++++++---------------------------
| 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 27 deletions(-)
create mode 100755 scripts/headers.sh
diff --git a/Makefile b/Makefile
index 309f49d..4ea5189 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,9 @@ ifeq ($(ARCH),x86_64)
SRCARCH := x86
endif
+# Where to locate arch specific headers
+hdr-arch := $(SRCARCH)
+
KCONFIG_CONFIG ?= .config
# SHELL used by kbuild
@@ -1000,43 +1003,39 @@ depend dep:
#Default location for installed headers
export INSTALL_HDR_PATH = $(objtree)/usr
-hdr-filter := generic um ppc sparc64 cris
-hdr-archs := $(filter-out $(hdr-filter), \
- $(patsubst $(srctree)/include/asm-%/Kbuild,%, \
- $(wildcard $(srctree)/include/asm-*/Kbuild)))
hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+# Find out where the Kbuild file is located to support
+# arch/$(ARCH)/include/asm
+hdr-dir = $(strip \
+ $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
+ arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
+
+# If we do an all arch process set dst to asm-$(hdr-arch)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
PHONY += __headers
__headers: include/linux/version.h scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
PHONY += headers_install_all
-headers_install_all: __headers
- $(Q)$(MAKE) $(hdr-inst)=include
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) $(hdr-inst)=include/asm-$$arch \
- SRCARCH=$$arch dst=include/asm-$$arch; \
- done
+headers_install_all:
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
PHONY += headers_install
headers_install: __headers
- $(if $(wildcard $(srctree)/include/asm-$(SRCARCH)/Kbuild),, \
- $(error Headers not exportable for this architecture ($(SRCARCH))))
+ $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
+ $(error Headers not exportable for the $(SRCARCH) architecture))
$(Q)$(MAKE) $(hdr-inst)=include
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) dst=include/asm
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
PHONY += headers_check_all
headers_check_all: headers_install_all
- $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)set -e; for arch in $(hdr-archs); do \
- $(MAKE) SRCARCH=$$arch $(hdr-inst)=include/asm-$$arch HDRCHECK=1 ;\
- done
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
- $(Q)$(MAKE) $(hdr-inst)=include/asm-$(SRCARCH) \
- dst=include/asm HDRCHECK=1
+ $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
# ---------------------------------------------------------------------------
# Modules
@@ -1217,21 +1216,17 @@ help:
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
@echo ' kernelversion - Output the version stored in Makefile'
- @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
- echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
+ @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
echo ' (default: $(INSTALL_HDR_PATH))'; \
- fi
- @echo ''
+ echo ''
@echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel'
@echo ' versioncheck - Sanity check on version.h usage'
@echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
- @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
- echo ' headers_check - Sanity check on exported headers'; \
- fi
- @echo ''
+ @echo ' headers_check - Sanity check on exported headers'; \
+ echo ''
@echo 'Kernel packaging:'
@$(MAKE) $(build)=$(package-dir) help
@echo ''
--git a/scripts/headers.sh b/scripts/headers.sh
new file mode 100755
index 0000000..d33426f
--- /dev/null
+++ b/scripts/headers.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Run headers_$1 command for all suitable architectures
+
+# Stop on error
+set -e
+
+do_command()
+{
+ if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
+ make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
+ else
+ printf "Ignoring arch: %s\n" ${arch}
+ fi
+}
+
+# Do not try this architecture
+drop="generic um ppc sparc64 cris"
+
+archs=$(ls ${srctree}/arch)
+
+for arch in ${archs}; do
+ case ${arch} in
+ um) # no userspace export
+ ;;
+ ppc) # headers exported by powerpc
+ ;;
+ sparc64) # headers exported by sparc
+ ;;
+ cris) # headers export are known broken
+ ;;
+ *)
+ if [ -d ${srctree}/arch/${arch} ]; then
+ do_command $1 ${arch}
+ fi
+ ;;
+ esac
+done
+
+
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/5] kbuild: include/asm may be a file - fix mrproper for this
2008-06-22 22:05 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
@ 2008-06-22 22:08 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 3/5] kbuild: support arch/$ARCH/include for tags, cscope Sam Ravnborg
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:08 UTC (permalink / raw)
To: linux-kbuild, LKML; +Cc: Sam Ravnborg
I upcoming patch include/asm is a directory when we do
a "make O=..." build, so teach mrproper to handle this
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 4ea5189..ef30745 100644
--- a/Makefile
+++ b/Makefile
@@ -1120,8 +1120,8 @@ CLEAN_FILES += vmlinux System.map \
.tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
# Directories & files removed with 'make mrproper'
-MRPROPER_DIRS += include/config include2 usr/include
-MRPROPER_FILES += .config .config.old include/asm .version .old_version \
+MRPROPER_DIRS += include/config include2 usr/include include/asm
+MRPROPER_FILES += .config .config.old .version .old_version \
include/linux/autoconf.h include/linux/version.h \
include/linux/utsrelease.h \
include/linux/bounds.h include/asm*/asm-offsets.h \
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/5] kbuild: support arch/$ARCH/include for tags, cscope
2008-06-22 22:05 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
2008-06-22 22:08 ` [PATCH 2/5] kbuild: include/asm may be a file - fix mrproper for this Sam Ravnborg
@ 2008-06-22 22:08 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 4/5] kbuild: asm symlink support for arch/$ARCH/include Sam Ravnborg
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:08 UTC (permalink / raw)
To: linux-kbuild, LKML; +Cc: Sam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index ef30745..115eb48 100644
--- a/Makefile
+++ b/Makefile
@@ -1399,7 +1399,11 @@ define find-sources
\( -name config -o -name 'asm-*' \) -prune \
-o -name $1 -print; \
for arch in $(ALLINCLUDE_ARCHS) ; do \
- find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+ test -e $(__srctree)include/asm-$${arch} && \
+ find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+ -name $1 -print; \
+ test -e $(__srctree)arch/$${arch}/include/asm && \
+ find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
-name $1 -print; \
done ; \
find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/5] kbuild: asm symlink support for arch/$ARCH/include
2008-06-22 22:05 ` Sam Ravnborg
` (2 preceding siblings ...)
2008-06-22 22:08 ` [PATCH 3/5] kbuild: support arch/$ARCH/include for tags, cscope Sam Ravnborg
@ 2008-06-22 22:08 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 5/5] kbuild: add arch/$ARCH/include to search path Sam Ravnborg
2008-06-24 15:32 ` Support arch/$ARCH/include in kbuild Arnd Bergmann
5 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:08 UTC (permalink / raw)
To: linux-kbuild, LKML; +Cc: Sam Ravnborg
Adjust the asm symlink support so we do not create the
symlink unless really needed.
We check the precense of include/asm-$ARCH by checking
for the system.h file. We may end up with a stale directory
so it is not enough to check if the directory is present.
For "make O=..." build if we see that asm is a symlink
then it is deleted. This happens when we apply this patch
to a kernel with a valid build - so we do not require
a "make mrproper".
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Kbuild | 2 +-
Makefile | 50 ++++++++++++++++++++++++++++++++++++--------------
2 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/Kbuild b/Kbuild
index e750e9c..254a6af 100644
--- a/Kbuild
+++ b/Kbuild
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
# 2) Generate asm-offsets.h
#
-offsets-file := include/asm-$(SRCARCH)/asm-offsets.h
+offsets-file := include/asm/asm-offsets.h
always += $(offsets-file)
targets += $(offsets-file)
diff --git a/Makefile b/Makefile
index 115eb48..aac0ae0 100644
--- a/Makefile
+++ b/Makefile
@@ -921,7 +921,9 @@ ifneq ($(KBUILD_SRC),)
/bin/false; \
fi;
$(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
- $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm
+ $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
+ ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
+ fi
endif
# prepare2 creates a makefile if using a separate output directory
@@ -947,22 +949,42 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
# The asm symlink changes when $(ARCH) changes.
# Detect this and ask user to run make mrproper
-
-include/asm: FORCE
- $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
- if [ -L include/asm ]; then \
- if [ "$$asmlink" != "$(SRCARCH)" ]; then \
+define check-symlink
+ set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
+ if [ -L include/asm ]; then \
+ if [ "$$asmlink" != "$(SRCARCH)" ]; then \
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
- exit 1; \
- fi; \
- else \
- echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
- if [ ! -d include ]; then \
- mkdir -p include; \
- fi; \
- ln -fsn asm-$(SRCARCH) $@; \
+ exit 1; \
+ fi; \
fi
+endef
+
+# For make O=... builds we create a directory when we create
+# asm-offsets so no need to try to create a symlink then
+ifneq ($(KBUILD_SRC),)
+define create-symlink
+ if [ -L include/asm ]; then \
+ rm include/asm; \
+ fi
+endef
+else
+define create-symlink
+ if [ ! -L include/asm ]; then \
+ if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
+ echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
+ if [ ! -d include ]; then \
+ mkdir -p include; \
+ fi; \
+ ln -fsn asm-$(SRCARCH) $@; \
+ fi \
+ fi
+endef
+endif
+
+include/asm: FORCE
+ $(Q)$(check-symlink)
+ $(Q)$(create-symlink)
# Generate some files
# ---------------------------------------------------------------------------
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/5] kbuild: add arch/$ARCH/include to search path
2008-06-22 22:05 ` Sam Ravnborg
` (3 preceding siblings ...)
2008-06-22 22:08 ` [PATCH 4/5] kbuild: asm symlink support for arch/$ARCH/include Sam Ravnborg
@ 2008-06-22 22:08 ` Sam Ravnborg
2008-06-24 15:32 ` Support arch/$ARCH/include in kbuild Arnd Bergmann
5 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-22 22:08 UTC (permalink / raw)
To: linux-kbuild, LKML; +Cc: Sam Ravnborg
This patch conclude the support for
arch/$ARCH/include
Note: The individual architectures will most likely require
a few minor patches to support locating header files in
arch/$ARCH/include
Testing shows that it worked out-of-the-box for sparc,
but x86 requireds a few trivial changes in the
arch specific Makefile (and one include path needs to be adjusted).
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index aac0ae0..2628295 100644
--- a/Makefile
+++ b/Makefile
@@ -329,7 +329,8 @@ AFLAGS_KERNEL =
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude \
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
- -include include/linux/autoconf.h
+ -I$(srctree)/arch/$(hdr-arch)/include \
+ -include include/linux/autoconf.h
KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
--
1.5.4.1.143.ge7e51
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include
2008-06-22 22:08 ` [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
@ 2008-06-24 14:31 ` Arnd Bergmann
0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2008-06-24 14:31 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kbuild, LKML
On Monday 23 June 2008, Sam Ravnborg wrote:
> +# Do not try this architecture
> +drop="generic um ppc sparc64 cris"
> +
> +archs=$(ls ${srctree}/arch)
> +
> +for arch in ${archs}; do
> + case ${arch} in
> + um) # no userspace export
> + ;;
> + ppc) # headers exported by powerpc
> + ;;
Note that arch/ppc is scheduled for removal with the 2.6.27 merge
window, so you may want to leave it out right away.
Arnd <><
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Support arch/$ARCH/include in kbuild
2008-06-22 22:05 ` Sam Ravnborg
` (4 preceding siblings ...)
2008-06-22 22:08 ` [PATCH 5/5] kbuild: add arch/$ARCH/include to search path Sam Ravnborg
@ 2008-06-24 15:32 ` Arnd Bergmann
2008-06-26 18:56 ` Sam Ravnborg
5 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2008-06-24 15:32 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: LKML, linux-kbuild, Linus Torvalds
On Monday 23 June 2008, Sam Ravnborg wrote:
> Any comments are welcome!
> Patches will follow as reply to this one, but they
> are only sent to kbuild and lkml.
I think you need to fix up all instances of #include <asm-$ARCH/$FILE>,
grep ^#[:ws:]*include.*[\"\<]asm-[^g].*/ `git-ls-files`
Documentation/lguest/lguest.c:#include "asm-x86/bootparam.h"
arch/ia64/ia32/audit.c:#include <asm-x86/unistd_32.h>
arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/processor.h>
arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/ptrace.h>
arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/siginfo.h>
arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/sigcontext.h>
arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/mca.h>
arch/ia64/kernel/jprobes.S:#include <asm-ia64/break.h>
arch/mips/mips-boards/generic/amon.c:#include <asm-mips/addrspace.h>
arch/mips/mips-boards/generic/amon.c:#include <asm-mips/mips-boards/launch.h>
arch/mips/mips-boards/generic/amon.c:#include <asm-mips/mipsmtregs.h>
arch/powerpc/platforms/86xx/mpc86xx_smp.c:#include <asm-powerpc/mpic.h>
arch/sparc64/kernel/compat_audit.c:#include <asm-sparc/unistd.h>
arch/um/sys-x86_64/syscall_table.c:#include <asm-x86/unistd_64.h>
arch/um/sys-x86_64/syscall_table.c:#include <asm-x86/unistd_64.h>
drivers/char/agp/parisc-agp.c:#include <asm-parisc/parisc-device.h>
drivers/char/agp/parisc-agp.c:#include <asm-parisc/ropes.h>
drivers/infiniband/hw/ehca/ehca_reqs.c:#include <asm-powerpc/system.h>
drivers/s390/net/qeth_core_main.c:#include <asm-s390/ebcdic.h>
drivers/s390/net/qeth_core_main.c:#include <asm-s390/io.h>
include/asm-arm/arch-omap/board.h:#include <asm-arm/arch-omap/board-nokia.h>
include/asm-blackfin/gpio.h:#include <asm-blackfin/mach-bf548/gpio.h>
include/asm-m68knommu: lots of #include <asm-m68k/*>
include/asm-parisc/ropes.h:#include <asm-parisc/parisc-device.h>
include/asm-powerpc/irqflags.h:#include <asm-powerpc/hw_irq.h>
include/asm-sparc64: lots of #include <asm-sparc/*>
most of these are obvious, the interesting ones being sparc64, m68knommu
and arch/um as well as arch/ia64/ia32/audit.c.
The best idea I have for sparc64 and m68knommu would be to use
"gcc -Iarch/sparc64/include -Iarch/sparc/include" and then remove the
respective files from sparc64. On m68knommu, this works as well, except
for the pci.h and setup.h files that include the m68k one and then
do some more.
Arnd <><
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Support arch/$ARCH/include in kbuild
2008-06-24 15:32 ` Support arch/$ARCH/include in kbuild Arnd Bergmann
@ 2008-06-26 18:56 ` Sam Ravnborg
0 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2008-06-26 18:56 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: LKML, linux-kbuild, Linus Torvalds
On Tue, Jun 24, 2008 at 05:32:57PM +0200, Arnd Bergmann wrote:
> On Monday 23 June 2008, Sam Ravnborg wrote:
>
> > Any comments are welcome!
> > Patches will follow as reply to this one, but they
> > are only sent to kbuild and lkml.
>
> I think you need to fix up all instances of #include <asm-$ARCH/$FILE>,
>
> grep ^#[:ws:]*include.*[\"\<]asm-[^g].*/ `git-ls-files`
>
> Documentation/lguest/lguest.c:#include "asm-x86/bootparam.h"
> arch/ia64/ia32/audit.c:#include <asm-x86/unistd_32.h>
> arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/processor.h>
> arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/ptrace.h>
> arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/siginfo.h>
> arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/sigcontext.h>
> arch/ia64/kernel/asm-offsets.c:#include <asm-ia64/mca.h>
> arch/ia64/kernel/jprobes.S:#include <asm-ia64/break.h>
> arch/mips/mips-boards/generic/amon.c:#include <asm-mips/addrspace.h>
> arch/mips/mips-boards/generic/amon.c:#include <asm-mips/mips-boards/launch.h>
> arch/mips/mips-boards/generic/amon.c:#include <asm-mips/mipsmtregs.h>
> arch/powerpc/platforms/86xx/mpc86xx_smp.c:#include <asm-powerpc/mpic.h>
> arch/sparc64/kernel/compat_audit.c:#include <asm-sparc/unistd.h>
> arch/um/sys-x86_64/syscall_table.c:#include <asm-x86/unistd_64.h>
> arch/um/sys-x86_64/syscall_table.c:#include <asm-x86/unistd_64.h>
> drivers/char/agp/parisc-agp.c:#include <asm-parisc/parisc-device.h>
> drivers/char/agp/parisc-agp.c:#include <asm-parisc/ropes.h>
> drivers/infiniband/hw/ehca/ehca_reqs.c:#include <asm-powerpc/system.h>
> drivers/s390/net/qeth_core_main.c:#include <asm-s390/ebcdic.h>
> drivers/s390/net/qeth_core_main.c:#include <asm-s390/io.h>
> include/asm-arm/arch-omap/board.h:#include <asm-arm/arch-omap/board-nokia.h>
> include/asm-blackfin/gpio.h:#include <asm-blackfin/mach-bf548/gpio.h>
> include/asm-m68knommu: lots of #include <asm-m68k/*>
> include/asm-parisc/ropes.h:#include <asm-parisc/parisc-device.h>
> include/asm-powerpc/irqflags.h:#include <asm-powerpc/hw_irq.h>
> include/asm-sparc64: lots of #include <asm-sparc/*>
>
> most of these are obvious, the interesting ones being sparc64, m68knommu
> and arch/um as well as arch/ia64/ia32/audit.c.
>
> The best idea I have for sparc64 and m68knommu would be to use
> "gcc -Iarch/sparc64/include -Iarch/sparc/include" and then remove the
> respective files from sparc64. On m68knommu, this works as well, except
> for the pci.h and setup.h files that include the m68k one and then
> do some more.
For sparc64 I have taken a bit more drastic approach and I am
merging the header files of sparc and sparc64.
My goal is to get sparc converted to use arch/sparc/include/asm
for 2.6.27.
Sam
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-06-26 18:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21 22:07 Support arch/$ARCH/include in kbuild Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
2008-06-21 22:08 ` [PATCH] kbuild: support arch/$ARCH/include/ Sam Ravnborg
2008-06-21 22:11 ` Support arch/$ARCH/include in kbuild Sam Ravnborg
2008-06-22 22:05 ` Sam Ravnborg
2008-06-22 22:08 ` [PATCH 1/5] kbuild: prepare headers_* for arch/$ARCH/include Sam Ravnborg
2008-06-24 14:31 ` Arnd Bergmann
2008-06-22 22:08 ` [PATCH 2/5] kbuild: include/asm may be a file - fix mrproper for this Sam Ravnborg
2008-06-22 22:08 ` [PATCH 3/5] kbuild: support arch/$ARCH/include for tags, cscope Sam Ravnborg
2008-06-22 22:08 ` [PATCH 4/5] kbuild: asm symlink support for arch/$ARCH/include Sam Ravnborg
2008-06-22 22:08 ` [PATCH 5/5] kbuild: add arch/$ARCH/include to search path Sam Ravnborg
2008-06-24 15:32 ` Support arch/$ARCH/include in kbuild Arnd Bergmann
2008-06-26 18:56 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox