[kernel] update to 2.6.30.6, compile tested on some targets only
[openwrt.git] / toolchain / kernel-headers / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8
9 KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
10 BUILD_DIR := $(KERNEL_BUILD_DIR)
11
12 override QUILT:=
13 override HOST_QUILT:=
14
15 include $(INCLUDE_DIR)/kernel.mk
16
17 PKG_NAME:=linux
18 PKG_VERSION:=$(LINUX_VERSION)
19 PKG_SOURCE:=$(LINUX_SOURCE)
20 PKG_SOURCE_URL:=$(LINUX_SITE)
21 HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
22 PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
23 LINUX_DIR := $(HOST_BUILD_DIR)
24
25 include $(INCLUDE_DIR)/toolchain-build.mk
26 include $(INCLUDE_DIR)/kernel-defaults.mk
27
28 ifeq ($(strip $(BOARD)),uml)
29 LINUX_KARCH:=$(ARCH)
30 endif
31
32 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
33 LINUX_HAS_HEADERS_INSTALL:=y
34 endif
35
36 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
37 ARCH=$(LINUX_KARCH) \
38 KBUILD_HAVE_NLS=no \
39 CONFIG_SHELL=$(BASH)
40
41 define Host/Prepare/pre/powerpc
42 if [ -d $(HOST_BUILD_DIR)/include/asm-ppc ]; then \
43 mkdir -p $(PKG_BUILD_DIR)/include/asm-powerpc/; \
44 $(CP) $(HOST_BUILD_DIR)/include/asm-ppc/* $(HOST_BUILD_DIR)/include/asm-powerpc/; \
45 rm -rf $(HOST_BUILD_DIR)/include/asm-ppc; \
46 ln -s $(HOST_BUILD_DIR)/include/asm-powerpc $(HOST_BUILD_DIR)/include/asm-ppc; \
47 fi
48 endef
49
50 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
51 define Host/Prepare/all
52 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
53 $(KMAKE) \
54 CROSS_COMPILE=$(TARGET_CROSS) \
55 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
56 headers_install
57 endef
58 else
59 define Host/Prepare/all
60 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
61 cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
62 cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
63 cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
64 cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
65 endef
66 endif
67
68 # XXX: the following is needed to build lzma-loader
69 define Host/Prepare/lzma
70 $(CP) \
71 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
72 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
73 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
74 endef
75
76 # XXX: the following are needed to build a cris toolchain
77 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),lt,2.6.28)),1)
78 define Host/Prepare/pre/cris
79 ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/include/asm-cris/arch
80 ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/arch/cris/arch
81 endef
82
83 define Host/Prepare/post/cris
84 $(CP) \
85 $(HOST_BUILD_DIR)/include/linux/user.h \
86 $(HOST_BUILD_DIR)/include/linux/autoconf.h \
87 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
88 $(CP) \
89 $(HOST_BUILD_DIR)/include/asm-cris/elf.h \
90 $(HOST_BUILD_DIR)/include/asm-cris/page.h \
91 $(HOST_BUILD_DIR)/include/asm-cris/user.h \
92 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
93 $(CP) \
94 $(HOST_BUILD_DIR)/include/asm-generic/memory_model.h \
95 $(HOST_BUILD_DIR)/include/asm-generic/page.h \
96 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/
97
98 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch
99 $(CP) \
100 $(HOST_BUILD_DIR)/include/asm-cris/arch/elf.h \
101 $(HOST_BUILD_DIR)/include/asm-cris/arch/page.h \
102 $(HOST_BUILD_DIR)/include/asm-cris/arch/ptrace.h \
103 $(HOST_BUILD_DIR)/include/asm-cris/arch/user.h \
104 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/
105 endef
106 else
107 define Host/Prepare/post/cris
108 $(CP) \
109 $(HOST_BUILD_DIR)/include/linux/user.h \
110 $(HOST_BUILD_DIR)/include/linux/autoconf.h \
111 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
112 ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch-v10/arch \
113 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch
114 $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/user.h
115 endef
116 endif
117
118 define Host/Prepare/post/ubicom32
119 $(CP) \
120 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
121 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
122 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
123 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
124 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
125 endef
126
127 define Host/Prepare/post/mips
128 $(call Host/Prepare/lzma)
129 endef
130
131 define Host/Prepare/post/mipsel
132 $(call Host/Prepare/lzma)
133 endef
134
135 define Host/Prepare
136 $(call Kernel/Prepare/Default)
137 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
138 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
139 yes '' | $(KMAKE) oldconfig
140 $(KMAKE) include/linux/version.h include/asm
141 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
142 $(CP) \
143 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
144 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
145 fi
146 $(call Host/Prepare/pre/$(ARCH))
147 $(call Host/Prepare/all)
148 $(call Host/Prepare/post/$(ARCH))
149 endef
150
151 define Host/Configure
152 endef
153
154 define Host/Compile
155 endef
156
157 define Host/Install
158 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
159 endef
160
161 define Host/Clean
162 rm -rf \
163 $(HOST_BUILD_DIR) \
164 $(BUILD_DIR_TOOLCHAIN)/linux \
165 $(BUILD_DIR_TOOLCHAIN)/linux-dev
166 endef
167
168 $(eval $(call HostBuild))
This page took 0.051731 seconds and 5 git commands to generate.