From: Florian Fainelli Date: Tue, 13 Jun 2017 22:19:24 +0000 (-0700) Subject: include: Add support for specifying kernel module parameters X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fflorian.git;a=commitdiff_plain;h=473eedd8669280d7aeee98e37b8f8ac935b214aa include: Add support for specifying kernel module parameters A number of people have requested that feature to be added in the past (OpenWrt tickets #1458, #2359) so make that possible now. Signed-off-by: Florian Fainelli --- diff --git a/include/kernel.mk b/include/kernel.mk index 7674f0dadc..565a96c6a9 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -132,12 +132,17 @@ define ModuleAutoLoad export modules=; \ probe_module() { \ local mods="$$$$$$$$1"; \ + params="$$$$$$$$3"; \ local boot="$$$$$$$$2"; \ local mod; \ - shift 2; \ + shift 3; \ for mod in $$$$$$$$mods; do \ mkdir -p $(2)/etc/modules.d; \ - echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$(1); \ + if [ -n "$$$$$$$$params" ]; then \ + echo "$$$$$$$$mod $$$$$$$$params" >> $(2)/etc/modules.d/$(1); \ + else \ + echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$(1); \ + fi; \ done; \ if [ -e $(2)/etc/modules.d/$(1) ]; then \ if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$(1) ]; then \ @@ -151,11 +156,16 @@ define ModuleAutoLoad local priority="$$$$$$$$1"; \ local mods="$$$$$$$$2"; \ local boot="$$$$$$$$3"; \ + params="$$$$$$$$4"; \ local mod; \ - shift 3; \ + shift 4; \ for mod in $$$$$$$$mods; do \ mkdir -p $(2)/etc/modules.d; \ - echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \ + if [ -n "$$$$$$$$params" ]; then \ + echo "$$$$$$$$mod $$$$$$$$params" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \ + else \ + echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \ + fi; \ done; \ if [ -e $(2)/etc/modules.d/$$$$$$$$priority-$(1) ]; then \ if [ "$$$$$$$$boot" = "1" -a ! -e $(2)/etc/modules-boot.d/$$$$$$$$priority-$(1) ]; then \ @@ -266,11 +276,11 @@ endef version_filter=$(if $(findstring @,$(1)),$(shell $(SCRIPT_DIR)/package-metadata.pl version_filter $(KERNEL_PATCHVER) $(1)),$(1)) define AutoLoad - add_module "$(1)" "$(call version_filter,$(2))" "$(3)"; + add_module "$(1)" "$(call version_filter,$(2))" "$(3)" "$(4)"; endef define AutoProbe - probe_module "$(call version_filter,$(1))" "$(2)"; + probe_module "$(call version_filter,$(1))" "$(2)" "$(3)"; endef version_field=$(if $(word $(1),$(2)),$(word $(1),$(2)),0)