A Multimedia Tutorial For FreeBSD
As I have spent more and more time checking out the Linux and Unix forums on this site, I have realized the volume of dedicated Unix enthusiasts. Realizing not many articles on Exam Notes apply directly to them, I have decided to dedicate an entire article to FreeBSD, which is a Unix derivative developed at the Berkley Campus of the University of California.
In the old days, FreeBSD didn’t offer much along the lines of Sound support but that has all changed. FreeBSD now can provide sound and multimedia support as good as, or better than, and Windows system. In this article, I’m going to explain how you can:
· Set up the kernel for multimedia support
· Set device nodes
· Learn to use multimedia applications
· Rip CD’s using FreeBSD
Sound Card Support
Chances are really good that if you have a common sound card, FreeBSD will support it. In order to check to see if your sound card is supported and if there is a PCM driver loaded you need to search through your Kernel configuration file to find a line that says:
device pcm
If you are able to find that line it means that sound support is already configured in your FreeBSD kernel. If you don’t see the line, don’t panic! If you were to see this line it would mean that you have been working ahead and had already configured your own custom FreeBSD kernel. I didn’t expect you to be able to find the line at this time – but I wanted to save those who had been working ahead a few steps.
In order to add sound to your FreeBSD kernel, you will need to type the following at the command prompt:
$ cd /usr/src/sys/i386/conf
By typing that entry at the command prompt you are telling FreeBSD that you want to change to the directory where the Kernel Configuration files are kept.
After arriving in this directory, logout and log back in as Root. After logging back in as Root, you need to copy the GENERIC file in this directory to a new file that you have named. In this instance, we are going to copy the GENERIC File to a file called SOUNDKERN. In order to copy GENERIC to SOUNDKERN, you need to type the following at the command prompt:
# cp GENERIC SOUNDKERN
If you are familiar with copying files through Windows or DOS, you will know that when you copy a file it appears in the new location, and also in the old location. Therefore, your new file called SOUNDKERN will be a carbon copy of GENERIC. You will want to look in your new SOUNDKERN file, for a file named LINT. LINT contains drivers for sound cards, along with other files that we won’t be discussing at this time.
When you locate the LINT file, you will find two different sets of drivers for soundcards:
· Voxware
· PCM
Voxware drivers – These drivers are very old, and work better with older sound cards that may not be supported by PCM. Beginning in FreeBSD 5.0, Voxware drivers will no longer be supported by FreeBSD.
PCM drivers – These drivers are newer drivers for use with FreeBSD and support most newer sound cards.
PCM Sound Card Drivers
As we have discussed, PCM sound card drivers support most newer sound cards. In order to install the PCM sound card drivers and set up your new SOUNDKERN file, you need to type the following command at the command prompt:
# device PCM
You will now need to copy the sound files from the LINT file to the very end of your new SOUNDKERN file, and save. Then, in order to build and install your new kernel, you will need to enter a series of commands at the command prompt. Since you have already logged on as Root while in the /usr/src/sys/i386/conf directory, you should have no problems with this.
At the command prompt in this directory you need to type config SOUNDKERN, for example:
/usr/src/sys/i386/conf # config SOUNDKERN
After typing this command, you are going to want to change to the SOUNDKERN directory in order to compile it. To do this, you need to type cd ../..compile/SOUNDKERN at the command prompt. For example:
/usr/src/sys/i386/conf # cd…/…/compile/SOUNDKERN
You should now find yourself in the /usr/src/sys/compile/SOUNDKERN directory. At this point, it is time to build the new kernel. In order to create the new kernel, you need to tell FreeBSD that you want to make and install the new Kernel. In order to do this, you need to type the following commands at the command line:
/usr/src/sys/i386/compile/SOUNDKERN # make depend
/usr/src/sys/compile/SOUNDKERN # make
/usr/src/sys/compile/SOUNDKERN # make install
Now, for those of you who are used to Windows, you know that whenever you install a new program or make big changes to the system, in order for them to take effect you have to reboot your machine. FreeBSD is the same way when compiling a new kernel. In order to tell FreeBSD to reboot, you need to type the following line at the command prompt:
/usr/src/sys/compile/SOUNDKERN # /sbin/reboot
FreeBSD will now begin the process of creating the new kernel that you have just configured! This can take anywhere from 10-30 minutes, depending upon the speed of your system. After the kernel has been created, you system will reboot. Upon rebooting, you will need to set up device nodes.
Device Nodes
Now that you have created your new kernel, and rebooted your computer you need to login as Root. You should now use the dmesg command in order to see if your sound card has been detected. For example:
# dmesg | grep pcm
After pressing enter, all PCM devices should be listed on your screen. If you do not see any PCM devices listed, you need to reconfigure SOUNDKERN so that the right device shows up.
If your listed PCM device ends in 0, you need to enter the following commands at the command prompt:
# cd /dev
# sh MAKEDEV snd 0
If your listed PCM device ends in 1, you need to type the following commands at the command prompt:
# cd /dev
# sh MAKEDEV snd1
These commands will not create a PCM device, but they do create device nodes! The MAKEDEV device nodes are explained in Table 1.1.
Table 1.1
MAKEDEV Device Nodes and Related Devices
| MAKEDEV
Device Nodes |
Device
related |
| /dev/audio |
SPARC
audio |
| /dev/dsp |
Digital
Voice |
| /dev/dspW |
16-bit
digital voice |
| /dev/midi |
Raw
midi |
| /dev/mixer |
Control
Port Mixer |
| /dev/music |
Level
2 sequencer |
| /dev/sequencer |
Sequencer |
| /dev/pss |
Programmable
device |
|