Configuring a Kernel for USB Support

General

Apcupsd version 3.9.x (development version to be released as 3.10.1) provides support for USB UPSes on Linux systems. However at this time (August 2001) Linux kernels do not yet support the HIDDEV device that is used by apcupsd. If 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 apcupsd.

For kernel 2.4.5, you need patch ac12 or later. For later versions of the kernel, any ac patch should work.

Downloading

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. You can obtain the 2.4 kernels from: http://www.kernel.org/pub/linux/kernel/v2.4/.

You can obtain the Allen Cox patches from: http://www.kernel.org/pub/linux/kernel/people/alan/2.4/

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 rpm, then skip the first two steps in the next section.

Building the Kernel

I provide here only a very brief explanation of the steps necessary to build your kernel.
 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

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 install

21. make modules_install

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

23. 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.

24. cd /etc

25. lilo -v

26. reboot

27. Ensure that uhci and hid are loaded by
    doing cat /proc/modules
        
        If not, load them by hand.
        
        modprobe uhci
        modprobe hid

Disclaimer

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.