2006-06-27 03:44:04 +03:00
|
|
|
#
|
2009-01-12 21:03:39 +02:00
|
|
|
# Copyright (C) 2006-2009 OpenWrt.org
|
2006-06-27 03:44:04 +03:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2005-03-06 05:34:52 +02:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
2007-08-07 03:04:25 +03:00
|
|
|
KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
|
|
|
|
BUILD_DIR := $(KERNEL_BUILD_DIR)
|
2006-06-21 09:19:43 +03:00
|
|
|
|
2007-06-28 09:53:08 +03:00
|
|
|
override QUILT:=
|
2009-02-23 19:49:36 +02:00
|
|
|
override HOST_QUILT:=
|
2007-06-28 09:53:08 +03:00
|
|
|
|
2007-08-07 03:04:25 +03:00
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
2007-08-07 12:41:54 +03:00
|
|
|
|
|
|
|
PKG_NAME:=linux
|
|
|
|
PKG_VERSION:=$(LINUX_VERSION)
|
|
|
|
PKG_SOURCE:=$(LINUX_SOURCE)
|
|
|
|
PKG_SOURCE_URL:=$(LINUX_SITE)
|
2009-02-22 06:37:20 +02:00
|
|
|
HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
|
2007-08-07 12:41:54 +03:00
|
|
|
PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
|
2009-02-22 06:37:20 +02:00
|
|
|
LINUX_DIR := $(HOST_BUILD_DIR)
|
2007-08-07 12:41:54 +03:00
|
|
|
|
2009-02-24 01:52:27 +02:00
|
|
|
include $(INCLUDE_DIR)/toolchain-build.mk
|
2007-06-02 03:46:02 +03:00
|
|
|
include $(INCLUDE_DIR)/kernel-defaults.mk
|
|
|
|
|
2009-01-08 03:49:11 +02:00
|
|
|
ifeq ($(strip $(BOARD)),uml)
|
|
|
|
LINUX_KARCH:=$(ARCH)
|
|
|
|
endif
|
|
|
|
|
2009-02-03 23:25:48 +02:00
|
|
|
ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
|
|
|
|
LINUX_HAS_HEADERS_INSTALL:=y
|
|
|
|
endif
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
|
2009-01-08 03:49:11 +02:00
|
|
|
ARCH=$(LINUX_KARCH) \
|
|
|
|
KBUILD_HAVE_NLS=no \
|
|
|
|
CONFIG_SHELL=$(BASH)
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/pre/powerpc
|
|
|
|
if [ -d $(HOST_BUILD_DIR)/include/asm-ppc ]; then \
|
2009-03-01 13:04:08 +02:00
|
|
|
mkdir -p $(PKG_BUILD_DIR)/include/asm-powerpc/; \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(CP) $(HOST_BUILD_DIR)/include/asm-ppc/* $(HOST_BUILD_DIR)/include/asm-powerpc/; \
|
|
|
|
rm -rf $(HOST_BUILD_DIR)/include/asm-ppc; \
|
|
|
|
ln -s $(HOST_BUILD_DIR)/include/asm-powerpc $(HOST_BUILD_DIR)/include/asm-ppc; \
|
2008-10-09 14:33:47 +03:00
|
|
|
fi
|
2006-11-30 20:18:45 +02:00
|
|
|
endef
|
|
|
|
|
2009-02-03 23:25:48 +02:00
|
|
|
ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/all
|
2009-01-08 03:49:11 +02:00
|
|
|
mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
|
|
|
|
$(KMAKE) \
|
|
|
|
CROSS_COMPILE=$(TARGET_CROSS) \
|
|
|
|
INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
|
|
|
|
headers_install
|
|
|
|
endef
|
|
|
|
else
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/all
|
2009-01-08 03:49:11 +02:00
|
|
|
mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
|
2009-03-01 13:04:08 +02:00
|
|
|
cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
|
|
|
|
cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
|
|
|
|
cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
|
|
|
|
cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
|
2009-01-08 03:49:11 +02:00
|
|
|
endef
|
2006-12-29 13:09:10 +02:00
|
|
|
endif
|
2006-12-14 06:57:55 +02:00
|
|
|
|
2009-01-20 19:05:14 +02:00
|
|
|
# XXX: the following is needed to build lzma-loader
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/lzma
|
2009-01-20 19:05:14 +02:00
|
|
|
$(CP) \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_BUILD_DIR)/include/asm-mips/asm.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
|
2009-01-20 19:05:14 +02:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
|
|
|
|
endef
|
|
|
|
|
2009-01-21 03:53:05 +02:00
|
|
|
# XXX: the following are needed to build a cris toolchain
|
2009-04-08 17:13:50 +03:00
|
|
|
ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),lt,2.6.28)),1)
|
|
|
|
define Host/Prepare/pre/cris
|
|
|
|
ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/include/asm-cris/arch
|
|
|
|
ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/arch/cris/arch
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Host/Prepare/post/cris
|
|
|
|
$(CP) \
|
|
|
|
$(HOST_BUILD_DIR)/include/linux/user.h \
|
2009-07-03 15:49:50 +03:00
|
|
|
$(HOST_BUILD_DIR)/include/linux/autoconf.h \
|
2009-01-21 03:53:05 +02:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
|
|
|
|
$(CP) \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/elf.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/page.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/user.h \
|
2009-01-21 03:53:05 +02:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
|
2009-04-08 17:13:50 +03:00
|
|
|
$(CP) \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-generic/memory_model.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-generic/page.h \
|
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/
|
|
|
|
|
2009-01-20 19:05:14 +02:00
|
|
|
mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch
|
|
|
|
$(CP) \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/arch/elf.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/arch/page.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/arch/ptrace.h \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-cris/arch/user.h \
|
2009-01-20 19:05:14 +02:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/
|
2009-04-08 17:13:50 +03:00
|
|
|
endef
|
|
|
|
else
|
|
|
|
define Host/Prepare/post/cris
|
2009-01-21 03:53:05 +02:00
|
|
|
$(CP) \
|
2009-04-08 17:13:50 +03:00
|
|
|
$(HOST_BUILD_DIR)/include/linux/user.h \
|
2009-07-03 15:49:50 +03:00
|
|
|
$(HOST_BUILD_DIR)/include/linux/autoconf.h \
|
2009-04-08 17:13:50 +03:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
|
|
|
|
ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch-v10/arch \
|
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch
|
|
|
|
$(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/user.h
|
|
|
|
endef
|
|
|
|
endif
|
2009-01-20 19:05:14 +02:00
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/post/mips
|
|
|
|
$(call Host/Prepare/lzma)
|
2009-01-20 19:05:14 +02:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare/post/mipsel
|
|
|
|
$(call Host/Prepare/lzma)
|
2009-01-20 19:05:14 +02:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare
|
2008-05-03 18:46:23 +03:00
|
|
|
$(call Kernel/Prepare/Default)
|
2009-01-20 19:05:14 +02:00
|
|
|
ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
|
2009-02-22 06:37:20 +02:00
|
|
|
$(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
|
2006-12-14 06:57:55 +02:00
|
|
|
yes '' | $(KMAKE) oldconfig
|
|
|
|
$(KMAKE) include/linux/version.h include/asm
|
2009-02-22 06:37:20 +02:00
|
|
|
if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
|
2008-09-29 21:09:24 +03:00
|
|
|
$(CP) \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
|
|
|
|
$(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
|
2008-09-29 21:09:24 +03:00
|
|
|
fi
|
2009-02-22 06:37:20 +02:00
|
|
|
$(call Host/Prepare/pre/$(ARCH))
|
|
|
|
$(call Host/Prepare/all)
|
|
|
|
$(call Host/Prepare/post/$(ARCH))
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Configure
|
2007-07-31 00:57:14 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Compile
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Install
|
2009-01-20 19:05:14 +02:00
|
|
|
$(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
|
2009-01-08 03:49:11 +02:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Clean
|
2009-01-08 03:49:11 +02:00
|
|
|
rm -rf \
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_BUILD_DIR) \
|
2009-01-08 03:49:11 +02:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux \
|
|
|
|
$(BUILD_DIR_TOOLCHAIN)/linux-dev
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call HostBuild))
|