Tesseract home

Work in progress - Not Complete!!

You may have to debug Linux boxen or your own driver. Here are some notes on where you might want to take a look in order to assess what is running on the system in question.

Where to look for Linux drivers on a running system: Where are all the files?

The loadable modules (typically, .o files) are located in directory /lib/modules/<kernelVersion>/kernel/drivers on (for example) a typical RedHat distribution. <kernelVersion> will follow the release of the Linux kernel you are using. For example, if you are running version 2.4.18-3 (I think this is RedHat 7.2), your driver directory will be
/lib/modules/2.4.18-3/kernel/drivers
So if you enter the following at a shell:
#ls /lib/modules/2.4.18-3/kernel/drivers
You will see a list of directories as follows:
addon/      cdrom/   ide/       md/       net/      sensors/    video/
atm/        char/    ieee1394/  media/    parport/  sound/
block/      crypto/  input/     message/  pcmcia/   telephony/
bluetooth/  i2c/     isdn/      misc/     scsi/     usb/
Each directory is named by general type. Some types are fairly specific such as bluetooth/. Others are certainly catchalls, such as misc/. You (may) have more directories and functionality available in drivers directory than you are using. For example, if you do not have any IEEE 1394 video interface in your system, you will probably not need modules in ieee1394/ path.
Incidentally, I think that organization of the drivers in the directories tends to be a bit chaotic. I am working with an excellent digital frame capture card that installs its drivers in the misc/ directory, even though I kind of think it belongs in video/. Go figure.

Where to look for Linux drivers on a running system: Say, what's running on my system?

Look at the contents of file /proc/modules.
Entering this at the shell prompt:
  #cat /proc/modules
or this (equivalent and) handy utilty:
  #lsmod
(as in, presumably, 'list module') will produce output that looks like this:
sr_mod                 16920   0 (autoclean)
cdrom                  32192   0 (autoclean) [sr_mod]
edt                    72500   0 (unused)
binfmt_misc             7556   1
parport_pc             18724   1 (autoclean)
lp                      8864   0 (autoclean)
parport                34208   1 (autoclean) [parport_pc lp]
autofs                 12164   0 (autoclean) (unused)
eepro100               20336   1
sb                      9152   1
sb_lib                 40416   0 [sb]
uart401                 7936   0 [sb_lib]
sound                  72012   1 [sb_lib uart401]
soundcore               6692   5 [sb_lib sound]
usb-uhci               24484   0 (unused)
usbcore                73152   1 [usb-uhci]
ext3                   67136   7
jbd                    49400   7 [ext3]
aic7xxx               124768   8
sd_mod                 12864  16
scsi_mod              108576   3 [sr_mod aic7xxx sd_mod]
The first column indicates the name of the driver (minus the typical ".o").
Each entry directly corresonds to a loadable module enumerated somewhere on the available filesystems.
The second column indicates the running module size.
Q:code or data size??
The third column indicates the reference count of the module.
'[]' indicates a list of dependencies when using stacked modules.

Miscellany

Take a look (again, this is from a RedHat system..) under /etc/sysconfig/ for some possible items related to system configuration. Some devices installation scripts and subsystems have content in this directory related to device configuration. Your mileage may vary, but when investiging these things, this might be handy info.

How modules/device drivers are loaded into a typical Linux distribution

depmode :
modules.dep file :