Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > 23fcd86b8f6bdf6d1463505ad3db7b3b > files > 266

apcupsd-3.10.18-3.1.20060mdk.x86_64.rpm

<!doctype html public "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
   <title>Configuring a Kernel for USB Support</title>
   <meta name="Author" content="Kern Sibbald">
   <link rel=stylesheet href="apcupsd-styles.css" type="text/css">
</head>
<body>
<h1>Configuring a Kernel for USB Support</h1>
Note, this chapter is somewhat out of date as the kernel has evolved
quite a bit in the last year and a half. In fact, you should not
have to venture into building your own kernel unless your OS provider
is seriously behind the times. With that said, there is still much
valuable information here that you can use if you must build your
own system.

<h2>General</h2>
Apcupsd version 3.10.5 provides support for USB UPSes on Linux systems.
However at this time (February 2003) Linux kernels do not yet
support the HIDDEV device that is used by <b>apcupsd</b>.
If you are running a release such as RedHat 7.3 or 8.0,
the kernels generally come preconfigured with all the
necessary patches.  If you are not so fortunate but
you have a kernel version 2.4.5 or later and you
apply the appropriate Alan Cox patch, you will be able
to enable USB support in <b>apcupsd</b>.  
<p></p>For kernel 2.4.5, you need patch <b>ac12</b> or
later. For later versions of the kernel, any <b>ac</b>
patch should work. Please be sure to obtain either the
latest kernel or the one shipped with your system. We
use version 2.4.5 for illustration purposes and do not
recommend that you downgrade to it.
<h2>Downloading</h2>
New kernel versions are released and an amazing
speed, so by the time you read this, the current
stable kernel will no longer be 2.4.5 and you should 
obtain the version that corresponds to current usage or
to what you already have on your system.
You can obtain the 2.4 kernels from: 
<a href="http://www.kernel.org/pub/linux/kernel/v2.4/">http://www.kernel.org/pub/linux/kernel/v2.4/</a>.
<p></p>You can obtain the Allen Cox patches from:
<a href="http://www.kernel.org/pub/linux/kernel/people/alan/2.4/">http://www.kernel.org/pub/linux/kernel/people/alan/2.4/</a>
<p>
Alternatively, you can obtain the latest kernel source from your
favorite vendor. For example, for RedHat, you would
obtain: kernel-source-2.4.x.rpm
and install it with <b>rpm</b>, then skip the
first two steps in the next section.

<h2>Building the Kernel</h2>
I provide here only a very brief explanation of the steps
necessary to build your kernel.  If you have a later
kernel such as RedHat 7.3 (kernel 2.4.18-5), you don't
need to rebuild it. If you want to anyway, you can install
the <b>kernel-source</b> rpm, cd to the appropriate
directory (usually <b>/usr/src/linux-2.4</b>), then skip immediately to
step 11 below.
<pre>
 1. Download kernel from:
    http://www.kernel.org/pub/linux/kernel/v2.4/
    (I assume you get linux-2.4.5.tar.gz and that
     you put it into /usr/src)

 2. Download Alan Cox patch from:
    http://www.kernel.org/pub/linux/kernel/people/alan/2.4/
    (I assume you get patch-2.4.5-ac12.gz and that you
     put it into /usr/src)

 3. su root

 4. cd /usr/src

 5. Ensure that the directory linux does not exist,
    or if it is linked, remove the link or change the
    name.

 6. Unpack the kernel with:

    tar xvfz linux-2.4.5.tar.gz                 

 7. Unpack the patch with:

    gunzip patch-2.4.5-ac12.gz

 8. Move the kernel source into a different directory:

    mv linux linux-2.4.5
        
        or
        
        mv linux linux-2.4.5-ac12
 
 9. cd linux-2.4.5

10. Apply the patch with:

    patch -p1 <../patch-2.4.5-ac12

    There should be no errors.

11. make mrproper

12. Find a valid configuration file, and
    make sure it has the following configuration
        statements. If not, please add them:
        
    CONFIG_USB=m
    CONFIG_USB_LONG_TIMEOUT=y
    CONFIG_USB_LARGE_CONFIG=y
    CONFIG_USB_HID=m
    CONFIG_USB_HIDDEV=m

    Note, the CONFIG_USB_LARGE_CONFIG does not seem to be present
    in some of the later kernels (e.g. 2.4.18)

    Note, apparently in later kernels the CONFIG_USB_HIDDEV should
    be set to CONFIG_USB_HIDDEV=y (at least our users report this,
    I suspect it may depend on the setting you use for CONFIG_USB, in
    any case, please note to get this stright).

13. make menuconfig  or   make xconfig (if you are running X)
    load a valid configuration file
    check the above values and ensure they are correct
    save config

14. Check what you saved by editing .config
    You can skip this if you have done kernel builds
        before.

15. make dep

16. make clean

17. make bzImage

18. make modules

19. make modules_install

20. make install

21. If you boot from a SCSI, you will need to make a
    new initrd image

22. Update /etc/lilo.conf to include the new kernel.
    If you are using grub, edit the /boot/grub config
    file and skip steps 24 and 25.

23. cd /etc  (skip this if you are using grub)

24. lilo -v  (skip this if you are using grub) 

25. reboot

26. Ensure that uhci and hid are loaded by
    doing <b>cat /proc/modules</b>
        
        If not, load them by hand.
        
        modprobe uhci
        modprobe hid
</pre>

<h3>Build Problems</h3>
If you start with the RedHat <b>kernel-source</b> package as
I did and use one of their config files in <b>configs</b> as I
did, you are very likely to get a number of undefined symbols
when making or installing the modules. In this case, I found that
I can simply edit <b>.config</b> with my favorite editor, comment
out modules that don't build (knowing which ones is not always
obvious from the names), then simply <b>make modules</b> and
<b>make modules_install</b> until all the problems go away.
Once the module build and install is correct,
I recommend doing <b>make bzImage</b> and <b>make install</b>
again.                                 

<h3>Disclaimer</h3>
I'm not at all a kernel expert so you are pretty much
on your own here. Any corrections to these instructions
would be welcome.
<hr>

<a href="snmp.html" target="_self"><img src="back.gif" border=0 alt="Back"></a>
<a href="win32.html" target="_self"><img src="next.gif" border=0 alt="Next"></a>
<a href="index.html"><img src="home.gif" border=0 alt="Home"></a>
</body>
</html>