2006-06-27 08:44:04 +08:00
|
|
|
#
|
2009-01-13 03:03:39 +08:00
|
|
|
# Copyright (C) 2006-2009 OpenWrt.org
|
2006-06-27 08:44:04 +08:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2005-03-06 11:34:52 +08:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
2007-08-07 08:04:25 +08:00
|
|
|
KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
|
|
|
|
BUILD_DIR := $(KERNEL_BUILD_DIR)
|
2006-06-21 14:19:43 +08:00
|
|
|
|
2007-06-28 14:53:08 +08:00
|
|
|
override QUILT:=
|
2009-02-24 01:49:36 +08:00
|
|
|
override HOST_QUILT:=
|
2007-06-28 14:53:08 +08:00
|
|
|
|
2007-08-07 08:04:25 +08:00
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
2007-08-07 17:41:54 +08:00
|
|
|
|
|
|
|
PKG_NAME:=linux
|
|
|
|
PKG_VERSION:=$(LINUX_VERSION)
|
|
|
|
PKG_SOURCE:=$(LINUX_SOURCE)
|
|
|
|
PKG_SOURCE_URL:=$(LINUX_SITE)
|
2009-02-22 12:37:20 +08:00
|
|
|
HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
|
2007-08-07 17:41:54 +08:00
|
|
|
PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
|
2009-02-22 12:37:20 +08:00
|
|
|
LINUX_DIR := $(HOST_BUILD_DIR)
|
2010-03-29 23:16:17 +08:00
|
|
|
FILES_DIR :=
|
2012-05-13 13:02:27 +08:00
|
|
|
PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
|
2007-08-07 17:41:54 +08:00
|
|
|
|
2009-02-24 07:52:27 +08:00
|
|
|
include $(INCLUDE_DIR)/toolchain-build.mk
|
2007-06-02 08:46:02 +08:00
|
|
|
include $(INCLUDE_DIR)/kernel-defaults.mk
|
|
|
|
|
2009-01-08 09:49:11 +08:00
|
|
|
ifeq ($(strip $(BOARD)),uml)
|
2010-03-15 00:21:18 +08:00
|
|
|
LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
|
2009-01-08 09:49:11 +08:00
|
|
|
endif
|
|
|
|
|
2011-08-06 00:39:04 +08:00
|
|
|
HOST_EXTRACFLAGS=
|
|
|
|
|
2010-06-27 04:44:48 +08:00
|
|
|
LINUX_HAS_HEADERS_INSTALL:=y
|
2009-02-04 05:25:48 +08:00
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
|
2012-07-20 20:28:50 +08:00
|
|
|
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
|
2009-01-08 09:49:11 +08:00
|
|
|
ARCH=$(LINUX_KARCH) \
|
2010-05-25 04:38:36 +08:00
|
|
|
CC="$(KERNEL_CC)" \
|
|
|
|
CFLAGS="$(TARGET_CFLAGS)" \
|
|
|
|
CROSS_COMPILE=$(TARGET_CROSS) \
|
2009-01-08 09:49:11 +08:00
|
|
|
KBUILD_HAVE_NLS=no \
|
|
|
|
CONFIG_SHELL=$(BASH)
|
|
|
|
|
2011-08-06 00:39:04 +08:00
|
|
|
define Host/Configure/all
|
2010-08-19 20:49:51 +08:00
|
|
|
mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
|
2009-01-08 09:49:11 +08:00
|
|
|
$(KMAKE) \
|
2010-08-19 20:49:51 +08:00
|
|
|
INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
|
2009-01-08 09:49:11 +08:00
|
|
|
headers_install
|
2010-06-27 04:44:48 +08:00
|
|
|
endef
|
2006-12-14 12:57:55 +08:00
|
|
|
|
2009-01-21 01:05:14 +08:00
|
|
|
# XXX: the following is needed to build lzma-loader
|
2011-02-10 11:52:39 +08:00
|
|
|
ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
|
2011-08-06 00:39:04 +08:00
|
|
|
define Host/Configure/lzma
|
2009-01-21 01:05:14 +08:00
|
|
|
$(CP) \
|
2011-02-10 11:52:39 +08:00
|
|
|
$(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
|
|
|
|
$(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
|
2015-11-08 00:22:18 +08:00
|
|
|
$(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
|
2010-08-19 20:49:51 +08:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
|
2011-02-10 11:52:39 +08:00
|
|
|
endef
|
|
|
|
endif
|
2009-01-21 01:05:14 +08:00
|
|
|
|
2011-08-06 00:39:04 +08:00
|
|
|
define Host/Configure/post/mips
|
|
|
|
$(call Host/Configure/lzma)
|
2009-01-21 01:05:14 +08:00
|
|
|
endef
|
|
|
|
|
2011-08-06 00:39:04 +08:00
|
|
|
define Host/Configure/post/mipsel
|
|
|
|
$(call Host/Configure/lzma)
|
2009-01-21 01:05:14 +08:00
|
|
|
endef
|
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
define Host/Prepare
|
2008-05-03 23:46:23 +08:00
|
|
|
$(call Kernel/Prepare/Default)
|
2009-01-21 01:05:14 +08:00
|
|
|
ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
|
2009-02-22 12:37:20 +08:00
|
|
|
$(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
|
2006-06-21 14:19:43 +08:00
|
|
|
endef
|
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
define Host/Configure
|
2011-08-06 00:39:04 +08:00
|
|
|
env
|
|
|
|
yes '' | $(KMAKE) oldconfig
|
|
|
|
$(call Host/Configure/all)
|
|
|
|
$(call Host/Configure/post/$(ARCH))
|
2007-07-31 05:57:14 +08:00
|
|
|
endef
|
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
define Host/Compile
|
2006-06-21 14:19:43 +08:00
|
|
|
endef
|
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
define Host/Install
|
2009-01-21 01:05:14 +08:00
|
|
|
$(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
|
2009-01-08 09:49:11 +08:00
|
|
|
endef
|
|
|
|
|
2009-02-22 12:37:20 +08:00
|
|
|
define Host/Clean
|
2009-01-08 09:49:11 +08:00
|
|
|
rm -rf \
|
2009-02-22 12:37:20 +08:00
|
|
|
$(HOST_BUILD_DIR) \
|
2009-01-08 09:49:11 +08:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux \
|
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev
|
2006-06-21 14:19:43 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call HostBuild))
|