From 946560e1e3d3343c07ee8c429d89625cf874d588 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 13 Jun 2017 15:19:24 -0700 Subject: [PATCH] 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 --- include/kernel.mk | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/include/kernel.mk b/include/kernel.mk index 7674f0dadc..a901c7136a 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 "$$$$$$$$mods" >> $(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) -- 2.30.2