(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

4. Tips and Tricks for Precompiled Modules with different Kernel Versions

Many of the linmodem drivers are only available as precompiled, binary kernel modules. Generally, modules/binaries transparently function only with the kernel against which they were co-compiled. Therefore, getting a precompiled linmodem driver to work with your particular kernel could be a challenge.

Since the Linux kernel is a dynamically changing beast, it is very unfortunate that many modem/chip vendors have not yet chosen to release source-code versions of their drivers, which would ensure your and our ability to modify these drivers appropriately as kernel source code evolves. Some of the binary modules have been coaxed to function under some later kernel versions using various tricks, as described below; however, even though a module may be rendered functional, it is advisable to use them minimally. Quoting an email from Mark Spieth,

"A driver can never work properly if there are unresolved symbols, as it means something is not going to work. Furthermore, it means that that something that would have been called will call something else in the kernel and this could be anything. This is very bad."

Therefore, you should be careful in using binary modules with a kernel of a different version; proceed at your own risk. If you require above all that your modem function, consider downgrading your kernel to match the module - this is by no means a ridiculous prospect. Despite these warnings, however, many others have used mismatched binary modules and kernels with only minor annoyances ( such as the occasional kernel panic ) using tricks and tools such as the following.

4.1 Fixscripting

Mark Spieth has contributed a progressively improved series of "fixscripts" for editing a binary module so that version mismatch warnings are eliminated. Insertion of the "fixed" module then proceeds without the forcing flag, i.e. simply insmod module_name. Later versions also rename module symbols to match those exported by the kernel, so that "Unresolved symbols" errors are not returned by the test depmod -e. It must be emphasized that this change is almost entirely cosmetic - it is still recommended that the module be used minimally.

To use the fixscript on, for example, the (now-deprecated) binary Lucent module ltmodem.o, make a working directory such as /root/modem. Obtain the latest fixscript from http://www.test.dclabs.com.au/linmodem/fixscript. Save the file as fixscript. View it with less or your favorite text editor to check that DOS hard stops were not accidentally acquired. They look like bold M, underlined M, or ^M depending upon your viewer/editor. NOTE: the viewer more does NOT display these DOS newlines.

Make the file executable with chmod +x fixscript. Generate a "fixed" module with, i.e.,

    ./fixscript ltmodem.o ltmodem2217.o

No errors should be generated by testing the module dependencies with

    depmod -e ltmodem2217.o

and insertion should succeed with a simple, non-forced,

    insmod ltmodem2217.o

The "source code" supplied with some PCTel modules (a small C file) performs similar masquerading when compiled and linked with the binary libraries in those packages; unlike the partially-open-source Lucent driver, it does not compensate for any actual changes to the kernel interface.

4.2 Patching tty.h

In his quest to get the original, binary-only Lucent LT modem driver (version 5.68) working with kernels later than 2.2.14, Mark Spieth noticed that one simple change in the Linux kernel source fixed the major incompatibilities incurred between the 2.2.14 to 2.2.16 kernel versions. This patch is no longer necessary when using the partial source/binary Lucent driver (version 5.78), but it remains useful for those with other modems whose drivers are compiled against pre-2.2.15 kernels.

The patched 2.2.17 tty.h and some 2.2.17 kernel packages compiled with this patch are available from http://walbran.org/sean/linux/stodolsk/. If you want to do the edit yourself, the line to shift is in the structure tty_struct within include/linux/tty.h; it has an extra member poll_wait in later kernels. Move this member to the bottom of the structure, so that the remaining offsets will then be the same as those in versions earlier than 2.2.15, and thus be compatible with the precompiled kernel module. You will need to recompile your kernel and modules after making this change to the source.

4.3 Using a ppp.o from Kernel 2.2.14

A trick exists for using the binary modules with kernels later than 2.2.15 which does not require kernel recompilation; however, following the discovery of the tty.h patch described above, this trick is no longer necessary nor recommended. The trick is to replace the /lib/modules/net/ppp.o module with one from kernel 2.2.14. Christoph Hebeisen (cth(at)sfu.ca) reported that the use of ppp.o version 2.2.14 rather than that of version 2.2.16 with the Lucent module provided functionality under 2.2.16 kernels. Willie Green (willjr(at)lcc.net) confirmed that this trick works also with the ESS module. After simple insertion of a supporting version-matched module:

    insmod slhc
the mismatched ppp.o from 2.2.14 source is inserted
    insmod -f ppp.o 
We wish to emphasize that this trick with forced insertion is less stable than the easy and more effective change to the kernel source file tty.h, as described above.


Next Previous Contents