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
)
17 override CONFIG_AUTOREBUILD
=
19 include $(INCLUDE_DIR
)/kernel.mk
22 PKG_VERSION
:=$(LINUX_VERSION
)
23 PKG_SOURCE
:=$(LINUX_SOURCE
)
24 PKG_SOURCE_URL
:=$(LINUX_SITE
)
25 HOST_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
26 PKG_MD5SUM
:=$(LINUX_KERNEL_MD5SUM
)
27 LINUX_DIR
:= $(HOST_BUILD_DIR
)
29 include $(INCLUDE_DIR
)/host-build.mk
30 include $(INCLUDE_DIR
)/kernel-defaults.mk
32 ifeq ($(strip $(BOARD
)),uml
)
36 ifeq ($(strip $(call CompareKernelPatchVer
,$(KERNEL_PATCHVER
),ge
,2.6.18)),1)
37 LINUX_HAS_HEADERS_INSTALL
:=y
40 KMAKE
:= $(MAKE
) -C
$(HOST_BUILD_DIR
) \
45 define Host
/Prepare
/pre
/cris
46 ln
-sf
$(HOST_BUILD_DIR
)/include/asm-cris
/arch-v10
$(HOST_BUILD_DIR
)/include/asm-cris
/arch
47 ln
-sf
$(HOST_BUILD_DIR
)/include/asm-cris
/arch-v10
$(HOST_BUILD_DIR
)/arch
/cris
/arch
50 define Host
/Prepare
/pre
/powerpc
51 if
[ -d
$(HOST_BUILD_DIR
)/include/asm-ppc
]; then \
52 $(CP
) $(HOST_BUILD_DIR
)/include/asm-ppc
/* $(HOST_BUILD_DIR
)/include/asm-powerpc
/; \
53 rm -rf
$(HOST_BUILD_DIR
)/include/asm-ppc
; \
54 ln
-s
$(HOST_BUILD_DIR
)/include/asm-powerpc
$(HOST_BUILD_DIR
)/include/asm-ppc
; \
58 ifneq ($(LINUX_HAS_HEADERS_INSTALL
),)
59 define Host
/Prepare
/all
60 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
62 CROSS_COMPILE
=$(TARGET_CROSS
) \
63 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
67 define Host
/Prepare
/all
68 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include
70 $(HOST_BUILD_DIR
)/include/asm \
71 $(HOST_BUILD_DIR
)/include/asm-generic \
72 $(HOST_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
) \
73 $(HOST_BUILD_DIR
)/include/linux \
74 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/
78 # XXX: the following is needed to build lzma-loader
79 define Host
/Prepare
/lzma
81 $(HOST_BUILD_DIR
)/include/asm-mips
/asm.h \
82 $(HOST_BUILD_DIR
)/include/asm-mips
/regdef.h \
83 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
86 # XXX: the following are needed to build a cris toolchain
87 define Host
/Prepare
/post
/cris
89 $(HOST_BUILD_DIR
)/include/linux
/user.h \
90 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/linux
/
92 $(HOST_BUILD_DIR
)/include/asm-cris
/elf.h \
93 $(HOST_BUILD_DIR
)/include/asm-cris
/page.h \
94 $(HOST_BUILD_DIR
)/include/asm-cris
/user.h \
95 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/
96 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
98 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/elf.h \
99 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/page.h \
100 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/ptrace.h \
101 $(HOST_BUILD_DIR
)/include/asm-cris
/arch
/user.h \
102 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm
/arch
/
104 $(HOST_BUILD_DIR
)/include/asm-generic
/memory_model.h \
105 $(HOST_BUILD_DIR
)/include/asm-generic
/page.h \
106 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/usr
/include/asm-generic
/
109 define Host
/Prepare
/post
/mips
110 $(call Host
/Prepare
/lzma
)
113 define Host
/Prepare
/post
/mipsel
114 $(call Host
/Prepare
/lzma
)
118 $(call Kernel
/Prepare
/Default
)
119 ln
-sf linux-
$(LINUX_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/linux
120 $(SED
) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR
)/Makefile
121 yes
'' |
$(KMAKE
) oldconfig
122 $(KMAKE
) include/linux
/version.h
include/asm
123 if
[ -d
$(HOST_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
]; then \
125 $(HOST_BUILD_DIR
)/arch
/$(LINUX_KARCH
)/include/asm
/. \
126 $(HOST_BUILD_DIR
)/include/asm-
$(LINUX_KARCH
)/; \
128 $(call Host
/Prepare
/pre
/$(ARCH
))
129 $(call Host
/Prepare
/all)
130 $(call Host
/Prepare
/post
/$(ARCH
))
133 define Host
/Configure
140 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
146 $(BUILD_DIR_TOOLCHAIN
)/linux \
147 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
150 $(eval
$(call HostBuild
))