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.
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.
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
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
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
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
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.
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
You should now be able to tune your radio card by something similar to the
following:
echo 106.1 > /dev/radiocardAs 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!