Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] compat-wireless: check if modprobe exists before using it
@ 2012-01-18  8:13 Luciano Coelho
  2012-01-18 17:15 ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Luciano Coelho @ 2012-01-18  8:13 UTC (permalink / raw)
  To: mcgrof; +Cc: linux-wireless, linux-bluetooth, wlist, idor, assaf, gil.barak

If you're cross-compiling compat-wireless on a different host, you
can't reliably use modprobe.  The host system may not even have
modprobe, so it doesn't make sense to run modprobe, unless you're
installing the modules on the target machine.

The modprobe command was being used unconditionally to set the MADWIFI
and OLD_IWL variables.  This commit adds a check to see whether
modprobe exists before trying to use.  It also adds a dependency on
the modprobe commands to all recipes that rely on it, so we fail more
gracefully if modprobe doesn't exist in the system.

Reported by: William List <wlist@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 Makefile |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index c81d680..e3d9128 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,11 @@ endif
 export KLIB_BUILD ?=	$(KLIB)/build
 # Sometimes not available in the path
 MODPROBE := /sbin/modprobe
+
+ifneq ($(wildcard $(MODPROBE)),)
 MADWIFI=$(shell $(MODPROBE) -l ath_pci)
 OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
+endif
 
 DESTDIR?=
 
@@ -95,7 +98,7 @@ $(CREL_CHECK):
 
 btinstall: btuninstall bt-install-modules
 
-bt-install-modules: bt
+bt-install-modules: bt $(MODPROBE)
 	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
 		modules_install
 	@/sbin/depmod -ae
@@ -130,7 +133,7 @@ bt-install-modules: bt
 	@echo And then load the needed bluetooth modules. If unsure reboot.
 	@echo
 
-btuninstall:
+btuninstall: $(MODPROBE)
 	@# New location, matches upstream
 	@rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
 	@rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
@@ -173,7 +176,7 @@ install-modules: modules
 		modules_install
 	@./scripts/update-initramfs
 
-install-scripts:
+install-scripts: $(MODPROBE)
 	@# All the scripts we can use
 	@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
 	@install scripts/modlib.sh	$(DESTDIR)/usr/lib/compat-wireless/
@@ -330,7 +333,7 @@ install-scripts:
 	@echo If unsure reboot.
 	@echo
 
-uninstall:
+uninstall: $(MODPROBE)
 	@# New location, matches upstream
 	@rm -rf $(KLIB)/$(KMODDIR)/compat/
 	@rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] compat-wireless: check if modprobe exists before using it
  2012-01-18  8:13 [PATCH] compat-wireless: check if modprobe exists before using it Luciano Coelho
@ 2012-01-18 17:15 ` Luis R. Rodriguez
  2012-01-18 17:19   ` Luciano Coelho
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2012-01-18 17:15 UTC (permalink / raw)
  To: Luciano Coelho
  Cc: linux-wireless, linux-bluetooth, wlist, idor, assaf, gil.barak

On Wed, Jan 18, 2012 at 12:13 AM, Luciano Coelho <coelho@ti.com> wrote:
> If you're cross-compiling compat-wireless on a different host, you
> can't reliably use modprobe.  The host system may not even have
> modprobe, so it doesn't make sense to run modprobe, unless you're
> installing the modules on the target machine.
>
> The modprobe command was being used unconditionally to set the MADWIFI
> and OLD_IWL variables.  This commit adds a check to see whether
> modprobe exists before trying to use.  It also adds a dependency on
> the modprobe commands to all recipes that rely on it, so we fail more
> gracefully if modprobe doesn't exist in the system.
>
> Reported by: William List <wlist@ti.com>
> Signed-off-by: Luciano Coelho <coelho@ti.com>

Good point, I've propagated this into the linux-3.2.y and linux-3.1.y
branches of compat-wireless as well so that if a new release is made
the fixes go along with it.

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] compat-wireless: check if modprobe exists before using it
  2012-01-18 17:15 ` Luis R. Rodriguez
@ 2012-01-18 17:19   ` Luciano Coelho
  0 siblings, 0 replies; 3+ messages in thread
From: Luciano Coelho @ 2012-01-18 17:19 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linux-wireless, linux-bluetooth, wlist, idor, assaf, gil.barak

On Wed, 2012-01-18 at 09:15 -0800, Luis R. Rodriguez wrote: 
> On Wed, Jan 18, 2012 at 12:13 AM, Luciano Coelho <coelho@ti.com> wrote:
> > If you're cross-compiling compat-wireless on a different host, you
> > can't reliably use modprobe.  The host system may not even have
> > modprobe, so it doesn't make sense to run modprobe, unless you're
> > installing the modules on the target machine.
> >
> > The modprobe command was being used unconditionally to set the MADWIFI
> > and OLD_IWL variables.  This commit adds a check to see whether
> > modprobe exists before trying to use.  It also adds a dependency on
> > the modprobe commands to all recipes that rely on it, so we fail more
> > gracefully if modprobe doesn't exist in the system.
> >
> > Reported by: William List <wlist@ti.com>
> > Signed-off-by: Luciano Coelho <coelho@ti.com>
> 
> Good point, I've propagated this into the linux-3.2.y and linux-3.1.y
> branches of compat-wireless as well so that if a new release is made
> the fixes go along with it.

Excellent, thanks dude!

-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-18 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18  8:13 [PATCH] compat-wireless: check if modprobe exists before using it Luciano Coelho
2012-01-18 17:15 ` Luis R. Rodriguez
2012-01-18 17:19   ` Luciano Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox