ixp4xx: add kernel 2.6.35 preliminary support
[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 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
39 ARCH=$(LINUX_KARCH) \
40 CC="$(KERNEL_CC)" \
41 CFLAGS="$(TARGET_CFLAGS)" \
42 CROSS_COMPILE=$(TARGET_CROSS) \
43 KBUILD_HAVE_NLS=no \
44 CONFIG_SHELL=$(BASH)
45
46 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
47 define Host/Prepare/all
48 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
49 $(KMAKE) \
50 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
51 headers_install
52 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
53 $(CP) \
54 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
55 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
56 fi
57 endef
58 else
59 define Host/Prepare/all
60 $(KMAKE) include/linux/version.h include/asm
61 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
62 cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
63 cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
64 cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
65 cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
66 endef
67 endif
68
69 # XXX: the following is needed to build lzma-loader
70 define Host/Prepare/lzma
71 $(CP) \
72 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
73 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
74 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
75 endef
76
77 define Host/Prepare/post/cris
78 $(CP) \
79 $(HOST_BUILD_DIR)/include/linux/user.h \
80 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
81 ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch-v10/arch \
82 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch
83 $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/user.h
84 endef
85
86 define Host/Prepare/post/ubicom32
87 $(CP) \
88 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
89 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
90 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
91 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
92 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
93 endef
94
95 define Host/Prepare/post/mips
96 $(call Host/Prepare/lzma)
97 endef
98
99 define Host/Prepare/post/mipsel
100 $(call Host/Prepare/lzma)
101 endef
102
103 define Host/Prepare
104 $(call Kernel/Prepare/Default)
105 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
106 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
107 yes '' | $(KMAKE) oldconfig
108 $(call Host/Prepare/all)
109 $(call Host/Prepare/post/$(ARCH))
110 endef
111
112 define Host/Configure
113 endef
114
115 define Host/Compile
116 endef
117
118 define Host/Install
119 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
120 endef
121
122 define Host/Clean
123 rm -rf \
124 $(HOST_BUILD_DIR) \
125 $(BUILD_DIR_TOOLCHAIN)/linux \
126 $(BUILD_DIR_TOOLCHAIN)/linux-dev
127 endef
128
129 $(eval $(call HostBuild))
This page took 0.050881 seconds and 5 git commands to generate.