package/busybox: add upstream hush patch, bump release number
[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 FILES_DIR :=
25 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
26
27 include $(INCLUDE_DIR)/toolchain-build.mk
28 include $(INCLUDE_DIR)/kernel-defaults.mk
29
30 ifeq ($(strip $(BOARD)),uml)
31 LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
32 endif
33
34 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
35 LINUX_HAS_HEADERS_INSTALL:=y
36 endif
37
38 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.33)),1)
39 LINUX_ASM_INCLUDES:=arch/$(LINUX_KARCH)/include/asm
40 else
41 LINUX_ASM_INCLUDES:=include/asm
42 endif
43
44 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
45 ARCH=$(LINUX_KARCH) \
46 KBUILD_HAVE_NLS=no \
47 CONFIG_SHELL=$(BASH)
48
49 define Host/Prepare/pre/powerpc
50 if [ -d $(HOST_BUILD_DIR)/include/asm-ppc ]; then \
51 mkdir -p $(PKG_BUILD_DIR)/include/asm-powerpc/; \
52 $(CP) $(HOST_BUILD_DIR)/include/asm-ppc/* $(HOST_BUILD_DIR)/include/asm-powerpc/; \
53 rm -rf $(HOST_BUILD_DIR)/include/asm-ppc; \
54 ln -s $(HOST_BUILD_DIR)/include/asm-powerpc $(HOST_BUILD_DIR)/include/asm-ppc; \
55 fi
56 endef
57
58 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
59 define Host/Prepare/all
60 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
61 $(KMAKE) \
62 CROSS_COMPILE=$(TARGET_CROSS) \
63 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
64 headers_install
65 endef
66 else
67 define Host/Prepare/all
68 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
69 cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
70 cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
71 cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
72 cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
73 endef
74 endif
75
76 # XXX: the following is needed to build lzma-loader
77 define Host/Prepare/lzma
78 $(CP) \
79 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
80 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
81 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
82 endef
83
84 define Host/Prepare/post/cris
85 $(CP) \
86 $(HOST_BUILD_DIR)/include/linux/user.h \
87 $(HOST_BUILD_DIR)/include/linux/autoconf.h \
88 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
89 ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch-v10/arch \
90 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch
91 $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/user.h
92 endef
93
94 define Host/Prepare/post/ubicom32
95 $(CP) \
96 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
97 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
98 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
99 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
100 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
101 endef
102
103 define Host/Prepare/post/mips
104 $(call Host/Prepare/lzma)
105 endef
106
107 define Host/Prepare/post/mipsel
108 $(call Host/Prepare/lzma)
109 endef
110
111 define Host/Prepare
112 $(call Kernel/Prepare/Default)
113 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
114 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
115 yes '' | $(KMAKE) oldconfig
116 $(KMAKE) include/linux/version.h $(LINUX_ASM_INCLUDES)
117 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
118 $(CP) \
119 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
120 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
121 fi
122 $(call Host/Prepare/pre/$(ARCH))
123 $(call Host/Prepare/all)
124 $(call Host/Prepare/post/$(ARCH))
125 endef
126
127 define Host/Configure
128 endef
129
130 define Host/Compile
131 endef
132
133 define Host/Install
134 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
135 endef
136
137 define Host/Clean
138 rm -rf \
139 $(HOST_BUILD_DIR) \
140 $(BUILD_DIR_TOOLCHAIN)/linux \
141 $(BUILD_DIR_TOOLCHAIN)/linux-dev
142 endef
143
144 $(eval $(call HostBuild))
This page took 0.042152 seconds and 5 git commands to generate.