aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Kbuild41
-rw-r--r--Makefile39
-rw-r--r--arch/i386/Makefile9
-rw-r--r--arch/i386/kernel/head.S2
-rw-r--r--arch/i386/kernel/vsyscall-sigreturn.S2
-rw-r--r--arch/i386/kernel/vsyscall.lds.S2
-rw-r--r--arch/i386/power/swsusp.S2
-rw-r--r--include/asm-i386/thread_info.h2
8 files changed, 57 insertions, 42 deletions
diff --git a/Kbuild b/Kbuild
new file mode 100644
index 000000000000..197ece85034b
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,41 @@
1#
2# Kbuild for top-level directory of the kernel
3# This file takes care of the following:
4# 1) Generate asm-offsets.h
5
6#####
7# 1) Generate asm-offsets.h
8#
9
10offsets-file := include/asm-$(ARCH)/asm-offsets.h
11
12always := $(offsets-file)
13targets := $(offsets-file)
14targets += arch/$(ARCH)/kernel/asm-offsets.s
15
16quiet_cmd_offsets = GEN $@
17define cmd_offsets
18 cat $< | \
19 (set -e; \
20 echo "#ifndef __ASM_OFFSETS_H__"; \
21 echo "#define __ASM_OFFSETS_H__"; \
22 echo "/*"; \
23 echo " * DO NOT MODIFY."; \
24 echo " *"; \
25 echo " * This file was generated by $(srctree)/Kbuild"; \
26 echo " *"; \
27 echo " */"; \
28 echo ""; \
29 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
30 echo ""; \
31 echo "#endif" ) > $@
32endef
33
34# We use internal kbuild rules to avoid the "is up to date" message from make
35arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
36 $(Q)mkdir -p $(dir $@)
37 $(call if_changed_dep,cc_s_c)
38
39$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
40 $(call cmd,offsets)
41
diff --git a/Makefile b/Makefile
index 63e5c9f0bc7a..2402430c87e6 100644
--- a/Makefile
+++ b/Makefile
@@ -776,14 +776,14 @@ $(vmlinux-dirs): prepare-all scripts
776# A multi level approach is used. prepare1 is updated first, then prepare0. 776# A multi level approach is used. prepare1 is updated first, then prepare0.
777# prepare-all is the collection point for the prepare targets. 777# prepare-all is the collection point for the prepare targets.
778 778
779.PHONY: prepare-all prepare prepare0 prepare1 prepare2 779.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3
780 780
781# prepare2 is used to check if we are building in a separate output directory, 781# prepare3 is used to check if we are building in a separate output directory,
782# and if so do: 782# and if so do:
783# 1) Check that make has not been executed in the kernel src $(srctree) 783# 1) Check that make has not been executed in the kernel src $(srctree)
784# 2) Create the include2 directory, used for the second asm symlink 784# 2) Create the include2 directory, used for the second asm symlink
785 785
786prepare2: 786prepare3:
787ifneq ($(KBUILD_SRC),) 787ifneq ($(KBUILD_SRC),)
788 @echo ' Using $(srctree) as source for kernel' 788 @echo ' Using $(srctree) as source for kernel'
789 $(Q)if [ -f $(srctree)/.config ]; then \ 789 $(Q)if [ -f $(srctree)/.config ]; then \
@@ -795,18 +795,21 @@ ifneq ($(KBUILD_SRC),)
795 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm 795 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
796endif 796endif
797 797
798# prepare1 creates a makefile if using a separate output directory 798# prepare2 creates a makefile if using a separate output directory
799prepare1: prepare2 outputmakefile 799prepare2: prepare3 outputmakefile
800 800
801prepare0: prepare1 include/linux/version.h include/asm \ 801prepare1: prepare2 include/linux/version.h include/asm \
802 include/config/MARKER 802 include/config/MARKER
803ifneq ($(KBUILD_MODULES),) 803ifneq ($(KBUILD_MODULES),)
804 $(Q)rm -rf $(MODVERDIR) 804 $(Q)rm -rf $(MODVERDIR)
805 $(Q)mkdir -p $(MODVERDIR) 805 $(Q)mkdir -p $(MODVERDIR)
806endif 806endif
807 807
808prepare0: prepare prepare1 FORCE
809 $(Q)$(MAKE) $(build)=$(srctree)
810
808# All the preparing.. 811# All the preparing..
809prepare-all: prepare0 prepare 812prepare-all: prepare0
810 813
811# Leave this as default for preprocessing vmlinux.lds.S, which is now 814# Leave this as default for preprocessing vmlinux.lds.S, which is now
812# done in arch/$(ARCH)/kernel/Makefile 815# done in arch/$(ARCH)/kernel/Makefile
@@ -949,26 +952,6 @@ modules modules_install: FORCE
949 952
950endif # CONFIG_MODULES 953endif # CONFIG_MODULES
951 954
952# Generate asm-offsets.h
953# ---------------------------------------------------------------------------
954
955define filechk_gen-asm-offsets
956 (set -e; \
957 echo "#ifndef __ASM_OFFSETS_H__"; \
958 echo "#define __ASM_OFFSETS_H__"; \
959 echo "/*"; \
960 echo " * DO NOT MODIFY."; \
961 echo " *"; \
962 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
963 echo " *"; \
964 echo " */"; \
965 echo ""; \
966 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
967 echo ""; \
968 echo "#endif" )
969endef
970
971
972### 955###
973# Cleaning is done on three levels. 956# Cleaning is done on three levels.
974# make clean Delete most generated files 957# make clean Delete most generated files
@@ -991,7 +974,7 @@ MRPROPER_FILES += .config .config.old include/asm .version \
991# 974#
992clean: rm-dirs := $(CLEAN_DIRS) 975clean: rm-dirs := $(CLEAN_DIRS)
993clean: rm-files := $(CLEAN_FILES) 976clean: rm-files := $(CLEAN_FILES)
994clean-dirs := $(addprefix _clean_,$(vmlinux-alldirs)) 977clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
995 978
996.PHONY: $(clean-dirs) clean archclean 979.PHONY: $(clean-dirs) clean archclean
997$(clean-dirs): 980$(clean-dirs):
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index bf7c9ba709f3..09951990a622 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -156,15 +156,6 @@ install: vmlinux
156install kernel_install: 156install kernel_install:
157 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 157 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
158 158
159prepare: include/asm-$(ARCH)/asm_offsets.h
160CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
161
162arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
163 include/config/MARKER
164
165include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
166 $(call filechk,gen-asm-offsets)
167
168archclean: 159archclean:
169 $(Q)$(MAKE) $(clean)=arch/i386/boot 160 $(Q)$(MAKE) $(clean)=arch/i386/boot
170 161
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 0480ca9e9e57..e437fb367498 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -17,7 +17,7 @@
17#include <asm/desc.h> 17#include <asm/desc.h>
18#include <asm/cache.h> 18#include <asm/cache.h>
19#include <asm/thread_info.h> 19#include <asm/thread_info.h>
20#include <asm/asm_offsets.h> 20#include <asm/asm-offsets.h>
21#include <asm/setup.h> 21#include <asm/setup.h>
22 22
23/* 23/*
diff --git a/arch/i386/kernel/vsyscall-sigreturn.S b/arch/i386/kernel/vsyscall-sigreturn.S
index 68afa50dd7cf..fadb5bc3c374 100644
--- a/arch/i386/kernel/vsyscall-sigreturn.S
+++ b/arch/i386/kernel/vsyscall-sigreturn.S
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include <asm/unistd.h> 9#include <asm/unistd.h>
10#include <asm/asm_offsets.h> 10#include <asm/asm-offsets.h>
11 11
12 12
13/* XXX 13/* XXX
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
index a7977707c8e5..98699ca6e52d 100644
--- a/arch/i386/kernel/vsyscall.lds.S
+++ b/arch/i386/kernel/vsyscall.lds.S
@@ -3,7 +3,7 @@
3 * object prelinked to its virtual address, and with only one read-only 3 * object prelinked to its virtual address, and with only one read-only
4 * segment (that fits in one page). This script controls its layout. 4 * segment (that fits in one page). This script controls its layout.
5 */ 5 */
6#include <asm/asm_offsets.h> 6#include <asm/asm-offsets.h>
7 7
8SECTIONS 8SECTIONS
9{ 9{
diff --git a/arch/i386/power/swsusp.S b/arch/i386/power/swsusp.S
index c4105286ff26..c893b897217f 100644
--- a/arch/i386/power/swsusp.S
+++ b/arch/i386/power/swsusp.S
@@ -12,7 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/segment.h> 13#include <asm/segment.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/asm_offsets.h> 15#include <asm/asm-offsets.h>
16 16
17 .text 17 .text
18 18
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index e2cb9fa6f563..8fbf791651bf 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -48,7 +48,7 @@ struct thread_info {
48 48
49#else /* !__ASSEMBLY__ */ 49#else /* !__ASSEMBLY__ */
50 50
51#include <asm/asm_offsets.h> 51#include <asm/asm-offsets.h>
52 52
53#endif 53#endif
54 54