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 ifneq ($(call qstrip
,$(CONFIG_KERNEL_GIT_CLONE_URI
)),)
22 PKG_SOURCE_URL
:=$(call qstrip
,$(CONFIG_KERNEL_GIT_CLONE_URI
))
23 PKG_SOURCE_VERSION
:=$(call qstrip
,$(CONFIG_KERNEL_GIT_REF
))
25 include $(INCLUDE_DIR
)/kernel-version.mk
26 PKG_VERSION
:=$(LINUX_VERSION
)
28 PKG_SOURCE
:=$(LINUX_SOURCE
)
31 PKG_SOURCE
:=$(LINUX_SOURCE
)
32 PKG_SOURCE_URL
:=$(LINUX_SITE
)
34 HOST_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
35 PKG_HASH
:=$(LINUX_KERNEL_HASH
)
36 LINUX_DIR
:= $(HOST_BUILD_DIR
)
38 PATCH_DIR
:= .
/patches
$(if
$(wildcard .
/patches-
$(LINUX_VERSION
)),-$(LINUX_VERSION
))
40 include $(INCLUDE_DIR
)/toolchain-build.mk
41 include $(INCLUDE_DIR
)/kernel-defaults.mk
43 ifeq ($(strip $(BOARD
)),uml
)
44 LINUX_KARCH
:=$(subst x86_64
,x86
,$(subst i386
,x86
,$(ARCH
)))
49 LINUX_HAS_HEADERS_INSTALL
:=y
51 HOST_KMAKE
:= $(MAKE
) -C
$(HOST_BUILD_DIR
) \
52 $(KERNEL_MAKE_FLAGS
) \
54 HOSTCFLAGS
="$(HOST_CFLAGS)"
56 define Host
/Configure
/all
57 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
59 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
63 # XXX: the following is needed to build lzma-loader
64 ifneq ($(CONFIG_mips
)$(CONFIG_mipsel
),)
65 define Host
/Configure
/lzma
67 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/asm.h \
68 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/regdef.h \
69 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/asm-eva.h \
70 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/include/asm
/
74 define Host
/Configure
/post
/mips
75 $(call Host
/Configure
/lzma
)
78 define Host
/Configure
/post
/mipsel
79 $(call Host
/Configure
/lzma
)
83 rm -rf
$(BUILD_DIR_TOOLCHAIN
)/linux-
*
84 $(call Kernel
/Prepare
/Default
)
85 rm -f
$(BUILD_DIR_TOOLCHAIN
)/linux
86 ln
-s linux-
$(LINUX_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/linux
87 $(SED
) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR
)/Makefile
92 yes
'' |
$(HOST_KMAKE
) oldconfig
93 $(call Host
/Configure
/all)
94 $(call Host
/Configure
/post
/$(ARCH
))
101 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
107 $(BUILD_DIR_TOOLCHAIN
)/linux \
108 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
111 $(eval
$(call HostBuild
))