X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/d34f76265383f37a4f8eb0ce928283433a9149e6..1c6bd93a6482c32b8784bef61b07cbd4da2977d2:/toolchain/kernel-headers/Makefile?ds=sidebyside diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile index 474ff6c71..cf5a38429 100644 --- a/toolchain/kernel-headers/Makefile +++ b/toolchain/kernel-headers/Makefile @@ -32,6 +32,10 @@ ifeq ($(strip $(BOARD)),uml) LINUX_KARCH:=$(ARCH) endif +ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1) + LINUX_HAS_HEADERS_INSTALL:=y +endif + KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \ ARCH=$(LINUX_KARCH) \ KBUILD_HAVE_NLS=no \ @@ -50,7 +54,7 @@ define Build/Prepare/pre/powerpc fi endef -ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1) +ifneq ($(LINUX_HAS_HEADERS_INSTALL),) define Build/Prepare/all mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr $(KMAKE) \ @@ -62,18 +66,57 @@ else define Build/Prepare/all mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include cp -pLR \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/asm \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(LINUX_KARCH) \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/linux \ + $(PKG_BUILD_DIR)/include/asm \ + $(PKG_BUILD_DIR)/include/asm-generic \ + $(PKG_BUILD_DIR)/include/asm-$(LINUX_KARCH) \ + $(PKG_BUILD_DIR)/include/linux \ $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/ endef endif +# XXX: the following is needed to build lzma-loader +define Build/Prepare/lzma + $(CP) \ + $(PKG_BUILD_DIR)/include/asm-mips/asm.h \ + $(PKG_BUILD_DIR)/include/asm-mips/regdef.h \ + $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/ +endef + +# XXX: the following are needed to build a cris toolchain +define Build/Prepare/post/cris + $(CP) \ + $(PKG_BUILD_DIR)/include/linux/user.h \ + $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/ + $(CP) \ + $(PKG_BUILD_DIR)/include/asm-cris/elf.h \ + $(PKG_BUILD_DIR)/include/asm-cris/page.h \ + $(PKG_BUILD_DIR)/include/asm-cris/user.h \ + $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/ + mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch + $(CP) \ + $(PKG_BUILD_DIR)/include/asm-cris/arch/elf.h \ + $(PKG_BUILD_DIR)/include/asm-cris/arch/page.h \ + $(PKG_BUILD_DIR)/include/asm-cris/arch/ptrace.h \ + $(PKG_BUILD_DIR)/include/asm-cris/arch/user.h \ + $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/ + $(CP) \ + $(PKG_BUILD_DIR)/include/asm-generic/memory_model.h \ + $(PKG_BUILD_DIR)/include/asm-generic/page.h \ + $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/ +endef + +define Build/Prepare/post/mips + $(call Build/Prepare/lzma) +endef + +define Build/Prepare/post/mipsel + $(call Build/Prepare/lzma) +endef + define Build/Prepare $(call Kernel/Prepare/Default) + ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile - ln -sf linux-$(LINUX_VERSION) $(LINUX_HEADERS_DIR) yes '' | $(KMAKE) oldconfig $(KMAKE) include/linux/version.h include/asm if [ -d $(PKG_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \ @@ -83,6 +126,7 @@ define Build/Prepare fi $(call Build/Prepare/pre/$(ARCH)) $(call Build/Prepare/all) + $(call Build/Prepare/post/$(ARCH)) endef define Build/Configure @@ -91,40 +135,8 @@ endef define Build/Compile endef -define Build/Install/all - mkdir -p $(TOOLCHAIN_DIR)/usr/include - $(CP) \ - $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/* \ - $(TOOLCHAIN_DIR)/usr/include/ -endef - -# XXX: the following is needed to build lzma-loader -define Build/Install/post/lzma - $(CP) \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-mips/asm.h \ - $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-mips/regdef.h \ - $(TOOLCHAIN_DIR)/usr/include/asm/ -endef - -# XXX: the following is needed to build final gcc on cris -define Build/Install/post/cris - mkdir -p $(TOOLCHAIN_DIR)/usr/include/asm/arch - $(CP) \ - $(PKG_BUILD_DIR)/include/asm-cris/arch/ptrace.h \ - $(TOOLCHAIN_DIR)/usr/include/asm/arch/ -endef - -define Build/Install/post/mips - $(call Build/Install/post/lzma) -endef - -define Build/Install/post/mipsel - $(call Build/Install/post/lzma) -endef - define Build/Install - $(call Build/Install/all) - $(call Build/Install/post/$(ARCH)) + $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/ endef define Build/Clean