This post deals with the installation and configuration of Network drivers. These are entirely optional; the Amiga was not primarily known as a network machine. If you skip over this section there are three main implications:
You will have to use the LiveCD USB stick to download the additional software onto the Amiga Key, then reboot to the Amiga Key and build the software from there.
You will not be able to surf the internet from the Amiga Key using the Lynx text only web browser that we will be installing.
You will not be able to use the Aweb browser under the Amiga OS to surf the internet.
That is it. You will still be able to install software and use the emulator, you will just be missing out on these three things. So if you can't work out how to get your network card functioning in (B)LFS then just skip over this stuff and go to the next post. You won't be missing much. I have written all the other blog entries so that they work without networking being installed on the Amiga Key. If you DO manage to get the network to work, you can do all the [wget]s in the coming posts from the Amiga Key instead of the LiveCD Key. That may speed things up, because you won't be repeatedly booting back into the LiveCD just to download stuff.
We are going to download quite a bit of software throughout the BLFS stages, and as Networking is optional we are going to download our software with the LiveCD booted. The procedure will be the same each time we download packages. Attach the Amiga Key, and run the following commands before running your [wget]s.
umount -v /media/amiga sudo mkdir /media/lfs sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs cd /media/lfs/sources
The installation of the network hardware is tricky. It very much depends on the hardware in your machine. I am building this installation on two systems, a desktop system using a Linksys WMP54GS, PCI card, and a Compaq Mini 700 which has networking built in. Both systems use a Broadcom chipset for the network functions. Happily both appear to work perfectly well with the b43 module in the kernel. There is another option for the compaq, which involves some dedicated drivers (linux sta) for the specific chipset it uses. This is, I think, a better option. However, since b43 works, I am going to put the linux STA stuff in a kind of appendix post as an option. Well, I was, but then the b43 drivers on the netbook turned into a pain in the arse and stopped working. So, I'll download and setup the STA drivers along with the other network stuff.
The b43 driver for my desktop is easier to deal with, as it is built into the Kernel. We still need to download some software for the card - the firmware. I have set out more fully in my blog here exactly how you go about this, so I am not going to repeat that here. I just copied the b43 folder containing the firmware to the /lib/firmware folder on the Amiga Key. Oh, and as a stop press I also got my Abit Airpace PCI-Express card working. It was the easiest of the three; all it needed was for the Atheros option in the kernel configuration to be selected (I mention this on the 'boot' post). No firmware and no hybrid driver needed. Funnily enough this card was the biggest pain in the arse to get working in Windows.
The network software that we will be compiling here is DHCPCD to grab our network settings from a router, some BLFS bootscripts for DHCPCD, wireless utilities to configure the connection, some general networking utilities, and then wget to download files from the internet. First of all we are going to install the wireless utilities because that will give us the network device name which we need to configure the DHCPCD package.
So run the following commands from the LiveCD to download the necessary packages to /sources on the Amiga Key
umount -v /media/amiga sudo mkdir /media/lfs sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs cd /media/lfs/sources mkdir network chmod -v a+wt network cd network wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/d/dhcpcd-4.0.11.tar.bz2 wget http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-20090302.tar.bz2 wget http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.28.tar.gz wget http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-1.60.tar.bz2 wget http://ftp.gnu.org/gnu/wget/wget-1.12.tar.bz2 wget http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz
In a stunning example of me being right, the links from BLFS for dhcpcd are down at the time of writing, so I am using the link to the Server Beach copy. The last command may fail, as the creators of the driver remove old versions when they upload new ones. If so, just go to the website and download the driver manually and save to the Amiga Key. The filename should be the same - with an update in the numbering. The installation should be similar, but be sure to check any README files.
Now, we need to run the build and install commands from either a chroot environment or from the actual System we now have working on the Amiga Key. I would prefer if possible to use the real system we have built. But how then do we copy the commands? Well we could print off these commands and then type them in but the install commands are quite complicated, and a mistaken key press could land us in trouble. So, we could save the commands to a text file on the USB Key. If we made that text file into an executable shell script we could just run the name of the file and all of the commands would execute. Just like magic.
What I will do now is set out all the commands with comments, as with the Actual Build, and then at the end of the post I will list a command which if pasted into the command line of the LiveCD will create an executable script.
Once we have rebooted to the Amiga Key, we move to the sources directory:
cd /sources/network
On the desktop the network card should be up and running and ready to be configured, now that I have loaded the firmware on to the key. You can run ...
dmesg | grep b43... and you should see some encouraging messages.
To get the compaq into the same state, we need to install the STA drivers. This SHOULD be simple.
mkdir hybrid_wl cd hybrid_wl tar -xzvf /sources/network/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz make clean make install -D -m 755 wl.ko /lib/modules/2.6.32.8/kernel/drivers/net/wireless/wl.ko depmod -a cd .. rm -rvf hybrid_wl
Instead of typing all of the filename in, you can just hit [tab] after the first couple of letters and it should auto complete for you. The [install] command copies the driver module (the wl.ko) file we just built to the appropriate place. The [depmod] command makes the kernel rescan all of the installed modules. Now we need to activate the module. It is not compatible with the b43 module so we need to remove it. We also need to remove a couple of others that hang around with it.
rmmod b43 rmmod ssb rmmod lib80211 modprobe lib80211 modprobe wl
You should get some similarly comforting messages from a [dmesg | grep wl], which hopefully should confirm that it is working. Once you have installed the wireless tools, you will get a hold of [iwconfig] which will tell you the new name for the interface.
Talking of those tools, it is now time to install them. First of all we want the utilities to actually configure the wireless connection. Mainly we want these now because they identify the name of our wireless connection, and we are going to have to take that name and plug it into the rest of the commands.
tar -xzvf /sources/network/wireless_tools.28.tar.gz cd wireless_tools.28 make make PREFIX=/usr install cd .. rm -rvf wireless_tools.28
That was pretty straightforwards. Lets do the general tools next. These are mostly useful for [ifconfig] which gives you further information over and above iwconfig. It also configures wired internet connections, in case you are using one of those. Like a luddite.
tar -xjvf /sources/network/net-tools-1.60.tar.bz2 cd net-tools-1.60 patch -Np1 -i ../net-tools-1.60-gcc34-3.patch patch -Np1 -i ../net-tools-1.60-kernel_headers-2.patch patch -Np1 -i ../net-tools-1.60-mii_ioctl-1.patchI have no idea what those patches accomplish, but the books wants them, and what the book wants, the book gets. The normal installation asks you a series of questions about which type of networking protocols you want support for. The default options are fine here. If the default options are not suitable for you, then by definition you know a fuck of a lot more about networking than I do, and you should be able to sort this out your self. To auto-answer [yes] to everything, run this command:
yes "" | make configBy default some programs are not installed, and we can change that by [sed]ing the configuration files we just generated:
sed -i -e 's|HAVE_IP_TOOLS 0|HAVE_IP_TOOLS 1|g' -e 's|HAVE_MII 0|HAVE_MII 1|g' config.h sed -i -e 's|# HAVE_IP_TOOLS=0|HAVE_IP_TOOLS=1|g' -e 's|# HAVE_MII=0|HAVE_MII=1|g' config.makeNow just make and install:
make $CORES_TO_USE make update cd .. rm -rvf net-tools-1.60
Now for dhcp, which grabs our network settings for us from our router.
tar -xjvf /sources/network/dhcpcd-4.0.11.tar.bz2 cd dhcpcd-4.0.11 make PREFIX= LIBEXECDIR=/lib/dhcpcd DBDIR=/var/lib/dhcpcd SYSCONFDIR=/etc/dhcpcd make PREFIX= LIBEXECDIR=/lib/dhcpcd DBDIR=/var/lib/dhcpcd SYSCONFDIR=/etc/dhcpcd install
There is no particular explanation for the options here, but they seem self explanatory. Presumably, we tell it where to put the libraries and executable files, then the database files, and finally the system configuration files. We have to repeat all these when we run the [make ... install] command.
According to BLFS:
By default, a plain text lease info file isn't created but the dhcpcd provides a hook which can be used for creating such a file. Install the hook by running the following commands as the root user:I imagine that all of that guff makes sense if you study the man pages for dhcp with the intensity of a 12 year old with his first playboy magazine. I say imagine, because I cannot be arsed doing it. As best as I can tell the hooks allow dhcp to overwrite files like resolv.conf on the fly. That is a total guess though. We have not installed to the usual location, so we need to [sed] the file to make a change before installing it.
sed -i "s;/var/lib/dhcpcd-;/var/lib/dhcpcd/dhcpcd-;g" dhcpcd-hooks/50-dhcpcd-compat install -v -m 644 dhcpcd-hooks/50-dhcpcd-compat /lib/dhcpcd/dhcpcd-hooks/ cd .. rm -rvf dhcpcd-4.0.11
We need some new bootscripts for the rc system.
tar -xjvf /sources/network/blfs-bootscripts-20090302.tar.bz2 cd blfs-bootscripts-20090302 make install-service-dhcpcd cd .. rm -rvf blfs-bootscripts-20090302
We now need to find out what name has been assigned to our network card. To find this out run [iwconfig] and it should tell you. [iwconfig] was installed as part of the wireless utilities package above. On my Compaq with the wl driver it is eth1, but with the b43 driver it is wlan0, and on my desktop is it wlan1. It could also be ath0 depending on your card. We then need to replace the [XXXX] parts in the next commands with that name. You will need to re run these commands for the network adaptor on any other machine that you run the Amiga Key on - once you have obtained the XXXX network name!
Stop press. I have just figured out that udev automatically keeps track of all the network cards that you expose the system to. It keeps a list of their MAC addresses matched to interface names in the file [/etc/udev/rules.d/70-persistent-net-rules]. It is first come first served, which means if I first booted the system on my desktop, I would see wlan0 being assigned to the desktop's wireless card, and wlan1 to the compaqs. Presumably you can wipe this file, and it will be recreated. So, if you have a problem with finding your interface name, check in this file.
If we were typing in the commands step by step instead of using the script method, we can now run the command:
iwconfig XXXX essid "YYYY" key ZZZZ
Where XXXX=whatever iwconfig told you was the name of the network connection, YYYY=the wireless network name, and ZZZZ=the WEP key. This will connect you to the network - if you use WEP security. Then to get the all useful IP addresses, run:
dhcpcd XXXX
You should now be connected to the internet - congratulations. To semi-automate the connection, I will stick a couple of scripts in the /root folder - one for each of my network cards:
cat > ~/wifi_wl.sh << "EOF" rmmod b43 rmmod ssb rmmod wl rmmod lib80211 modprobe lib80211 modprobe wl dhcpcd -L -t 1 XXXX iwconfig XXXX essid "YYYY" key ZZZZ dhcpcd XXXX EOF chmod +x ~/wifi_wl.shThe first [dhcpcd] line looks odd, and so it fucking should. For reasons known only to itself the wl.ko driver will not fucking work the first time you try to connect to a network. It just won't. Don't know why. So the command here runs [dhcpcd] with a [t]imeout of [1] second so it fails really fast. The [L] option stops it trying to assign a manual IP address when it can't get one from the router. It then connects quite happily the second time we ask it to. And no, it is nothing to do with the fact that I haven't [iwconfig]'d the interface before the first command. Of course I tried that. Did nothing. This is annoying, but it is the only way I can get the bastard to work. There are no such problems with the b43 driver. It has an entirely different problem. Udev leaps in when the driver loads and renames the interface. It doesn't do it quickly enough for the script though, with the result that the interface cannot be found. I need to insert a [sleep 1] line to make the script pause for a second to allow udev to do its thing:
cat > ~/wifi_b43.sh << "EOF" rmmod b43 rmmod ssb rmmod wl rmmod lib80211 modprobe b43 sleep 1 iwconfig XXXX essid "YYYY" key ZZZZ dhcpcd XXXX EOF chmod +x ~/wifi_b43.sh
Now you can reconnect to the network once you have booted by running [~/wifi_(driver of choice).sh]. To download anything from the internet, you use the wget program, which we have been using a lot anyway in the LiveCD. You need to compile this again once you have installed the OpenSSL package, which will come along shortly.
tar -xjvf /sources/network/wget-1.12.tar.bz2 cd wget-1.12 ./configure --prefix=/usr --sysconfdir=/etc make $CORES_TO_USE make install install-info --info-dir=/usr/share/info /usr/share/info/wget.info cd .. rm -rvf wget-1.12
Now for the script to automatically do all of that. Because part of the commands that we are pasting into the script is an actual [cat] command with an EOF, we cannot use the EOF marker for the surrounding script. Otherwise the [cat] command would just terminate as soon as it hit the first EOF. If only I could think of some other marker to use ...
sudo cat > install_network.sh << "ARSE" cd /sources/network tar -xzvf /sources/network/wireless_tools.28.tar.gz cd wireless_tools.28 make make PREFIX=/usr install cd .. rm -rvf wireless_tools.28 tar -xjvf /sources/network/net-tools-1.60.tar.bz2 cd net-tools-1.60 patch -Np1 -i ../net-tools-1.60-gcc34-3.patch patch -Np1 -i ../net-tools-1.60-kernel_headers-2.patch patch -Np1 -i ../net-tools-1.60-mii_ioctl-1.patch yes "" | make config sed -i -e 's|HAVE_IP_TOOLS 0|HAVE_IP_TOOLS 1|g' -e 's|HAVE_MII 0|HAVE_MII 1|g' config.h sed -i -e 's|# HAVE_IP_TOOLS=0|HAVE_IP_TOOLS=1|g' -e 's|# HAVE_MII=0|HAVE_MII=1|g' config.make make $CORES_TO_USE make update cd .. rm -rvf net-tools-1.60 tar -xjvf /sources/network/dhcpcd-4.0.11.tar.bz2 cd dhcpcd-4.0.11 make PREFIX= LIBEXECDIR=/lib/dhcpcd DBDIR=/var/lib/dhcpcd SYSCONFDIR=/etc/dhcpcd make PREFIX= LIBEXECDIR=/lib/dhcpcd DBDIR=/var/lib/dhcpcd SYSCONFDIR=/etc/dhcpcd install sed -i "s;/var/lib/dhcpcd-;/var/lib/dhcpcd/dhcpcd-;g" dhcpcd-hooks/50-dhcpcd-compat install -v -m 644 dhcpcd-hooks/50-dhcpcd-compat /lib/dhcpcd/dhcpcd-hooks/ cd .. rm -rvf dhcpcd-4.0.11 tar -xjvf /sources/network/blfs-bootscripts-20090302.tar.bz2 cd blfs-bootscripts-20090302 make install-service-dhcpcd cd .. rm -rvf blfs-bootscripts-20090302 cat > ~/wifi_wl.sh << "EOF" rmmod b43 rmmod ssb rmmod wl rmmod lib80211 modprobe lib80211 modprobe wl dhcpcd -L -t 1 XXXX iwconfig XXXX essid "YYYY" key ZZZZ dhcpcd XXXX EOF chmod +x ~/wifi_wl.sh cat > ~/wifi_b43.sh << "EOF" rmmod b43 rmmod ssb rmmod lib80211 rmmod wl modprobe b43 sleep 1 iwconfig XXXX essid "YYYY" key ZZZZ dhcpcd XXXX EOF chmod +x ~/wifi_b43.sh tar -xjvf /sources/network/wget-1.12.tar.bz2 cd wget-1.12 ./configure --prefix=/usr --sysconfdir=/etc make $CORES_TO_USE make install install-info --info-dir=/usr/share/info /usr/share/info/wget.info cd .. rm -rvf wget-1.12 ARSE chmod +x ./install_network.sh sudo mv ./install_network.sh /media/lfs/root
Once you have pasted that script, you reboot to the Amiga Key, login in, and run the script [~/install_network.sh]. You will then need to run the [iwconfig] command to get your network interface name, and then [nano] the script in your [~] directory and paste in the name instead of XXXX. Complete the YYYY and ZZZZ stuff per your own network configuration.
Finally, remember that you may want to reinstall the wget program once you have SSL support installed in due course.
No comments:
Post a Comment