Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_CPE_ID:=cpe:/o:linux:linux_kernel
  17. ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
  18. PKG_SOURCE_PROTO:=git
  19. PKG_SOURCE_URL:=$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI))
  20. PKG_SOURCE_VERSION:=$(call qstrip,$(CONFIG_KERNEL_GIT_REF))
  21. PKG_MIRROR_HASH:=$(call qstrip,$(CONFIG_KERNEL_GIT_MIRROR_HASH))
  22. ifdef CHECK
  23. PLATFORM_DIR:=$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD) $(TOPDIR)/target/linux/$(BOARD)))
  24. include $(PLATFORM_DIR)/Makefile
  25. include $(INCLUDE_DIR)/kernel-version.mk
  26. include $(INCLUDE_DIR)/kernel-build.mk
  27. PKG_VERSION:=$(LINUX_VERSION)
  28. else
  29. PKG_SOURCE:=$(LINUX_SOURCE)
  30. endif
  31. else
  32. PKG_SOURCE:=$(LINUX_SOURCE)
  33. PKG_SOURCE_URL:=$(LINUX_SITE)
  34. endif
  35. HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
  36. PKG_HASH:=$(LINUX_KERNEL_HASH)
  37. LINUX_DIR := $(HOST_BUILD_DIR)
  38. FILES_DIR :=
  39. PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
  40. include $(INCLUDE_DIR)/toolchain-build.mk
  41. include $(INCLUDE_DIR)/kernel-defaults.mk
  42. ifeq ($(strip $(BOARD)),uml)
  43. LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
  44. endif
  45. HOST_EXTRACFLAGS=
  46. LINUX_HAS_HEADERS_INSTALL:=y
  47. HOST_KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
  48. $(KERNEL_MAKE_FLAGS) \
  49. CC="$(KERNEL_CC)" \
  50. HOSTCFLAGS="$(HOST_CFLAGS)"
  51. define Host/Configure/all
  52. mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
  53. $(HOST_KMAKE) \
  54. INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
  55. headers_install
  56. endef
  57. # XXX: the following is needed to build lzma-loader
  58. ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
  59. define Host/Configure/lzma
  60. $(CP) \
  61. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
  62. $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
  63. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
  64. $(HOST_BUILD_DIR)/arch/mips/include/asm/isa-rev.h \
  65. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  66. endef
  67. endif
  68. define Host/Configure/post/mips
  69. $(call Host/Configure/lzma)
  70. endef
  71. define Host/Configure/post/mipsel
  72. $(call Host/Configure/lzma)
  73. endef
  74. define Host/Prepare
  75. rm -rf $(BUILD_DIR_TOOLCHAIN)/linux-*
  76. $(call Kernel/Prepare/Default)
  77. rm -f $(BUILD_DIR_TOOLCHAIN)/linux
  78. ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  79. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  80. endef
  81. define Host/Configure
  82. yes '' | $(HOST_KMAKE) oldconfig
  83. $(call Host/Configure/all)
  84. $(call Host/Configure/post/$(ARCH))
  85. endef
  86. define Host/Compile
  87. endef
  88. define Host/Install
  89. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  90. endef
  91. define Host/Clean
  92. rm -rf \
  93. $(HOST_BUILD_DIR) \
  94. $(BUILD_DIR_TOOLCHAIN)/linux \
  95. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  96. endef
  97. $(eval $(call HostBuild))