X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fkernel.mk;h=439e910ebf0c173a97ca35ea9d6fef91fb350714;hb=414b7c107aaa0e037b3f352e0650bbc429db41a7;hp=92136f407abe50f96fb5a1cebc20f50874cdbb1f;hpb=2b6facc8d4b33c04ae0b544933d1489adf347bfc;p=oweals%2Fopenwrt.git diff --git a/include/kernel.mk b/include/kernel.mk index 92136f407a..439e910ebf 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -52,17 +52,23 @@ else LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null)) LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown) - LINUX_UNAME_VERSION:=$(if $(word 3,$(subst ., ,$(KERNEL_BASE))),$(KERNEL_BASE),$(KERNEL_BASE).0) + LINUX_UNAME_VERSION:=$(KERNEL_BASE) ifneq ($(findstring -rc,$(LINUX_VERSION)),) LINUX_UNAME_VERSION:=$(LINUX_UNAME_VERSION)-$(strip $(lastword $(subst -, ,$(LINUX_VERSION)))) endif LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux - LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.xz - TESTING:=$(if $(findstring -rc,$(LINUX_VERSION)),/testing,) - ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) - LINUX_SITE:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(KERNEL_BASE))).x$(TESTING) + ifneq (,$(findstring -rc,$(LINUX_VERSION))) + LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.gz + else + LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.xz + endif + + ifneq (,$(findstring -rc,$(LINUX_VERSION))) + LINUX_SITE:=https://git.kernel.org/torvalds/t + else ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) + LINUX_SITE:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(KERNEL_BASE))).x else LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_DIR)/include/config/kernel.release 2>/dev/null)) endif @@ -71,7 +77,7 @@ else TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR) ifneq ($(TARGET_BUILD),1) - PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) + PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) endif endif @@ -97,7 +103,8 @@ endif KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS) -KERNEL_MAKE_FLAGS := \ +KERNEL_MAKE_FLAGS = \ + KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \ HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \ CROSS_COMPILE="$(KERNEL_CROSS)" \ ARCH="$(LINUX_KARCH)" \ @@ -123,6 +130,11 @@ ifdef CONFIG_USE_SPARSE KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse endif +ifneq ($(HOST_OS),Linux) + KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION= + export SKIP_STACK_VALIDATION:=1 +endif + PKG_EXTMOD_SUBDIRS ?= . define populate_module_symvers @@ -135,7 +147,10 @@ endef define collect_module_symvers for subdir in $(PKG_EXTMOD_SUBDIRS); do \ + realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \ grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ + [ "$(PKG_BUILD_DIR)" = "$$$$realdir" ] || \ + grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ done; \ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_INFO_DIR)/$(PKG_NAME).symvers @@ -225,8 +240,7 @@ $(call KernelPackage/$(1)/config) $(call KernelPackage/hooks) ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),) - ifneq ($(strip $(FILES)),) - define Package/kmod-$(1)/install + define Package/kmod-$(1)/install @for mod in $$(call version_filter,$$(FILES)); do \ if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \ echo "NOTICE: module '$$$$$$$$mod' is built-in."; \ @@ -238,10 +252,9 @@ $(call KernelPackage/$(1)/config) exit 1; \ fi; \ done; - $(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(wordlist 3,99,$(AUTOLOAD))) + $(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(sort $(wordlist 3,99,$(AUTOLOAD)))) $(call KernelPackage/$(1)/install,$$(1)) - endef - endif + endef $(if $(CONFIG_PACKAGE_kmod-$(1)), else compile: $(1)-disabled @@ -255,7 +268,8 @@ $(call KernelPackage/$(1)/config) endif $$(eval $$(call BuildPackage,kmod-$(1))) - $$(IPKG_kmod-$(1)): $$(wildcard $$(FILES)) + $$(IPKG_kmod-$(1)): $$(wildcard $$(call version_filter,$$(FILES))) + endef version_filter=$(if $(findstring @,$(1)),$(shell $(SCRIPT_DIR)/package-metadata.pl version_filter $(KERNEL_PATCHVER) $(1)),$(1))