Previous Next Contents

4. Installation

Installation of a CD-ROM under Linux consists of these steps:

  1. Installing the hardware.
  2. Configuring and building the Linux kernel.
  3. Creating device files and setting boot time parameters
  4. Booting the Linux kernel.
  5. Mounting the media.

The next sections will cover each of these steps in detail.

4.1 Installing the Hardware

Follow the manufacturer's instructions for installing the hardware or have your dealer perform the installation. The details will vary depending on whether the drive is internal or external and on the type of interface used. There are no special installation requirements for Linux. You may need to set jumpers on the drive and/or interface card for correct operation; some of the kernel drivers include README files that include this information.

As explained in the file ide-cd, ATAPI CD-ROMS should be jumpered as "single" or "master", and not "slave" when only one IDE device is attached to an interface (although this restriction is no longer enforced with recent kernels).

4.2 Configuring and Building the Kernel

When initially installing Linux from CD-ROM you will likely be using a boot and/or root disk provided as part of a Linux distribution. If possible, you should choose a boot disk with the kernel driver for your CD-ROM device type. If you cannot find a boot disk with the necessary CD-ROM driver, you have several options:

  1. Install over a network
  2. Boot DOS, and install the Linux files onto your hard disk
  3. Boot DOS, and create a set of floppies to install Linux
  4. Find someone who can build you a boot disk with the needed CD-ROM driver

The Linux Installation HOWTO has more information on installing Linux. If you purchased Linux on CD-ROM, it likely also came with some installation instructions (that little booklet inside the jewel case, and/or files on the CD).

Once Linux has initially been installed, most users will want to compile their own kernel, usually for one of these reasons:

The Linux Kernel HOWTO should be consulted for the details of building a kernel. I will just mention here some issues that are specific to CD-ROM drives.

Obviously, you need to compile in support for your CD-ROM drive when you do a "make config".

If you have an ATAPI CD-ROM drive, you need to answer yes to the questions:

Enhanced IDE/MFM/RLL disk/cdrom/tape support (CONFIG_BLK_DEV_IDE) [Y/n/?]
Include IDE/ATAPI CDROM support (CONFIG_BLK_DEV_IDECD) [Y/n/?]

For SCSI CD-ROM drives, enable these options:

SCSI support (CONFIG_SCSI) [Y/n/m/?]
SCSI CD-ROM support (CONFIG_BLK_DEV_SR) [Y/n/m/?]

Also enable support for your SCSI host adaptor when prompted, e.g.

Adaptec AHA152X support (CONFIG_SCSI_AHA152X) [Y/n/m/?]

For proprietary interface CD-ROM drives, enable the appropriate driver. You can use the table listed previously to determine the driver to use for your model.

Virtually all CD-ROMs use the ISO-9660 file system, so you must also enable:

ISO9660 cdrom filesystem support (CONFIG_ISO9660_FS) [Y/n/m/?]

Although not needed for CD-ROM operation, if you have a sound card that is supported under Linux you might want to enable and configure the kernel sound driver at this time as well. The Sound HOWTO can be a useful reference here.

You should then follow the usual procedure for building the kernel and installing it. Don't boot with the new kernel until you create the device files and set up any boot time parameters as described in the next section.

The ISO-9660 filesystem and almost all of the CD-ROM drivers can be built as loadable kernel modules. This scheme allows the kernel drivers to be loaded and unloaded without rebooting the kernel, freeing up memory. I recommend you get your CD-ROM installation running using compiled-in drivers first. How to use modules is described in the modules documentation and the Kernel HOWTO.

If a drive type listed here is not supported by your kernel, you likely need to upgrade to a newer version.

It is possible that you need to use a driver that is distributed separately from the kernel source code. This usually involves patching the kernel. Again, the Kernel HOWTO explains how to do this.

Note that there is a menu-based kernel configuration program invoked by "make menuconfig" and an X11-based graphical configuration invoked as "make xconfig". All three configuration methods offer on-line help.

4.3 Creating Device Files and Setting Boot Time Parameters

The kernel uses device files to identify which device driver to use. If you are running a standard Linux distribution you may have created the necessary device files during installation. Under Slackware Linux, for example, there is a menu-based setup tool that includes CD-ROM setup, and most systems have a /dev/MAKEDEV script. If you don't use these methods, you can use the more manual procedure listed in this section. Even if you use either of these methods, it is recommended that you at least verify the device files against the information in this section.

You create the device file by running the shell commands indicated for your drive type. This should be done as user root. Note that some Linux distributions may use slightly different CD-ROM device names from those listed here.

It is recommended that you also create a symbolic link to the CD-ROM device to make it easier to remember. For example, for an IDE CD-ROM drive that is the second device on the secondary interface, the link would be created using

# ln -s /dev/hdd /dev/cdrom

If you want to play audio CDs, you will need to set the protection on the device file (the real file, not the symbolic link to it) to allow all users to read, e.g.

# chmod 664 /dev/hdd
# ls -l /dev/hdc
brw-rw-r--   1 root     disk      22,   0 Feb  4  1995 /dev/hdd

When booting Linux, the device drivers attempt to determine whether the appropriate devices are present, typically by probing specific addresses. Many of the drivers auto-probe at several addresses, but because of differences in configuration, possible device conflicts, and hardware limitations, the drivers sometimes need help identifying the addresses and other parameters. Most drivers support an option on the kernel command line to pass this information to the device driver. This can be done interactively, or more commonly, configured into your boot loader. With LILO, for example, you would add an append command such as the following to your /etc/lilo.conf file:

append = "sbpcd=0x230,SoundBlaster"

See the LILO documentation for more information.

In the next section I discuss issues specific to individual device drivers, including device files, boot parameters, and the capabilities of the different drivers. You probably only need to read the section relevant to your drive type. The README files are usually found in the directory /usr/src/linux/Documentation/cdrom.

Sbpcd Driver

       Principal author: Eberhard Moenkeberg (emoenke@gwdg.de)
  Multi-session support: yes (but not all drives)
 Multiple drive support: yes
Loadable module support: yes
   Reading audio frames: yes (CR-562, CR-563, CD-200 only)
           Auto-probing: yes
            Device file: /dev/sbpcd, major 25
     Configuration file: sbpcd.h
   Kernel config option: Matsushita/Panasonic CDROM support?
            README file: sbpcd

This driver accepts a kernel command line of the form:

sbpcd=<io-address>,<interface-type>

where the first parameter is the base address of the device (e.g. 0x230), and <interface-type> is one of "SoundBlaster", "LaserMate", or "SPEA". See the file sbpcd.h for hints on what interface type to use. Using sbpcd=0 disables auto-probing, disabling the driver.

The device file can be created using:

# mknod /dev/sbpcd b 25 0

Up to four drives per controller are supported. The next three drives on the first controller would use minor device numbers 1 through 3. If you have more than one controller, create devices with major numbers 26, 27, and 28, up to a maximum of 4 controllers (this is 16 CD-ROM drives in total; hopefully enough for most users :-).

See the file sbpcd for more information on this driver.

If you recently bought a CD-ROM drive, don't assume that if it connects to a SoundBlaster card it should use this kernel driver. Most CD-ROM drives being sold by Creative Labs are now EIDE/ATAPI drives. Please don't bug the author with questions about using this driver with IDE drives. I quote from the README file:

sbpcd really, really is NOT for ANY IDE/ATAPI drive!
Not even if you have an "original" SoundBlaster card with an IDE interface!
So, you better have a look into README.ide if your port address is 0x1F0,
0x170, 0x1E8, 0x168 or similar.
I get tons of mails from IDE/ATAPI drive users - I really can't continue
any more to answer them all. So, if your drive/interface information sheets
mention "IDE" (primary, secondary, tertiary, quaternary) and the DOS driver
invoking line within your CONFIG.SYS is using an address below 0x230:
DON'T ROB MY LAST NERVE - jumper your interface to address 0x170 and IRQ 15
(that is the "secondary IDE" configuration), set your drive to "master" and
use ide-cd as your driver. If you do not have a second IDE hard disk, use the
LILO commands
   hdb=noprobe hdc=cdrom
and get lucky.
To make it fully clear to you: if you mail me about IDE/ATAPI drive problems,
my answer is above, and I simply will discard your mail, hoping to stop the
flood and to find time to lead my 12-years old son towards happy computing.

Sonycdu535 Driver

       Principal author: Ken Pizzini (ken@halcyon.com)
  Multi-session support: no
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/sonycd535, major 24
     Configuration file: sonycd535.h
   Kernel config option: Sony CDU535 CDROM support?
            README file: sonycd535

This driver accepts a kernel command line of the form:

sonycd535=<io-address>

where <io-address> is the base address of the controller (e.g. 0x320). Alternatively you can set the address in the file sonycd535.h and compile it in.

The device file can be created using:

# mknod /dev/sonycd535 b 24 0

Some Linux distributions use /dev/sonycd for this device. Older versions of the driver used major device number 21; make sure your device file is correct.

This driver was previously distributed as a patch but is now part of the standard kernel. See the file sonycd535 for more information on this driver.

Cdu31a Driver

       Principal author: Corey Minyard (minyard@-rch.cirr.com)
  Multi-session support: yes
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: yes
           Auto-probing: no
            Device file: /dev/cdu31a, major 15
     Configuration file: cdu31a.h
   Kernel config option: Sony CDU31A/CDU33A CDROM support?
            README file: cdu31a

This driver accepts a kernel command line of the form:

cdu31a=<io-address>,<interrupt>,PAS

The first number is the I/O base address of the card (e.g. 0x340). The second is the interrupt number to use (0 means to use polled i/o). The optional third parameter should be "PAS" if the drive is connected to a Pro-Audio Spectrum 16 sound card, otherwise left blank.

The device file can be created using:

# mknod /dev/cdu31a b 15 0

See the file cdu31a for more information on this driver.

Also see the Web page put together by Jeffrey Oxenreider ( zureal@infinet.com) that covers a lot of common problems with these drives. It can be found at http://www.infinet.com/~zureal/cdu31a.html.

Aztcd Driver

       Principal author: Werner Zimmermann (zimmerma@rz.fht-esslingen.de)
  Multi-session support: yes
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/aztcd0, major 29
     Configuration file: aztcd.h
   Kernel config option: Aztech/Orchid/Okano/Wearnes (non IDE) CDROM support?
            README file: aztcd

This driver accepts a kernel command line of the form:

aztcd=<io-address>

where the parameter is the I/O base address of the card (e.g. 0x340).

The device file can be created using:

# mknod /dev/aztcd0 b 29 0

See the file aztcd for more information on this driver.

Gscd Driver

       Principal author: Oliver Raupach (raupach@nwfs1.rz.fh-hannover.de)
  Multi-session support: no
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/gscd0, major 16
     Configuration file: gscd.h
   Kernel config option: Goldstar R420 CDROM support?
            README file: gscd

This driver accepts a kernel command line of the form:

gscd=<io-address>

specifying the I/O base address of the card (e.g. 0x340).

The device file can be created using:

# mknod /dev/gscd0 b 16 0

See the file gscd and the World-Wide Web site http://linux.rz.fh-hannover.de/~raupach for more information on this driver.

Mcd Driver

       Principal author: Martin  (martin@bdsi.com)
    Multi-session support: no
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/mcd, major 23
     Configuration file: mcd.h
   Kernel config option: Standard Mitsumi CDROM support?
            README file: mcd

This is the older driver for Mitsumi drivers that has been available for some time. You might want to try the newer mcdx driver, which has some new features but is possibly less stable.

This driver accepts a kernel command line of the form:

mcd=<io-address>,<irq>

specifying the I/O base address of the card (e.g. 0x340) and the IRQ request number used.

The device file can be created using:

# mknod /dev/mcd b 23 0

See the file mcd for more information on this driver.

Mcdx Driver

       Principal author: Heiko Schlittermann
  Multi-session support: yes
 Multiple drive support: yes
Loadable module support: yes
   Reading audio frames: no (not supported by hardware)
           Auto-probing: no
            Device file: /dev/mcdx0, major 20
     Configuration file: mcdx.h
   Kernel config option: Experimental Mitsumi support?
            README file: mcdx

This is a newer driver for Mitsumi drivers. The older and possibly more stable mcd driver is still available.

This driver accepts a kernel command line of the form:

mcdx=<io-address>,<irq>

specifying the I/O base address of the card (e.g. 0x340) and the IRQ request number used.

The device file can be created using:

# mknod /dev/mcdx0 b 20 0

If you recently bought a Mitsumi CD-ROM drive, don't assume that it should use this kernel driver. Some Mitsumi models are now EIDE/ATAPI drives and should use the idecd kernel driver.

See the file mcdx for more information on this driver.

Cm206 Driver

       Principal author: David A. van Leeuwen (david@tm.tno.)
  Multi-session support: yes
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: yes
            Device file: /dev/cm206cd, major 32
     Configuration file: cm206.h
   Kernel config option: Philips/LMS CM206 CDROM support?
            README file: cm206

The driver accepts a kernel command line of the form:

cm206=<io-address>,<interrupt>

where the first number is the I/O base address of the card (e.g. 0x340). The second is the interrupt channel.

The device file can be created using:

# mknod /dev/cm206cd b 32 0

See the file cm206 for more information on this driver.

Optcd Driver

       Principal author: Leo Spiekman (spiekman@dutette.et.tudelft.nl)
  Multi-session support: yes
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/optcd0, major 17
     Configuration file: optcd.h
   Kernel config option: Experimental Optics Storage ... CDROM support?
            README file: optcd

The driver accepts a kernel command line of the form

optcd=<io-address>

to specify the I/O base address of the card (e.g. 0x340).

The device file can be created using:

# mknod /dev/optcd0 b 17 0

See the file optcd for more information on this driver.

Sjcd Driver

       Principal author: Vadim V. Model (vadim@rbrf.msk.su)
  Multi-session support: no
 Multiple drive support: no
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: no
            Device file: /dev/sjcd, major 18
     Configuration file: sjcd.h
   Kernel config option: Experimental Sanyo H94A CDROM support?
            README file: sjcd

The driver accepts a kernel command line of the form:

sjcd=<io-address>,<interrupt>,<dma>

indicating the base address, interrupt, and DMA channel to be used (e.g. sjcd=0x340,10,5).

The device file can be created using:

# mknod /dev/sjcd b 18 0

See the file sjcd for more information on this driver.

SCSI Driver

       Principal author: David Giller
  Multi-session support: yes (depending on drive)
 Multiple drive support: yes
Loadable module support: yes
   Reading audio frames: no
           Auto-probing: yes
            Device file: /dev/scd0, major 11
     Configuration file: cdrom.h
   Kernel config option: SCSI CDROM support?
            README file: none

There are kernel command line option specific to each type of SCSI controller. See the SCSI HOWTO for more information.

Multiple drives are supported (up to the limit of the maximum number of devices on the SCSI bus). Create device files with major number 11 and minor numbers starting at zero:

# mknod /dev/scd0 b 11 0
# mknod /dev/scd1 b 11 1

While the kernel driver itself does not support reading digital audio frames, some SCSI drives have the capability and will work with the cdda2wav program (which uses the generic SCSI kernel interface).

IDECD Driver

       Principal author: Scott Snyder (snyder@fnald0.fnal.gov)
  Multi-session support: yes
 Multiple drive support: yes
Loadable module support: no
   Reading audio frames: yes (on supported drives)
           Auto-probing: yes
            Device file: /dev/hd{a,b,c,d},  major 22
     Configuration file: cdrom.h
   Kernel config option: Include support for IDE/ATAPI CDROMs?
            README file: ide-cd

This is the driver for ATAPI CD-ROMS. The driver accepts a kernel command line of the form

hdx=cyls,heads,sects,wpcom,irq
  or
hdx=cdrom

where hdx can be any of {hda,hdb,hdc,hdd}, or simply hd, for the "next" drive in sequence. Only the first three parameters are required (cyls,heads,sects). For example hdc=1050,32,64 hdd=cdrom.

Getting the IDE driver to recognize your CD-ROM drive can be tricky, especially if you have more than 2 devices or more than one IDE controller. Usually all that is required is to pass the right command line options from LILO. The file /usr/src/linux/Documentation/ide-cd explains how to do this. Read it carefully.

Recent Linux kernels have better support for multiple IDE devices. If you have problems with an older kernel, upgrading may help.

Some IDE controllers have hardware problems which the kernel driver can work around. You may need to pass additional parameters to the driver to enable this. See the documentation for details.

4.4 Booting the Linux Kernel

You can now reboot with the new kernel. Watch for a message such as the following indicating that the CD-ROM has been found by the device driver (the message will vary depending on the drive type):

hdd: NEC CD-ROM DRIVE:282, ATAPI CDROM drive

If the bootup messages scroll by too quickly to read, you should be able to retrieve them using dmesg or tail /var/adm/messages.

If the drive is not found, then a problem has occurred, See the section on troubleshooting.

4.5 Mounting, Unmounting, and Ejecting Devices

To mount a CD-ROM, insert a disc in the drive, and run the mount command as root (this assumes you created a symbolic link to your device file as recommended above and that an empty directory /mnt/cdrom exists):

# mount -t iso9660 -r /dev/cdrom /mnt/cdrom

The CD can now be accessed under the directory /mnt/cdrom.

There are other options to the mount command that you may wish to use; see the mount(8) man page for details.

You can add an entry to /etc/fstab to automatically mount a CD-ROM when Linux boots or to specify parameters to use when it is mounted; see the fstab(5) man page.

Note that to play audio CDs you should not try to mount them.

To unmount a CD-ROM, use the umount command as root:

# umount /mnt/cdrom

The disc can only be unmounted if no processes are currently accessing the drive (including having their default directory set to the mounted drive). You can then eject the disc. Most drives have an eject button; there is also a standalone eject program that allows ejecting CD-ROMs under software control.

Note that you should not eject a disc while it is mounted (this may or may not be possible depending on the type of drive). Some CD-ROM drivers can automatically eject a CD-ROM when it is unmounted and insert the CD tray when a disc is mounted (you can turn this feature off when compiling the kernel or by using a software command).

Its possible that after playing an audio CD you may not be able to mount a CD-ROM. You need to send a CD audio "stop" command (using a CD player program) before trying the mount. This problem only appears to occur with the SBPCD driver.

Stephen Tweedie ( sct@dcs.ed.ac.uk) has written the Supermount package which provides transparent mounting of removable media including CD-ROM. You can find it at ftp://sunsite.unc.edu/pub/linux/patches/diskdrives/.

4.6 Troubleshooting

If you still encounter problems after following the instructions in the HOWTO, here are some things to check. The checks are listed in increasing order of complexity. If a check fails, solve the problem before moving to the next stage.

Step 1: Make sure you are really running the kernel you compiled

You can check the date stamp on the kernel to see if you are running the one that you compiled with CD-ROM support. You can do this with the uname command:

% uname -a
Linux fizzbin 2.0.18 #1 Fri Sep 6 10:10:54 EDT 1996 i586

or by displaying the file /proc/version:

% cat /proc/version
Linux version 2.0.18 (root@fizzbin) (gcc version 2.7.2) #1 Fri Sep 6 10:10:54 EDT 1996

If the date stamp doesn't seem to match when you compiled the kernel, then you are running an old kernel. Did you really reboot? If you use LILO, did you re-install it (typically by running /sbin/lilo)? If booting from floppy, did you create a new boot floppy and use it when booting?

Step 2: Make sure the proper kernel drivers are compiled in

You can see what drivers are compiled in by looking at /proc/devices:

% cat /proc/devices
Character devices:
 1 mem
 2 pty
 3 ttyp
 4 ttyS
 5 cua
 7 vcs

Block devices:
 3 ide0
22 ide1

First look for your CD-ROM device driver. These are all block devices, in this case we can see that the idecd driver with major number 22 was present.

Also make sure that ISO-9660 filesystem support was compiled in, by looking at /proc/filesystems:

% cat /proc/filesystems
        ext2
        msdos
nodev   proc
        iso9660

You can also see what i/o port addresses are being used by a driver with the file /proc/ioports:

howto % cat /proc/ioports
 ...
0230-0233 : sbpcd
 ...

If any of the drivers you thought you compiled in are not displayed, then something went wrong with the kernel configuration or build. Start the installation process again, beginning with configuration and building of the kernel.

Step 3: Did the kernel detect your drive during booting?

Make sure that the CD-ROM device was detected when the kernel booted. You should have seen a message on bootup. If the messages scrolled off the screen, you can usually recall them using the dmesg command:

% dmesg

or

% tail /var/adm/messages

If your drive was not found then something is wrong. Make sure it is powered on and all cables are connected. If your drive has hardware jumpers for addressing, check that they are set correctly (e.g. drive 0 if you have only one drive). ATAPI CD-ROMS must be jumpered as "single" or "master", and not "slave" when only one IDE device is attached to an interface. If the drive works under DOS then you can be reasonably confident that the hardware is working.

Many kernel drivers using auto-probing, but some do not, and in any case the probing is not always reliable. Use the kernel command line option listed for your kernel driver type. You may want to try several different values if you are not sure of the i/o address or other parameters. LILO can be (and usually is) configured to allow you to enter the parameters manually when booting.

Another possibility is that you used the wrong kernel driver for your CD-ROM driver. Some documentation may refer to proprietary interfaces as IDE, leading some to mistakenly believe they are ATAPI drives.

Another possibility is that your drive (or interface card) is one of the "compatible" type that requires initialization by the DOS driver. Try booting DOS and loading the vendor supplied DOS device driver. Then soft boot Linux using Control-Alt-Delete.

If your drive is not listed in this document, it is possible that there are no drivers for it available under Linux. You can check with some of the references listed at the end of this document for assistance.

Step 4: Can you read data from the drive?

Try reading from the CD-ROM drive. Typing the following command should cause the drive activity light (if present) to come on and no errors should be reported. Use whatever device file is appropriate for your drive and make sure a CD-ROM is inserted; use Control-C to exit.

# dd if=/dev/cdrom of=/dev/null bs=2048
^C
124+0 records in
124+0 records out

If this works, then the kernel is communicating with the drive and you can move on to step 5.

If not, then a possible cause is the device file. Make sure than the device file in the /dev directory has the correct major and minor numbers as listed previously for your drive type. Check that the permissions on the device file allow reading and writing.

A remote possibility is a hardware problem. Try testing the drive under DOS, if possible, to determine if this could be the case.

Step 5: Can you mount the drive?

If you can read from the drive but cannot mount it, first verify that you compiled in ISO-9660 file system support by reading /proc/filesystems, as described previously.

Make sure you are mounting the drive with the "-t iso9660" and "-r" options and that a known good ISO-9660 CD-ROM (not Audio CD) is inserted in the drive. You normally must mount drives as user root.

Make sure that the mount point exists and is an empty directory.

If you are automatically mounting the CD-ROM on bootup, make sure that you have correct entries in the /etc/fstab file.

If you are running the syslog daemon, there may be error messages from the kernel that you are not seeing. Try using the "dmesg" command:

% dmesg
SBPCD: sbpcd_open: no disk in drive

There may also be errors logged to files in /var/adm, depending on how your system is configured.

Debugging Audio Problems

If the drive works with CD-ROMs, but not for playing audio CDs, here are some possible solutions.

You need an application program to play audio CDs. Some applications may be broken or may not be compatible with your drive. Try other applications and/or try recompiling them yourself. A good place to look for software is ftp://sunsite.unc.edu/pub/linux/apps/sound/cds/.

A few of the CD-ROM drivers do not support playing Audio CDs. Check the README file or source code to see if that is the case.

Check if the audio can be played through the headphone jack. If so, then the problem is likely related to your sound card. Use a mixer program to set the input device and volume levels. Make sure you have installed an audio cable from the CD-ROM drive to the sound card. Make sure that the kernel sound card driver is installed and working (see the Sound HOWTO).

When All Else Fails

If you still have problems, here are some final suggestions for things to try:


Previous Next Contents