X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=include%2Fkernel.mk;h=ae2dcc3fd98206871751e002cb25c412a02ff501;hp=6185237765472355349e4b1b0a7bf5163cff6dca;hb=14421bd7fbc53ced274d758fe3d6fe53ee8c7b20;hpb=e9c0b958295bb055fefc03b1e356051f99218f28 diff --git a/include/kernel.mk b/include/kernel.mk index 6185237765..ae2dcc3fd9 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -79,6 +79,24 @@ endef define ModuleAutoLoad $(SH_FUNC) \ export modules=; \ + probe_module() { \ + mods="$$$$$$$$1"; \ + boot="$$$$$$$$2"; \ + shift 2; \ + 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/$(1); \ + fi; \ + done; \ + if [ -e $(2)/etc/modules.d/$(1) ]; then \ + if [ "$$$$$$$$boot" = "1" ]; then \ + mkdir -p $(2)/etc/modules-boot.d; \ + ln -s ../modules.d/$(1) $(2)/etc/modules-boot.d/; \ + fi; \ + modules="$$$$$$$${modules:+$$$$$$$$modules}"; \ + fi; \ + }; \ add_module() { \ priority="$$$$$$$$1"; \ mods="$$$$$$$$2"; \ @@ -104,8 +122,8 @@ define ModuleAutoLoad mkdir -p $(2)/CONTROL; \ echo "#!/bin/sh" > $(2)/CONTROL/postinst; \ echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \ - echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \ - echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \ + echo ". /lib/functions.sh" >> $(2)/CONTROL/postinst; \ + echo "insert_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \ chmod 0755 $(2)/CONTROL/postinst; \ fi endef @@ -163,11 +181,11 @@ $(call KernelPackage/$(1)/config) 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."; \ + echo "ERROR: module '$$$$$$$$mod' is missing." >&2; \ exit 1; \ fi; \ else \ - echo "WARNING: module '$$$$$$$$mod' missing and modules.builtin not available, assuming built-in."; \ + echo "WARNING: module '$$$$$$$$mod' missing and modules.builtin not available, assuming built-in." >&2; \ fi; \ done; $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD)) @@ -176,9 +194,13 @@ $(call KernelPackage/$(1)/config) endif $(if $(CONFIG_PACKAGE_kmod-$(1)), else - compile: kmod-$(1)-unavailable - kmod-$(1)-unavailable: - @echo "WARNING: kmod-$(1) is not available in the kernel config" + compile: $(1)-disabled + $(1)-disabled: + @echo "WARNING: kmod-$(1) is not available in the kernel config - generating empty package" >&2 + + define Package/kmod-$(1)/install + true + endef ) endif $$(eval $$(call BuildPackage,kmod-$(1))) @@ -190,6 +212,10 @@ define AutoLoad add_module "$(1)" "$(2)" "$(3)"; endef +define AutoProbe + probe_module "$(1)" "$(2)"; +endef + version_field=$(if $(word $(1),$(2)),$(word $(1),$(2)),0) kernel_version_merge=$$(( ($(call version_field,1,$(1)) << 24) + ($(call version_field,2,$(1)) << 16) + ($(call version_field,3,$(1)) << 8) + $(call version_field,4,$(1)) ))