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 ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI
)),"")
22 PKG_SOURCE_URL
:=$(call qstrip
,$(CONFIG_KERNEL_GIT_CLONE_URI
))
23 PKG_SOURCE_VERSION
:=$(CONFIG_KERNEL_GIT_REF
)
25 PKG_SOURCE_URL
:=$(LINUX_SITE
)
27 HOST_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
28 PKG_HASH
:=$(LINUX_KERNEL_HASH
)
29 LINUX_DIR
:= $(HOST_BUILD_DIR
)
31 PATCH_DIR
:= .
/patches
$(if
$(wildcard .
/patches-
$(LINUX_VERSION
)),-$(LINUX_VERSION
))
33 include $(INCLUDE_DIR
)/toolchain-build.mk
34 include $(INCLUDE_DIR
)/kernel-defaults.mk
36 ifeq ($(strip $(BOARD
)),uml
)
37 LINUX_KARCH
:=$(subst x86_64
,x86
,$(subst i386
,x86
,$(ARCH
)))
42 LINUX_HAS_HEADERS_INSTALL
:=y
44 HOST_KMAKE
:= $(MAKE
) -C
$(HOST_BUILD_DIR
) \
45 $(KERNEL_MAKE_FLAGS
) \
47 HOSTCFLAGS
="$(HOST_CFLAGS)"
49 define Host
/Configure
/all
50 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/linux-dev
52 INSTALL_HDR_PATH
="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
56 # XXX: the following is needed to build lzma-loader
57 ifneq ($(CONFIG_mips
)$(CONFIG_mipsel
),)
58 define Host
/Configure
/lzma
60 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/asm.h \
61 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/regdef.h \
62 $(HOST_BUILD_DIR
)/arch
/mips
/include/asm
/asm-eva.h \
63 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/include/asm
/
67 define Host
/Configure
/post
/mips
68 $(call Host
/Configure
/lzma
)
71 define Host
/Configure
/post
/mipsel
72 $(call Host
/Configure
/lzma
)
76 rm -rf
$(BUILD_DIR_TOOLCHAIN
)/linux-
*
77 $(call Kernel
/Prepare
/Default
)
78 rm -f
$(BUILD_DIR_TOOLCHAIN
)/linux
79 ln
-s linux-
$(LINUX_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/linux
80 $(SED
) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR
)/Makefile
85 yes
'' |
$(HOST_KMAKE
) oldconfig
86 $(call Host
/Configure
/all)
87 $(call Host
/Configure
/post
/$(ARCH
))
94 $(CP
) $(BUILD_DIR_TOOLCHAIN
)/linux-dev
/* $(TOOLCHAIN_DIR
)/
100 $(BUILD_DIR_TOOLCHAIN
)/linux \
101 $(BUILD_DIR_TOOLCHAIN
)/linux-dev
104 $(eval
$(call HostBuild
))