2 # Copyright (C) 2006-2008 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 KMAKE
:= $(MAKE
) -C
$(PKG_BUILD_DIR
) \
40 define Build
/Prepare
/pre
/cris
41 ln
-sf
$(PKG_BUILD_DIR
)/include/asm-cris
/arch-v10
$(PKG_BUILD_DIR
)/include/asm-cris
/arch
42 ln
-sf
$(PKG_BUILD_DIR
)/include/asm-cris
/arch-v10
$(PKG_BUILD_DIR
)/arch
/cris
/arch
45 define Build
/Prepare
/pre
/powerpc
46 if
[ -d
$(PKG_BUILD_DIR
)/include/asm-ppc
]; then \
47 $(CP
) $(PKG_BUILD_DIR
)/include/asm-ppc
/* $(PKG_BUILD_DIR
)/include/asm-powerpc
/; \
48 rm -rf
$(PKG_BUILD_DIR
)/include/asm-ppc
; \
49 ln
-s
$(PKG_BUILD_DIR
)/include/asm-powerpc
$(PKG_BUILD_DIR
)/include/asm-ppc
; \
53 ifeq ($(strip $(call CompareKernelPatchVer
,$(KERNEL_PATCHVER
),ge
,2.6.18)),1)
54 define Build
/Prepare
/all
55 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
57 CROSS_COMPILE
=$(TARGET_CROSS
) \
58 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
62 define Build
/Prepare
/all
63 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include
65 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm \
66 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic \
67 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(LINUX_KARCH
) \
68 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux \
69 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
74 $(call Kernel
/Prepare
/Default
)
75 $(SED
) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR
)/Makefile
76 ln
-sf linux-
$(LINUX_VERSION
) $(LINUX_HEADERS_DIR
)
77 yes
'' |
$(KMAKE
) oldconfig
78 $(KMAKE
) include/linux
/version.h
include/asm
79 if
[ -d
$(PKG_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
]; then \
81 $(PKG_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
/. \
82 $(PKG_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
)/; \
84 $(call Build
/Prepare
/pre
/$(ARCH
))
85 $(call Build
/Prepare
/all)
88 define Build
/Configure
94 define Build
/Install
/all
95 mkdir
-p
$(TOOLCHAIN_DIR
)/usr
/include
97 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/* \
98 $(TOOLCHAIN_DIR
)/usr
/include/
101 # XXX: the following is needed to build lzma-loader
102 define Build
/Install
/post
/lzma
104 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-mips
/asm.h \
105 $(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-mips
/regdef.h \
106 $(TOOLCHAIN_DIR
)/usr
/include/asm
/
109 define Build
/Install
/post
/mips
110 $(call Build
/Install
/post
/lzma
)
113 define Build
/Install
/post
/mipsel
114 $(call Build
/Install
/post
/lzma
)
118 $(call Build
/Install
/all)
119 $(call Build
/Install
/post
/$(ARCH
))
125 $(BUILD_DIR_TOOLCHAIN
)/linux \
126 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
129 $(eval
$(call HostBuild
))