Makefile 2.9 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_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-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
  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. ARCH=$(LINUX_KARCH) \
  31. CC="$(KERNEL_CC)" \
  32. CFLAGS="$(TARGET_CFLAGS)" \
  33. CROSS_COMPILE=$(TARGET_CROSS) \
  34. KBUILD_HAVE_NLS=no \
  35. CONFIG_SHELL=$(BASH)
  36. define Host/Configure/all
  37. mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
  38. $(KMAKE) \
  39. INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
  40. headers_install
  41. endef
  42. # XXX: the following is needed to build lzma-loader
  43. ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
  44. define Host/Configure/lzma
  45. $(CP) \
  46. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
  47. $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
  48. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  49. endef
  50. endif
  51. define Host/Configure/post/cris
  52. $(CP) \
  53. $(HOST_BUILD_DIR)/include/linux/user.h \
  54. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
  55. ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
  56. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
  57. $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
  58. endef
  59. define Host/Configure/post/ubicom32
  60. $(CP) \
  61. $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
  62. $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
  63. $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
  64. $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
  65. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  66. endef
  67. define Host/Configure/post/mips
  68. $(call Host/Configure/lzma)
  69. endef
  70. define Host/Configure/post/mipsel
  71. $(call Host/Configure/lzma)
  72. endef
  73. define Host/Prepare
  74. $(call Kernel/Prepare/Default)
  75. ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  76. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  77. endef
  78. define Host/Configure
  79. env
  80. yes '' | $(KMAKE) oldconfig
  81. $(call Host/Configure/all)
  82. $(call Host/Configure/post/$(ARCH))
  83. endef
  84. define Host/Compile
  85. endef
  86. define Host/Install
  87. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  88. endef
  89. define Host/Clean
  90. rm -rf \
  91. $(HOST_BUILD_DIR) \
  92. $(BUILD_DIR_TOOLCHAIN)/linux \
  93. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  94. endef
  95. $(eval $(call HostBuild))