LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 09-30-2005, 09:27 AM   #1
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Rep: Reputation: 15
Start Wireless at Boot?


I have a Netgear WG511 wireless PC card which uses the Prism54 driver and firmware. Everything works with manual activation as follows:

iwconfig eth1 key 9035107500
ifconfig eth1 up
dhcpcd eth1

My question is, how do I automate this procedure so that the interface is activated at boot?

Thanks for any help, jimbo
 
Old 09-30-2005, 10:16 AM   #2
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 48
I'm not using LFS, but in debian you add 'auto' to the /etc/network/interfaces file, after iface eth1. I don't know about the key thing though. I'm not sitting in front of a linux box, so I'll have to check to get you the exact command. Try 'man interfaces'. Hope this helps
 
Old 09-30-2005, 04:29 PM   #3
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
Thanks for the reply. Yes, I know how to do it for Debian, Slackware, Arch, DSlinux and Vector, but I don't have a clue about LFS.

Thanks, jimbo
 
Old 09-30-2005, 05:48 PM   #4
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 48
oh...I guess I assumed it would be similar. is there nothing in LFS similar? sorry I couldn't have been more help
 
Old 09-30-2005, 07:03 PM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Crash course in booting

As root, go to you /etc/rc.d/init.d directory. In it, you'll see the system's startup scripts. Use emacs, VI, or whatever you have installed to edit a new one. Type up something like this:
Code:
#!/bin/bash

case "$1" in

  # Manually start up wireless by
  #   * setting the key
  #   * activating the interface
  #   * getting a dhcp lease
  start)
    echo "Bringing up wireless..."
    iwconfig eth1 key 9035107500
    ifconfig eth1 up
    dhcpcd eth1
  ;;


  # Bring down/deactivate the interface
  stop)
    echo "Bringing down wireless..."
    ifconfig eth1 down
  ;;

  *)
    echo "Usage: $0 {start|stop}"
    exit 1
  ;;

esac
That's admittedly "over the top" for what was needed, but gives you an idea how to expand on it or modify it later if necessary. Anyway, save it as something (I'll use eth1_wireless), and make it executable:
Code:
chmod u+x eth1_wireless

Now comes the (potentially) confusiong part. Go up one directory to /etc/rc.d, and do a listing. You'll see a number of directories, but the ones you're interested in are rc0.d, rc1.d, ..., rc6.d. Each one of those directories corresponds to a runlevel when the computer starts up. If you're not familiar with them, runlevel 3 is a console-only. Runlevel 5 is usually GUI. Figure out which runlevel you enter by default. You can do that with the following command:
Code:
cat /etc/inittab | grep initdefault | cut -f 2 -d:
That should only come back with one number. If not, then you've made some changes to that file, and you'd likely know what you did, why, and don't need a command to tell you what runlevel you use

So cd into the directory for your runlevel (rc3.d for example) and do another listing. You'll see lots of SXXname symbolic links and maybe some KXXname symbolic links. Each of those links points back to a script in /etc/rc.d/init.d. When entering this runlevel, the system kicks off any script linked from this directory. If the link starts with an 'S', the script is called with a 'start' argument. If the link starts with a 'K', the script is called with a 'stop' argument. The two numbers following the S or K indicated the order the scripts are called. You want to create a symbolic link that occurs after your initial network script. There should be an "S20network -> ../init.d/network" link unless you've changed something. So create a link to the eth1_wireless script with an S and a number greater than 20. If you want to be absolutely safe, do this:
Code:
ln -s ../init.d/eth1_wireless S99eth1_wireless
The next time you boot, you shoudl see a message that wireless is being brought up. If successful, it'll be automated from that point on. If you need to make changes, just modify the /etc/rc.d/init.d/eth1_wireless script.

Probably information overload... sorry about that, but it's not a straightforward process unless your're already familiar with it. So I wanted to take it slow. If you run into problems, let me know.
 
Old 09-30-2005, 11:04 PM   #6
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
Hey Dark_Helmet, thanks for the lesson! I will give your suggestion a try.

jimbo
 
Old 10-01-2005, 10:40 AM   #7
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
OK Dark_Helmet, You da man!!

Everything worked perfectly, and it was also a great learning experience.

Just one question. After I created the script and made it executable, I tried to execute it from the command line. It wouldn't execute, some bash error about no interpreter...?

Thanks again, jimbo
 
Old 10-01-2005, 10:49 AM   #8
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
No interpreter? That's odd.

Double check the first line of the script. The very first line needs to be "#!/bin/bash". What I'm getting at is there may be an accidental typo or a blank/comment line before it. The code block above sort of makes it look like there's a blank line before, and there shouldn't be.

The only other thing I can think would be if you installed bash in a different location. In other words, somewhere other than /bin. I guess it's also possible you didn't install bash at all
 
Old 10-01-2005, 04:38 PM   #9
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
OK, you had it right again. I left out the "/" before bin. Everything now works perfectly, from boot or from a command line execution.

Many thanks, jimbo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless Keyboard not working to select boot options (Grub boot loader) psrini_vasan Fedora 7 12-16-2009 05:45 PM
for those of you who wish for wireless to start when Linux starts... mrchaos Linux - Wireless Networking 3 05-25-2005 07:28 AM
Wireless Start Up Script scoobs Linux - Wireless Networking 1 09-04-2004 12:39 AM
SUSE 9.1 Wireless Net Card Wont Start On Boot theGerbil Linux - Wireless Networking 4 07-03-2004 05:25 PM
start wireless JROCK1980 Linux - Wireless Networking 4 05-28-2004 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration