Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #
  2. # Copyright (C) 2006-2009 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
  9. BUILD_DIR := $(KERNEL_BUILD_DIR)
  10. override QUILT:=
  11. override HOST_QUILT:=
  12. include $(INCLUDE_DIR)/kernel.mk
  13. PKG_NAME:=linux
  14. PKG_VERSION:=$(LINUX_VERSION)
  15. PKG_SOURCE:=$(LINUX_SOURCE)
  16. PKG_SOURCE_URL:=$(LINUX_SITE)
  17. HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
  18. PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
  19. LINUX_DIR := $(HOST_BUILD_DIR)
  20. FILES_DIR :=
  21. PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
  22. include $(INCLUDE_DIR)/toolchain-build.mk
  23. include $(INCLUDE_DIR)/kernel-defaults.mk
  24. ifeq ($(strip $(BOARD)),uml)
  25. LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
  26. endif
  27. HOST_EXTRACFLAGS=
  28. LINUX_HAS_HEADERS_INSTALL:=y
  29. KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
  30. HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
  31. ARCH=$(LINUX_KARCH) \
  32. CC="$(KERNEL_CC)" \
  33. CFLAGS="$(TARGET_CFLAGS)" \
  34. CROSS_COMPILE=$(TARGET_CROSS) \
  35. KBUILD_HAVE_NLS=no \
  36. CONFIG_SHELL=$(BASH)
  37. define Host/Configure/all
  38. mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
  39. $(KMAKE) \
  40. INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
  41. headers_install
  42. endef
  43. # XXX: the following is needed to build lzma-loader
  44. ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
  45. define Host/Configure/lzma
  46. $(CP) \
  47. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
  48. $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
  49. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
  50. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  51. endef
  52. endif
  53. define Host/Configure/post/mips
  54. $(call Host/Configure/lzma)
  55. endef
  56. define Host/Configure/post/mipsel
  57. $(call Host/Configure/lzma)
  58. endef
  59. define Host/Prepare
  60. $(call Kernel/Prepare/Default)
  61. ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  62. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  63. endef
  64. define Host/Configure
  65. env
  66. yes '' | $(KMAKE) oldconfig
  67. $(call Host/Configure/all)
  68. $(call Host/Configure/post/$(ARCH))
  69. endef
  70. define Host/Compile
  71. endef
  72. define Host/Install
  73. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  74. endef
  75. define Host/Clean
  76. rm -rf \
  77. $(HOST_BUILD_DIR) \
  78. $(BUILD_DIR_TOOLCHAIN)/linux \
  79. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  80. endef
  81. $(eval $(call HostBuild))