Is there a better way to auto-start ath5k wireless driver?
I noticed that after I install the ath5k drivers from the latest tarball at wireless.kernel.org for my Atheros 5007EG, I had to go back to the download directory after each reboot and run "make load". I did not know what make load did but after some tracing I noticed it runs a script called load.sh. Here is the contents of load.sh:
#!/bin/bash MODULES="ipw2100 ipw2200 libertas_cs usb8xxx" MODULES="$MODULES p54pci p54usb" MODULES="$MODULES adm8211 zd1211rw" MODULES="$MODULES rtl8180 rtl8187" MODULES="$MODULES p54pci p54usb" MODULES="$MODULES iwl3945 iwl4965" MODULES="$MODULES rtl8180 rtl8187" MODULES="$MODULES rtl8180 rtl8187" MODULES="$MODULES rt2400pci rt2500pci rt61pci" MODULES="$MODULES rt2500usb rt73usb" MODULES="$MODULES rndis_wlan at76_usb" for i in $MODULES; do echo Loading $i... modprobe $i done # For ath5k we must be sure to unload MadWifi first athload ath5k # For b43 we must make sure to unload bcm43xx first b43load b43 Can someone explain what this code is doing? Also, the bigger question is "What is the best way to autoload the wireless driver at boot?". I did not neccesarily want to put a copy of this script in my startup folder because: 1) That seems kind of hacky 2) I want this to load when any user logs in. Not just me. 3) I think maybe some of the script above is not neccesary, but I do not understand what it is doing. Can an expert help me find the best way to autoload my wireless at boot? |
Quote:
Code:
MODULES="ipw2100 ipw2200 libertas_cs usb8xxx" Code:
for i in $MODULES; do But you don't need any of them, because you have an Atheros 5007EG Code:
# For ath5k we must be sure to unload MadWifi first look at the script athload to see what it does. Try booting, then just try running (as root) /path/to/athload ath5k Does your wireless work now? |
Thanks Tredegar. Running
Quote:
That being said, what is the official Linux-way to auto run this driver load process at login? In Windows I am thinking of the "Startup" folder in the All Users directory. This would be C:\Documents and Settings\All Users\Startup. Is there a Linux equivalent to this? |
Quote:
But the quick & easy way is to add your command to the file /etc/rc.local That file/script is run once, when your PC is booting up, after (almost) everything else has been started. So just add a couple of lines like this to the file, just before the final exit 0 so it now looks like this: Code:
# Comment: load the atheros module to enable wireless You will need to be root to edit that file Reboot, and your wireless should be working. |
Adding this to rc.local worked:
Quote:
Also is rc.local run as part of the boot up process or is it run when a user logs into the machine? I guess it is for all users since the directory /etc is so generic but I can never be sure with Linux's complexity. I found bashrc in my home directory and thought this might be the login run script, but upon opening it up, it looks to complicated to serve this function. |
Adding this to rc.local worked:
Quote:
Also is rc.local run as part of the boot up process or is it run when a user logs into the machine? I guess it is for all users since the directory /etc is so generic but I can never be sure with Linux's complexity. I found bashrc in my home directory and thought this might be the user level login script, but upon opening it up, it looks to complicated to serve this function. |
Quote:
Quote:
Having a script in your home directory that is run by root is potentially a big security flaw. Think about it. If you wanted to do this properly, you should move (as root) the script athload to the directory /sbin and give it proper permissions and ownership: Code:
mv /home/ubuntu/programs/athload/athload /sbin And then update the path in your rc.local so it reflects where the script is now: Code:
/sbin/athload ath5k If you don't understand, then post the script here and we'll take a look at it for you. |
Quote:
I read the athload file. It does assume that two other scripts are in the same directory, so I moved the entire athload directory (which contains the athload file plus the others) and set up root as owner and gave those permissions. Upon rebooting it all worked the first try. Thanks for the help. |
Using runlevels to start ath5k
If the following works for your WiFi setup, you can use init.d to start it during startup:
$ sudo modprobe ath5k $ sudo ip link set wlan0 up $ sudo iwconfig wlan0 essid any I have created the following file as /etc/init.d/ath5k: Code:
#!/bin/sh -e -rwxr-xr-x 1 root root 281 2009-06-30 10:58 /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:00 /etc/rc0.d/K20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:01 /etc/rc1.d/K20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:02 /etc/rc2.d/S20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:03 /etc/rc3.d/S20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:03 /etc/rc4.d/S20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:03 /etc/rc5.d/S20ath5k -> /etc/init.d/ath5k lrwxrwxrwx 1 root root 17 2009-06-30 11:04 /etc/rc6.d/K20ath5k -> /etc/init.d/ath5k |
per the Debian wiki on the ath5k driver you just need to modify /etc/modprobe.d/madwifi to configure the module to load at startup..
http://wiki.debian.org/ath5k Can't imagine Ubuntu is very different.. |
All times are GMT -5. The time now is 04:17 PM. |