X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/1be3566612cddfea7d96e81c07379a26f7d8225c..978d04d68003d9d6a6d651d4aaf702763a8a8c9d:/include/kernel.mk diff --git a/include/kernel.mk b/include/kernel.mk index 467172e93..1af072d6b 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -82,16 +82,19 @@ define ModuleAutoLoad mods="$$$$$$$$2"; \ boot="$$$$$$$$3"; \ shift 3; \ - mkdir -p $(2)/etc/modules.d; \ - ( \ - [ "$$$$$$$$boot" = "1" ] && { \ - echo '# May be required for rootfs' ; \ - } ; \ - for mod in $$$$$$$$mods; do \ - echo "$$$$$$$$mod"; \ - done \ - ) > $(2)/etc/modules.d/$$$$$$$$priority-$(1); \ - modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$priority-$(1)"; \ + for mod in $$$$$$$$mods; do \ + if [ -e $(2)/$(MODULES_SUBDIR)/$$$$$$$$mod.ko ]; then \ + mkdir -p $(2)/etc/modules.d; \ + echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \ + fi; \ + done; \ + if [ -e $(2)/etc/modules.d/$$$$$$$$priority-$(1) ]; then \ + if [ "$$$$$$$$boot" = "1" ]; then \ + mkdir -p $(2)/etc/modules-boot.d; \ + ln -s ../modules.d/$$$$$$$$priority-$(1) $(2)/etc/modules-boot.d/; \ + fi; \ + modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$priority-$(1)"; \ + fi; \ }; \ $(3) \ if [ -n "$$$$$$$$modules" ]; then \ @@ -147,11 +150,24 @@ $(call KernelPackage/$(1)/config) $(call KernelPackage/depends) - ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),) + 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 - mkdir -p $$(1)/$(MODULES_SUBDIR) - $(CP) -L $$(FILES) $$(1)/$(MODULES_SUBDIR)/ + @for mod in $$(FILES); do \ + if [ -e $$$$$$$$mod ]; then \ + mkdir -p $$(1)/$(MODULES_SUBDIR) ; \ + $(CP) -L $$$$$$$$mod $$(1)/$(MODULES_SUBDIR)/ ; \ + 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 "WARNING: module '$$$$$$$$mod' missing and modules.builtin not available, assuming built-in."; \ + fi; \ + done; $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD)) $(call KernelPackage/$(1)/install,$$(1)) endef