[kernel] update to 2.6.28.4
[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 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
13 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
14
15 override QUILT:=
16 override CONFIG_AUTOREBUILD=
17
18 include $(INCLUDE_DIR)/kernel.mk
19
20 PKG_NAME:=linux
21 PKG_VERSION:=$(LINUX_VERSION)
22 PKG_SOURCE:=$(LINUX_SOURCE)
23 PKG_SOURCE_URL:=$(LINUX_SITE)
24 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
25 PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
26 LINUX_DIR := $(PKG_BUILD_DIR)
27
28 include $(INCLUDE_DIR)/host-build.mk
29 include $(INCLUDE_DIR)/kernel-defaults.mk
30
31 ifeq ($(strip $(BOARD)),uml)
32 LINUX_KARCH:=$(ARCH)
33 endif
34
35 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
36 LINUX_HAS_HEADERS_INSTALL:=y
37 endif
38
39 KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \
40 ARCH=$(LINUX_KARCH) \
41 KBUILD_HAVE_NLS=no \
42 CONFIG_SHELL=$(BASH)
43
44 define Build/Prepare/pre/cris
45 ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch
46 ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch
47 endef
48
49 define Build/Prepare/pre/powerpc
50 if [ -d $(PKG_BUILD_DIR)/include/asm-ppc ]; then \
51 $(CP) $(PKG_BUILD_DIR)/include/asm-ppc/* $(PKG_BUILD_DIR)/include/asm-powerpc/; \
52 rm -rf $(PKG_BUILD_DIR)/include/asm-ppc; \
53 ln -s $(PKG_BUILD_DIR)/include/asm-powerpc $(PKG_BUILD_DIR)/include/asm-ppc; \
54 fi
55 endef
56
57 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
58 define Build/Prepare/all
59 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
60 $(KMAKE) \
61 CROSS_COMPILE=$(TARGET_CROSS) \
62 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
63 headers_install
64 endef
65 else
66 define Build/Prepare/all
67 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
68 cp -pLR \
69 $(PKG_BUILD_DIR)/include/asm \
70 $(PKG_BUILD_DIR)/include/asm-generic \
71 $(PKG_BUILD_DIR)/include/asm-$(LINUX_KARCH) \
72 $(PKG_BUILD_DIR)/include/linux \
73 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
74 endef
75 endif
76
77 # XXX: the following is needed to build lzma-loader
78 define Build/Prepare/lzma
79 $(CP) \
80 $(PKG_BUILD_DIR)/include/asm-mips/asm.h \
81 $(PKG_BUILD_DIR)/include/asm-mips/regdef.h \
82 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
83 endef
84
85 # XXX: the following are needed to build a cris toolchain
86 define Build/Prepare/post/cris
87 $(CP) \
88 $(PKG_BUILD_DIR)/include/linux/user.h \
89 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
90 $(CP) \
91 $(PKG_BUILD_DIR)/include/asm-cris/elf.h \
92 $(PKG_BUILD_DIR)/include/asm-cris/page.h \
93 $(PKG_BUILD_DIR)/include/asm-cris/user.h \
94 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
95 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch
96 $(CP) \
97 $(PKG_BUILD_DIR)/include/asm-cris/arch/elf.h \
98 $(PKG_BUILD_DIR)/include/asm-cris/arch/page.h \
99 $(PKG_BUILD_DIR)/include/asm-cris/arch/ptrace.h \
100 $(PKG_BUILD_DIR)/include/asm-cris/arch/user.h \
101 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/
102 $(CP) \
103 $(PKG_BUILD_DIR)/include/asm-generic/memory_model.h \
104 $(PKG_BUILD_DIR)/include/asm-generic/page.h \
105 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/
106 endef
107
108 define Build/Prepare/post/mips
109 $(call Build/Prepare/lzma)
110 endef
111
112 define Build/Prepare/post/mipsel
113 $(call Build/Prepare/lzma)
114 endef
115
116 define Build/Prepare
117 $(call Kernel/Prepare/Default)
118 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
119 $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
120 yes '' | $(KMAKE) oldconfig
121 $(KMAKE) include/linux/version.h include/asm
122 if [ -d $(PKG_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
123 $(CP) \
124 $(PKG_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
125 $(PKG_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
126 fi
127 $(call Build/Prepare/pre/$(ARCH))
128 $(call Build/Prepare/all)
129 $(call Build/Prepare/post/$(ARCH))
130 endef
131
132 define Build/Configure
133 endef
134
135 define Build/Compile
136 endef
137
138 define Build/Install
139 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
140 endef
141
142 define Build/Clean
143 rm -rf \
144 $(PKG_BUILD_DIR) \
145 $(BUILD_DIR_TOOLCHAIN)/linux \
146 $(BUILD_DIR_TOOLCHAIN)/linux-dev
147 endef
148
149 $(eval $(call HostBuild))
This page took 0.046794 seconds and 5 git commands to generate.