Installing the Linux device driver


This information applies to Linux 2.0.x kernels only. For certain, some changes need to be made for 2.1.x kernels (mainly in the userspace to kernel space memory copying).

  1. First, you need the Linux kernel source and the Radio Card driver distribution.

    Uncompress your linux kernel source. The best (and most popular) place it is in /usr/src.

  2. Un-gz and un-tar the driver distribution. Uncompress them anywhere, and move the file radio.c to your /usr/src/linux/drivers/char directory, and the file radio.h in the /usr/src/linux/include/linux directory.

  3. Edit the file /usr/src/linux/drivers/char/Config.in. This file tells linux what to ask when you do a make config. You need to tell the kernel makefile to ask about the radio card.

    Add the following near the end of this file (just before the endmenu ):

    tristate 'Aztech/Packard Bell FM Radio Card support' CONFIG_AZRADIO

  4. Edit the file /usr/src/linux/drivers/char/Makefile. This is the Makefile for all of the character device drivers. By adding the radio driver to this file, you ensure that the driver will actually be compiled and linked into the kernel, or that a loadable module will be properly generated.

    Add the following to the file. Place it somewhere where it looks like it should go. Traditionally, I place it right after the endif closing off the FTAPE block, but it could go anywhere in that section:
      ifeq ($(CONFIG_AZRADIO),y)
      L_OBJS += radio.o
      else
        ifeq ($(CONFIG_AZRADIO),m)
        M_OBJS += radio.o
        endif
      endif

  5. Edit the file mem.c. This file contains a function that is called by the kernel when booting. Placing the initialization function in this file makes the kernel initialize the card at boot.

    Add the following to the end of the file, but before the return 0; :

      #ifdef  CONFIG_AZRADIO
              radio_init ();
      #endif

  6. Finally, edit the file /usr/src/linux/include/linux/major.h. Look for an unused major number. We use 39, for reasons I don't remember. If you choose to use this number (if it's not used by something else, go ahead), add this line where number 39 would go:

    #define AZRADIO_MAJOR    39

  7. That's almost everything! At this point you should try compiling your kernel (make config, make xconfig, etc.). If it gives no errors, install your new kernel and reboot.

  8. Now, you've rebooted and all is well. Go to your /dev directory, and create a special file for the radiocard. If you used major number 39, use the following command:

    mknod radiocard c 39 0

  9. You should now be able to tune your radio card by something similar to the following:

    echo 106.1 > /dev/radiocard
    As you probably guessed, this tunes the card to 106.1 MHz. Use a similar command to tune your favorite station. You can use + to increase the volume and - to decrease it. If you are really inspired by this, maybe you could code a decent client!


Back to The Packard Bell/Aztech FM Radio Card
jlewis@vtc.vsc.edu
My PGP Public Key