old-www/HOWTO/Linmodem-HOWTO-4.html

136 lines
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Linmodem-HOWTO : Tips and Tricks for Precompiled Modules with different Kernel Versions </TITLE>
<LINK HREF="Linmodem-HOWTO-5.html" REL=next>
<LINK HREF="Linmodem-HOWTO-3.html" REL=previous>
<LINK HREF="Linmodem-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Linmodem-HOWTO-5.html">Next</A>
<A HREF="Linmodem-HOWTO-3.html">Previous</A>
<A HREF="Linmodem-HOWTO.html#toc4">Contents</A>
<HR>
<H2><A NAME="s4">4. Tips and Tricks for Precompiled Modules with different Kernel Versions </A></H2>
<P>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.
<P>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,
<P>"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 <EM>very</EM> bad."
<P>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.
<P>
<H2><A NAME="ss4.1">4.1 Fixscripting</A>
</H2>
<P>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
<CODE>insmod</CODE> <EM>module_name</EM>. Later versions also rename module symbols
to match those exported by the kernel, so that "Unresolved symbols" errors
are not returned by the test <CODE>depmod -e</CODE>. It must be emphasized that this
change is almost entirely cosmetic - it is still recommended that the module be used
minimally.
<P>To use the fixscript on, for example, the (now-deprecated) binary Lucent module ltmodem.o,
make a working directory such as <CODE>/root/modem</CODE>.
Obtain the latest fixscript from
<A HREF="http://www.test.dclabs.com.au/linmodem/fixscript">http://www.test.dclabs.com.au/linmodem/fixscript</A>.
Save the file as <CODE>fixscript</CODE>.
View it with <CODE>less</CODE> 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 <CODE>more</CODE> does NOT display these DOS newlines.
<P>Make the
file executable with <CODE>chmod +x fixscript</CODE>.
Generate a "fixed" module with, i.e.,
<PRE>
./fixscript ltmodem.o ltmodem2217.o
</PRE>
<P>No errors should be generated by testing the module dependencies with
<PRE>
depmod -e ltmodem2217.o
</PRE>
<P>and insertion should succeed with a simple, non-forced,
<PRE>
insmod ltmodem2217.o
</PRE>
<P>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 <EM>not</EM> compensate for any actual changes to the kernel interface.
<P>
<P>
<P>
<H2><A NAME="ss4.2">4.2 Patching <CODE>tty.h</CODE></A>
</H2>
<P>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.
<P>The patched 2.2.17 <CODE>tty.h</CODE> and some 2.2.17 kernel packages compiled
with this patch are available from
<A HREF="http://walbran.org/sean/linux/stodolsk/">http://walbran.org/sean/linux/stodolsk/</A>.
If you want to do the edit yourself, the line to shift is in the structure
<CODE>tty_struct</CODE> within <CODE>include/linux/tty.h</CODE>; it has an extra member
<CODE>poll_wait</CODE> 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.
<P>
<P>
<H2><A NAME="ss4.3">4.3 Using a <CODE>ppp.o</CODE> from Kernel 2.2.14</A>
</H2>
<P>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 <CODE>tty.h</CODE> patch described above, this trick is no longer necessary nor
recommended. The trick is to
replace the <CODE>/lib/modules/net/ppp.o</CODE> 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:
<PRE>
insmod slhc
</PRE>
the mismatched ppp.o from 2.2.14 source is inserted
<PRE>
insmod -f ppp.o
</PRE>
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 <CODE>tty.h</CODE>, as described above.
<P>
<P>
<HR>
<A HREF="Linmodem-HOWTO-5.html">Next</A>
<A HREF="Linmodem-HOWTO-3.html">Previous</A>
<A HREF="Linmodem-HOWTO.html#toc4">Contents</A>
</BODY>
</HTML>