Sunday, 19 May 2013

Linux Hardware


Linux Hardware



Hardware support has once been a very big problem with Linux. Generic hardware always was well
supported, but most of the hardware today is unfortunately non-generic. 100% Sound Blaster compatible
cards often are not detected by the Sound Blaster driver, and non-PostScript printers don't accept PostScript
input unless a program previously converted it. These are the kind of problems we solve here.



Tip 1: Detecting 2 ethernet cards



To configure an ethernet card in Linux, you need to enable it in the kernel. Then the kernel will detect your
ethernet card if it is at a common IO port. But it will stop there, and will never check if you have 2 ethernet
cards.
The trick is to tell the ethernet driver that there are 2 cards in the system. The following line will tell the
kernel that there is an ethernet card at IRQ 10 and IO 0x300, and another one at IRQ 9 and IO 0x340:
ether=10,0x300,eth0 ether=9,0x340,eth1
You can add that line on bootup at the "boot:" prompt, or in the /etc/lilo.conf file. Don't forget to run:
lilo
That will reload the lilo.conf file and enable changes.


Tip 2: Everything on sound cards



A sound card can be easy or hard to detect. It depends on who made it. Many Sound Blaster Compatible
cards in fact are not compatible with the Linux Sound Blaster driver. Other cards will be compatible with a
driver you would never have thought of.
There are multiple drivers for Linux. Currently the kernel comes with its own set of sound drivers, plus the
OSS/Free drivers. These will support most generic cards. In the installation program, or when compiling your
kernel, you can pick the sound card that matches yours, or the one that matches the chipset on your sound
card (for example, the Sound Blaster PCI64 card uses the AudioPCI chipset).
If your sound card is not supported by the kernel, you will need to get another driver. 2 popular ones are
ALSA available from http://alsa.jcu.cz and OSS/Linux available from http://www.opensound.com
OSS/Linux is a commercial product that supports a lot of cards not available in other drivers because of card
specification restrictions. You will need to see the list of supported cards in each driver and pick the driver
you need.


Tip 3: Non-PostScript printers



Unfortunately, most printers are non-PostScript compatible. This means that your LPR program won't like it.
You will probably notice that when you first use 'lpr' to print, the output looks weird on your printer. This is
because these models do not support PostScript. You will need a converting program for it.
Note that newer versions of RedHat already have those programs or similar filters so it may not apply to all
Linux systems.
First, you need to go read the Printing HOWTO to find out how to use lpr and related printing programs.
Then, you'll need to get 2 programs from http://metalab.unc.edu:
•??bjf
•??aps
These are the filters to convert text and PostScript to your printer's format.
First, install bjf which will be used to print text. Installation is very simple. type:
make
cp bjf /bin/bjf
Then, make a simple shell script to print text files and call it print.sh:
#!/bin/sh
/bin/bjf <$1> /dev/lp0
Where /dev/lp0 is your printer.
Now, install aps by running the SETUP script in its package. It's really easy to setup, but you do need to have
the GhostScript program installed prior to installation. You are now ready to print PostScript files from, for
example, Netscape or XV.


Tip 4: Use Windows special keys in Linux



Why are all the new keyboards sold with Win95 keys on them? How about making them do real keyboard
functions while in X Window? Here is how.
First you need to find out which key mapping you are using. Usually it will be US, it might also be en_US, ca
or else. Locate the file, usually in /usr/X11/lib/X11/xkb and edit it with your favorite editor. For me the file is
called /usr/X11/lib/X11/xkb/symbols/ca.
The file lists all the key codes and what they do. The key codes for the Win95 special keys are LWIN, RWIN
and MENU. All you need to do is add them to the list, with the functions for them. I decided to map the left
WIN key to "@" and the right WIN key and MENU keys to "{" and "}". Here are the lines I added:
key <RWIN> { [ braceleft ] };
key <LWIN> { [ at ] };
key <MENU> { [ braceright ] };
By browsing the file you can find all the other symbols and what they do. You can also add multiple
functions to a key, by using ALT and SHIFT.
The changes will take effect when you restart X Window. With the XKB extension (you do need to have it
enabled in /etc/XF86Config btw) it's easy to change the mapping of any key.


Tip 5: Added processors



Dual processors are becoming more and more popular in computers. Of course, you won't be able to see
much performance increase in Linux unless you tell Linux about the second CPU. Here is how to do it.
Go in the kernel, and enable SMP. SMP means Symetric Multi-Processing and tells the kernel that more than
one processor can be used.
After a reboot, Linux should tell you that it has detected 2 processors and what their status are.


Tip 6: Detecting an ISA device



ISA devices like modems should be detected automatically by the kernel. One case where they would not be
detected is if the device is Plug and Play. The kernel won't be able to detect ISA PnP devices unless they
have been prepared by a program called isapnptools.
The trick is to use this program in initiation scripts. It will detect the ISA PnP devices and make them
available to kernel modules and applications.
For example if you want to access an ISA PnP sound card, you will need to compile sound as a module in the
kernel, and use isapnptools before loading the module.


Tip 7: Find hardware information



When the Linux system boots, it will try to detect the hardware installed in the computer. It will then make a
fake file system called procfs and will store important information about your system in it.
You can get information about your system simply by browsing the directory /proc. The files in there will
contain information such as the processor you have, the amount of memory and the file systems the kernel
currently supports.
A usefull application exists to browse the /proc file system. It is called Xproc and is available from
http://devplanet.fastethernet.net/files.html:

Tip 8: Blinking leds on the keyboard



Keyboard leds are pretty boring. Usualy you know if the num lock is on or if you are writing in upper case
letters. Could we make them do something more useful? Of course.
The keyboard leds can be controlled by a device driver called the misc driver. That driver can control all
kinds of misc things. You could write your own driver to make them blink or light up at any system event.
A program called tleds is available from http://www.hut.fi/~jlohikos/tleds.html. That program will have them
blink based on network usage. One will blink when packets go in, and the other when packets go out.


Tip 9: Reading a foreign file system



File systems are defined in the kernel. The kernel supports many file systems, but they need to be compiled
in, or compiled as a module. When you compile a file system in the kernel, all you need to do is use mount
with the -t option and the right file system type.
If you have compiled a driver for a file system as a module, then you need to load the module first.
Here are a few of the available file systems:
•??msdos: This is the FAT file system used by DOS.
•??vfat: This is the FAT32 file system used by Windows 95 and Windows 98.
•??ext2: This is the default Linux file system.
•??iso9660: This is the default CD-ROM format.


Tip 10: Can't mount root fs



When you boot a system, this is an error that will halt the system. This error means that the kernel can't
mount the root file system, so it can't get all of its configuration files.
There are a few cases where this happens:
•??No IDE support in the kernel. If your main hard drive is an IDE, and you have recompiled
without including "Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support" or some other
basic IDE device drivers.
•??File system not supported. Usually the root file system should be of type ext2. You need to
make sure that ext2 is compiled in the kernel, and not as a module because you can't load
modules without first mounting the root file system.
•??The drive is not ready. If you have removed the drive, the hard disk died or the BIOS didn't
detect the device for some reason, then the kernel won't be able to mount it.


Tip 11: Linux on a 286?



Linux is a multi-user, multitasking operating system which requires a 386 processor or more to run. This is
because the lower PC processors don't have what is needed for the Linux kernel.
Linux being open source, is being ported to many architectures. And one group decided to modify the kernel
so it would run on a 286 processor. The project page is http://www.uk.linux.org/ELKS-Home/index.html.


Tip 12: Linux without a hard drive



Modern Linux distributions require around 100 megs to 200 megs of hard disk space to install. But is it
possible to run Linux on a system without a hard drive? Yes it is.
The Linux Router Project is a full-featured Linux distribution that fits on one diskette. It was made for
routers, and use modules to add the software packages you need, including DNS servers, Web servers, email
and routing. You can find more information on the Linux Router Project at http://www.linuxrouter.org.


Tip 13: Shutdown and power off



Linux, like most other operating systems, must be shutdown in a specified manner. You can't turn the power
off on a computer running Linux, or you may lose some data.
Here are the steps that need to be done when you want to shutdown:
•??The operating system needs to stop all the running processes and logout the users.
•??Various servers need to be shutdown in a proper way.
•??All the mounted file systems need to be unmounted safely and unwritten data need to be stored
on the disk.
The system can then be turned off safely.
To accomplish all these tasks, the shutdown command exists. That command has a lot of options, and you
should explore them before trying anything at random. Another way to shutdown a Linux system is to set the
runlevel to 0, the default shutdown level, with the init program.


Tip 14: LPD started but no device found


The printer daemon is called LPD. It will be started at boot time and assume that a printer is connected to the
printer port. But a problem may occur when the daemon is started and no device is found.
The most common cause for this problem is a configuration problem in the kernel. Make sure that parallel
port, PC-style parallel port, and printer support is enabled in the configuration, and that modules are loaded.

Tip 15: Read files from FAT32 drives



The Linux utility mount can read any file system that the kernel supports. Since version 2.0.34, the kernel
supports FAT32, which is the main file system used by Windows 98.
To read the FAT32 file system you need to specify the -tvfat option to mount. Here is an example:
mount -tvfat /dev/hdb1 /mnt


Tip 16: TV on Linux



A number of cards exist allowing you to watch and record TV on your PC. Most come with software for
Windows only, like so many things, but it is possible to do the same thing on Linux.
Linux comes with several drivers which make up the Video4Linux drivers. Several cards are supported by
these drivers, and a list of them is available at http://roadrunner.swansea.linux.org.uk/v4l.shtml. This is the
driver side. You also need software to use the devices.
Several programs are available to watch TV, capture images and even Web applications. A list of some of the
programs is available at http://www.thp.uni-koeln.de/~rjkm/linux/bttv.html including datasheets.


Tip 17: Device drivers



Hardware devices are not of much use without device drivers. Fortunately, the Linux kernel, like every other
operating system, comes with a lot of them.
When you configure a kernel, the menu from which you must choose which devices you have in your
computer is actually a list of device drivers available to you. Here is how to configure your kernel:
cd /usr/src/linux
make menuconfig
Linux, still not being as popular as some other operating systems, can't support all of the existing hardware.
If you have a device that is not in the list, then you will need to search for it on the Web. Some drivers may
exist for Linux and not be in the default kernel. But if a device is not currently supported by any driver for
Linux, then you will have to wait for someone to make one, or make one yourself.
If you want to write your own driver, the best place to start is at The Kernel Hacker's Guide, available at
http://khg.redhat.com/HyperNews/get/khg.html


Tip 18: Mouse problems



The mouse is a very important part of a computer. In X, you can't do much without it. Even in console some
applications will allow you to use it. You must first configure it.
Like every other device, the mouse has a device file in the /dev directory. Depending on your mouse type, it
will be either /dev/psaux for a PS/2 mouse, or /dev/cua0 for a serial mouse on COM1.
To make it easy to use in the future, you should link the right device file to /dev/mouse:
ln -s /dev/cua0 /dev/mouse
Then, when you configure X Window or any other program that requires a mouse, you can specify
/dev/mouse.


Tip 19: International keyboards



The X Window System comes by default with an english keymap on most distributions. If you have a
keyboard from another country, it may be a problem.
The XKB extension was provided for that purpose. If you look in your X configuration file, usualy in
/etc/X11 called XF86Config, you will find a section about the keyboard. There, you may specify several
parameters, including the keymap and keycodes to use.
For a list of available keymaps, you can look in your X directory. Most of those keymaps are also available
from the graphical configuration program, XF86Setup.

No comments:

Post a Comment