Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. $(if $(call kernel_patchver_ge,3.15.0),$(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/cris
  54. $(CP) \
  55. $(HOST_BUILD_DIR)/include/linux/user.h \
  56. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
  57. ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
  58. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
  59. $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
  60. endef
  61. define Host/Configure/post/mips
  62. $(call Host/Configure/lzma)
  63. endef
  64. define Host/Configure/post/mipsel
  65. $(call Host/Configure/lzma)
  66. endef
  67. define Host/Prepare
  68. $(call Kernel/Prepare/Default)
  69. ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  70. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  71. endef
  72. define Host/Configure
  73. env
  74. yes '' | $(KMAKE) oldconfig
  75. $(call Host/Configure/all)
  76. $(call Host/Configure/post/$(ARCH))
  77. endef
  78. define Host/Compile
  79. endef
  80. define Host/Install
  81. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  82. endef
  83. define Host/Clean
  84. rm -rf \
  85. $(HOST_BUILD_DIR) \
  86. $(BUILD_DIR_TOOLCHAIN)/linux \
  87. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  88. endef
  89. $(eval $(call HostBuild))