2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
9 KERNEL_BUILD_DIR
:= $(BUILD_DIR_TOOLCHAIN
)
10 BUILD_DIR
:= $(KERNEL_BUILD_DIR
)
12 STAGING_DIR_HOST
:=$(TOOLCHAIN_DIR
)
13 BUILD_DIR_HOST
:=$(BUILD_DIR_TOOLCHAIN
)
16 override CONFIG_AUTOREBUILD
=
18 include $(INCLUDE_DIR
)/kernel.mk
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
)
28 include $(INCLUDE_DIR
)/host-build.mk
29 include $(INCLUDE_DIR
)/kernel-defaults.mk
31 ifeq ($(strip $(BOARD
)),uml
)
35 ifeq ($(strip $(call CompareKernelPatchVer
,$(KERNEL_PATCHVER
),ge
,2.6.18)),1)
36 LINUX_HAS_HEADERS_INSTALL
:=y
39 KMAKE
:= $(MAKE
) -C
$(PKG_BUILD_DIR
) \
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
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
; \
57 ifneq ($(LINUX_HAS_HEADERS_INSTALL
),)
58 define Build
/Prepare
/all
59 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
61 CROSS_COMPILE
=$(TARGET_CROSS
) \
62 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
66 define Build
/Prepare
/all
67 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include
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/
77 # XXX: the following is needed to build lzma-loader
78 define Build
/Prepare
/lzma
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
/
85 # XXX: the following are needed to build a cris toolchain
86 define Build
/Prepare
/post
/cris
88 $(PKG_BUILD_DIR
)/include/linux
/user.h \
89 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
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
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
/
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
/
108 define Build
/Prepare
/post
/mips
109 $(call Build
/Prepare
/lzma
)
112 define Build
/Prepare
/post
/mipsel
113 $(call Build
/Prepare
/lzma
)
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 \
124 $(PKG_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
/. \
125 $(PKG_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
)/; \
127 $(call Build
/Prepare
/pre
/$(ARCH
))
128 $(call Build
/Prepare
/all)
129 $(call Build
/Prepare
/post
/$(ARCH
))
132 define Build
/Configure
139 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
145 $(BUILD_DIR_TOOLCHAIN
)/linux \
146 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
149 $(eval
$(call HostBuild
))