Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_HASH:=$(LINUX_KERNEL_HASH)
  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. $(KERNEL_MAKE_FLAGS) \
  31. CC="$(KERNEL_CC)" \
  32. CFLAGS="$(TARGET_CFLAGS)"
  33. define Host/Configure/all
  34. mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
  35. $(KMAKE) \
  36. INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
  37. headers_install
  38. endef
  39. # XXX: the following is needed to build lzma-loader
  40. ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
  41. define Host/Configure/lzma
  42. $(CP) \
  43. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
  44. $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
  45. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
  46. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  47. endef
  48. endif
  49. define Host/Configure/post/mips
  50. $(call Host/Configure/lzma)
  51. endef
  52. define Host/Configure/post/mipsel
  53. $(call Host/Configure/lzma)
  54. endef
  55. define Host/Prepare
  56. rm -rf $(BUILD_DIR_TOOLCHAIN)/linux-*
  57. $(call Kernel/Prepare/Default)
  58. rm -f $(BUILD_DIR_TOOLCHAIN)/linux
  59. ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  60. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  61. endef
  62. define Host/Configure
  63. env
  64. yes '' | $(KMAKE) oldconfig
  65. $(call Host/Configure/all)
  66. $(call Host/Configure/post/$(ARCH))
  67. endef
  68. define Host/Compile
  69. endef
  70. define Host/Install
  71. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  72. endef
  73. define Host/Clean
  74. rm -rf \
  75. $(HOST_BUILD_DIR) \
  76. $(BUILD_DIR_TOOLCHAIN)/linux \
  77. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  78. endef
  79. $(eval $(call HostBuild))