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
)
15 include $(INCLUDE_DIR
)/kernel.mk
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
)
25 include $(INCLUDE_DIR
)/toolchain-build.mk
26 include $(INCLUDE_DIR
)/kernel-defaults.mk
28 ifeq ($(strip $(BOARD
)),uml
)
32 ifeq ($(strip $(call CompareKernelPatchVer
,$(KERNEL_PATCHVER
),ge
,2.6.18)),1)
33 LINUX_HAS_HEADERS_INSTALL
:=y
36 KMAKE
:= $(MAKE
) -C
$(HOST_BUILD_DIR
) \
41 define Host
/Prepare
/pre
/powerpc
42 if
[ -d
$(HOST_BUILD_DIR
)/include/asm-ppc
]; then \
43 mkdir
-p
$(PKG_BUILD_DIR
)/include/asm-powerpc
/; \
44 $(CP
) $(HOST_BUILD_DIR
)/include/asm-ppc
/* $(HOST_BUILD_DIR
)/include/asm-powerpc
/; \
45 rm -rf
$(HOST_BUILD_DIR
)/include/asm-ppc
; \
46 ln
-s
$(HOST_BUILD_DIR
)/include/asm-powerpc
$(HOST_BUILD_DIR
)/include/asm-ppc
; \
50 ifneq ($(LINUX_HAS_HEADERS_INSTALL
),)
51 define Host
/Prepare
/all
52 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
54 CROSS_COMPILE
=$(TARGET_CROSS
) \
55 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
59 define Host
/Prepare
/all
60 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include
61 cp
-pLR
$(HOST_BUILD_DIR
)/include/asm
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
62 cp
-pLR
$(HOST_BUILD_DIR
)/include/asm-generic
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
63 cp
-pLR
$(HOST_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
64 cp
-pLR
$(HOST_BUILD_DIR
)/include/linux
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
68 # XXX: the following is needed to build lzma-loader
69 define Host
/Prepare
/lzma
71 $(HOST_BUILD_DIR
)/include/asm-mips
/asm.h \
72 $(HOST_BUILD_DIR
)/include/asm-mips
/regdef.h \
73 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
76 # XXX: the following are needed to build a cris toolchain
77 ifeq ($(strip $(call CompareKernelPatchVer
,$(KERNEL_PATCHVER
),lt
,2.6.28)),1)
78 define Host
/Prepare
/pre
/cris
79 ln
-sf
$(HOST_BUILD_DIR
)/include/asm-cris
/arch-v10
$(HOST_BUILD_DIR
)/include/asm-cris
/arch
80 ln
-sf
$(HOST_BUILD_DIR
)/include/asm-cris
/arch-v10
$(HOST_BUILD_DIR
)/arch
/cris
/arch
83 define Host
/Prepare
/post
/cris
85 $(HOST_BUILD_DIR
)/include/linux
/user.h \
86 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
88 $(HOST_BUILD_DIR
)/include/linux
/user.h \
89 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
91 $(HOST_BUILD_DIR
)/include/asm-cris
/elf.h \
92 $(HOST_BUILD_DIR
)/include/asm-cris
/page.h \
93 $(HOST_BUILD_DIR
)/include/asm-cris
/user.h \
94 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
96 $(HOST_BUILD_DIR
)/include/asm-generic
/memory_model.h \
97 $(HOST_BUILD_DIR
)/include/asm-generic
/page.h \
98 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm-generic
/
100 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
102 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/elf.h \
103 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/page.h \
104 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/ptrace.h \
105 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/user.h \
106 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
/
109 define Host
/Prepare
/post
/cris
111 $(HOST_BUILD_DIR
)/include/linux
/user.h \
112 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
113 ln
-snf
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/arch-v10
/arch \
114 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/arch
115 $(SED
) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/user.h
119 define Host
/Prepare
/post
/mips
120 $(call Host
/Prepare
/lzma
)
123 define Host
/Prepare
/post
/mipsel
124 $(call Host
/Prepare
/lzma
)
128 $(call Kernel
/Prepare
/Default
)
129 ln
-sf linux-
$(LINUX_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/linux
130 $(SED
) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR
)/Makefile
131 yes
'' |
$(KMAKE
) oldconfig
132 $(KMAKE
) include/linux
/version.h
include/asm
133 if
[ -d
$(HOST_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
]; then \
135 $(HOST_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
/. \
136 $(HOST_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
)/; \
138 $(call Host
/Prepare
/pre
/$(ARCH
))
139 $(call Host
/Prepare
/all)
140 $(call Host
/Prepare
/post
/$(ARCH
))
143 define Host
/Configure
150 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
156 $(BUILD_DIR_TOOLCHAIN
)/linux \
157 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
160 $(eval
$(call HostBuild
))