1# 2# Copyright (C) 2006 OpenWrt.org 3# 4# This is free software, licensed under the GNU General Public License v2. 5# See /LICENSE for more information. 6# 7include $(TOPDIR)/rules.mk 8 9KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN) 10BUILD_DIR := $(KERNEL_BUILD_DIR) 11 12STAGING_DIR_HOST:=$(TOOLCHAIN_DIR) 13BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN) 14override QUILT:= 15 16include $(INCLUDE_DIR)/kernel-version.mk 17include $(INCLUDE_DIR)/kernel.mk 18 19PKG_NAME:=linux 20PKG_VERSION:=$(LINUX_VERSION) 21PKG_SOURCE:=$(LINUX_SOURCE) 22ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") 23PKG_SOURCE_URL:=$(LINUX_SITE) 24else 25PKG_SOURCE_URL:= 26endif 27PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) 28PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM) 29LINUX_DIR := $(PKG_BUILD_DIR) 30 31include $(INCLUDE_DIR)/host-build.mk 32include $(INCLUDE_DIR)/kernel-defaults.mk 33 34define Build/Configure/cris 35 ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch 36 ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch 37endef 38 39define Build/Configure/powerpc 40 $(CP) $(PKG_BUILD_DIR)/include/asm-ppc/* $(PKG_BUILD_DIR)/include/asm-powerpc/ 41 rm -rf $(PKG_BUILD_DIR)/include/asm-ppc 42 ln -s $(PKG_BUILD_DIR)/include/asm-powerpc $(PKG_BUILD_DIR)/include/asm-ppc 43endef 44 45ifneq (,$(findstring uml,$(BOARD))) 46 LINUX_KARCH:=$(ARCH) 47endif 48 49KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \ 50 ARCH=$(LINUX_KARCH) \ 51 KBUILD_HAVE_NLS=no \ 52 CONFIG_SHELL=$(BASH) 53 54define Build/Prepare 55 $(call Kernel/Prepare/Default) 56 $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile 57 ln -sf linux-$(LINUX_VERSION) $(LINUX_HEADERS_DIR) 58 yes '' | $(KMAKE) oldconfig 59 $(KMAKE) include/linux/version.h include/asm 60 $(call Build/Configure/$(ARCH)) 61endef 62 63define Build/Configure 64endef 65 66define Build/Compile 67endef 68 69define Build/Install 70endef 71 72$(eval $(call HostBuild)) 73