brcm47xx: BCMA - Consolidate/reduce code in bcma_device_name
[openwrt.git] / include / kernel.mk
index 1591c36..c0d8ef8 100644 (file)
@@ -13,6 +13,7 @@ ifeq ($(DUMP),1)
   KERNEL?=<KERNEL>
   BOARD?=<BOARD>
   LINUX_VERSION?=<LINUX_VERSION>
+  LINUX_VERMAGIC?=<LINUX_VERMAGIC>
 else
   ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
     export GCC_HONOUR_COPTS=s
@@ -35,6 +36,9 @@ else
   KERNEL_BUILD_DIR ?= $(BUILD_DIR_BASE)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
   LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
 
+  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)
   ifneq ($(findstring -rc,$(LINUX_VERSION)),)
     LINUX_UNAME_VERSION:=$(LINUX_UNAME_VERSION)-$(strip $(lastword $(subst -, ,$(LINUX_VERSION))))
@@ -130,7 +134,7 @@ define KernelPackage
     SECTION:=kernel
     CATEGORY:=Kernel modules
     DESCRIPTION:=$(DESCRIPTION)
-    EXTRA_DEPENDS:=kernel (=$(LINUX_VERSION)-$(LINUX_RELEASE))
+    EXTRA_DEPENDS:=kernel (=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC))
     VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),+$(PKG_VERSION))-$(if $(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
     $(call KernelPackage/$(1))
     $(call KernelPackage/$(1)/$(BOARD))
@@ -157,11 +161,15 @@ $(call KernelPackage/$(1)/config)
                        if [ -e $$$$$$$$mod ]; then \
                                mkdir -p $$(1)/$(MODULES_SUBDIR) ; \
                                $(CP) -L $$$$$$$$mod $$(1)/$(MODULES_SUBDIR)/ ; \
-                       elif  grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
-                               echo "NOTICE: module '$$$$$$$$mod' is built-in."; \
+                       elif [ -e "$(LINUX_DIR)/modules.builtin" ]; then \
+                               if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
+                                       echo "NOTICE: module '$$$$$$$$mod' is built-in."; \
+                               else \
+                                       echo "ERROR: module '$$$$$$$$mod' is missing."; \
+                                       exit 1; \
+                               fi; \
                        else \
-                               echo "ERROR: module '$$$$$$$$mod' is missing."; \
-                               exit 1; \
+                               echo "WARNING: module '$$$$$$$$mod' missing and modules.builtin not available, assuming built-in."; \
                        fi; \
                  done;
                  $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD))
This page took 0.021676 seconds and 4 git commands to generate.