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 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 $(PKG_BUILD_DIR
)/include/asm \
66 $(PKG_BUILD_DIR
)/include/asm-generic \
67 $(PKG_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
) \
68 $(PKG_BUILD_DIR
)/include/linux \
69 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
73 # XXX: the following is needed to build lzma-loader
74 define Build
/Prepare
/lzma
76 $(PKG_BUILD_DIR
)/include/asm-mips
/asm.h \
77 $(PKG_BUILD_DIR
)/include/asm-mips
/regdef.h \
78 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
81 # XXX: the following are needed to build a cris toolchain
82 define Build
/Prepare
/post
/cris
84 $(PKG_BUILD_DIR
)/include/linux
/user.h \
85 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
87 $(PKG_BUILD_DIR
)/include/asm-cris
/elf.h \
88 $(PKG_BUILD_DIR
)/include/asm-cris
/page.h \
89 $(PKG_BUILD_DIR
)/include/asm-cris
/user.h \
90 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
91 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
93 $(PKG_BUILD_DIR
)/include/asm-cris
/arch
/elf.h \
94 $(PKG_BUILD_DIR
)/include/asm-cris
/arch
/page.h \
95 $(PKG_BUILD_DIR
)/include/asm-cris
/arch
/ptrace.h \
96 $(PKG_BUILD_DIR
)/include/asm-cris
/arch
/user.h \
97 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
/
99 $(PKG_BUILD_DIR
)/include/asm-generic
/memory_model.h \
100 $(PKG_BUILD_DIR
)/include/asm-generic
/page.h \
101 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm-generic
/
104 define Build
/Prepare
/post
/mips
105 $(call Build
/Prepare
/lzma
)
108 define Build
/Prepare
/post
/mipsel
109 $(call Build
/Prepare
/lzma
)
113 $(call Kernel
/Prepare
/Default
)
114 ln
-sf linux-
$(LINUX_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/linux
115 $(SED
) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR
)/Makefile
116 yes
'' |
$(KMAKE
) oldconfig
117 $(KMAKE
) include/linux
/version.h
include/asm
118 if
[ -d
$(PKG_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
]; then \
120 $(PKG_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
/. \
121 $(PKG_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
)/; \
123 $(call Build
/Prepare
/pre
/$(ARCH
))
124 $(call Build
/Prepare
/all)
125 $(call Build
/Prepare
/post
/$(ARCH
))
128 define Build
/Configure
135 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
141 $(BUILD_DIR_TOOLCHAIN
)/linux \
142 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
145 $(eval
$(call HostBuild
))