Next Previous Contents

2. Setup the Linux-system for writing CD-ROMs

If you succeed setting up your hardware and the rest of your Linux-system, the command cdrecord -scanbus shows you a list of devices available for writing. The goal of this chapter is to guide you in setting up your Linux-system, so that you finally end up seeing something like:

shell> cdrecord -scanbus
Cdrecord release 1.7a1 Copyright (C) 1995-1998 Jörg Schilling
scsibus0:
          0) 'Quantum ' 'XP34300         ' 'F76D' Disk
          1) 'SEAGATE ' 'ST11200N        ' '8334' Disk
          2) *
          3) 'TOSHIBA ' 'MK537FB/        ' '6258' Disk
          4) 'WANGTEK ' '5150ES SCSI-36  ' 'ESB6' Removable Tape
          5) 'EXABYTE ' 'EXB-8500-85QUE  ' '0428' Removable Tape
          6) 'TOSHIBA ' 'XM-3401TASUNSLCD' '3593' Removable CD-ROM
          7) *
scsibus1:
        100) 'Quantum ' 'XP31070W        ' 'L912' Disk
        101) *
        102) *
        103) 'TEAC    ' 'CD-R55S         ' '1.0H' Removable CD-ROM
        104) 'MATSHITA' 'CD-R   CW-7502  ' '4.02' Removable CD-ROM
        105) *
        106) 'YAMAHA  ' 'CDR400t         ' '1.0d' Removable CD-ROM
        107) *
Listing 1: Detecting devices on your SCSI-bus

The example was provided by Jörg Schilling and shows a total of four CD-writers. Please note that -scanbus also reports other devices, e.g. regular CD-ROMs and harddisk drives. The last column gives the SCSI description of the device, from which you cannot distinguish ordinary CD-ROM drives from those with burning capability. But the product identification often has hints about the feature in form of a R, -R or -RW.

Don't worry about the keyword "scsibus". If you don't have one, you just read the following about how to load the Linux kernel-module to emulate a SCSI hostadaptor. Same is goes for owners of a writer working over the parallel port. As ATAPI means "speak the SCSI protocol over the IDE-bus", it is more or less straightforward to make IDE/ATAPI-devices appear as if they were real SCSI-devices. But once you access your writer as a SCSI-device with the CD-writing software, you must also access your writer as a SCSI-device, when you use it as a regular CD-ROM. Usally mounting of filesystems or playing audio CDs will go through /dev/scd0 then.

2.1 Set up the Linux-kernel

The Linux-kernel can be equipped with drivers for various features. You can compile the drivers into the kernel-image statically or you can compile them as a module for on-demand loading. The last method is preferred for drivers not essential for bringing your Linux-system into life, because your kernel will be smaller and faster then. However, some drivers are essential for the system to come up and you can't compile them as a module. Example: if your system lives on a IDE-harddisk, you must have the driver for IDE-harddisks in the kernel - not as a module.

There are three different types of CD-writers: SCSI, IDE/ATAPI and external writers for the parallel port. Table 4 shows how to configure the Linux-kernel for those hardware types. The first column of the table is the section of the kernel configuration menu, where you can find the setting. The second column is the description of the feature (taken from the kernel configuration menu, too). The third column gives the name of the resulting module. The columns named SCSI, IDE and PP contain the necessary options for the associated hardware (PP = parallel port).

Sect.  Description                 Module   SCSI  IDE   PP
------------------------------------------------------------
BLOCK  Enhanced IDE/MFM/RLL...                     Y      
BLOCK  IDE/ATAPI CDROM             ide-cd          M     
BLOCK  SCSI hostadaptor emulation  ide-scsi        M      
BLOCK  Loopback device             loop       M    M     M

PARIDE Parallel port IDE device    paride               Y/M
PARIDE Parallel port ATAPI CD-ROMs                       M
PARIDE Parallel port generic ATAPI                       M
PARIDE (select a low-level driver)                       Y

SCSI   SCSI support                scsi_mod  Y/M  Y/M    
SCSI   SCSI CD-ROM support         sr_mod    Y/M  Y/M     
SCSI     Enable vendor-specific               Y    Y      
SCSI   SCSI generic support        sg        Y/M  Y/M     
SCSI   (select a low-level driver)            Y

FS     ISO 9660 CDROM filesystem   iso9660    Y    Y     Y
FS     Microsoft Joliet cdrom...   joliet     M    M     M
Table 4:

Y stands for yes and means you should put the beast into the kernel. M stands for module and means you should or must compile this feature as a module. Y/M gives you the option to decide between both (order indicates choices with less potential problems). Empty settings don't need to be modified and not changing them increases the chance that the resulting kernel will work for you (if it did before...).

The loopback device is an optional feature, which helps you to test the image before writing it to the media. If you want to be able to read CD-ROMs, you need support for the ISO 9660 filesystem. This driver automatically includes RockRidge Extensions. If you want to have MS Joliet cdrom extensions, compile them as a module and load them. In any case, you need a low-level driver for your hardware. Low-level refers to the driver, which interacts directly with the hardware. For SCSI and the parallel port, there are a lot of low-level drivers available.

Especially in environments, where SCSI- and ATAPI-devices are mixed, you better build most things as modules. To make your life with modules easier, you can add the following lines to /etc/conf.modules:

alias   scd0 sr_mod                  # load sr_mod upon access of scd0
alias   scsi_hostadapter ide-scsi    # SCSI hostadaptor emulation
options ide-cd ignore=hdb            # if /dev/hdb is your CD-writer
Some settings for using IDE/ATAPI-writers

The aliases provide alternate names for the same module and are not essential. The options provide a way to make options for module loading permanent. To learn about different options for different modules read on.

Description                     command
-------------------------------------------------
Show active drivers             cat /proc/devices
List active modules             cat /proc/modules
List available modules          modprobe -l
Load a precompiled module       modprobe
Remove a module                 modprobe -r
Table 4:

If you need a module not available on your system, you must recompile and reinstall the kernel. Please read the Kernel-HOWTO for more information upon this. The most recent information about handling of kernel-modules can be read in the Module-HOWTO. If you have success in building or finding the required modules, either add their names to /etc/modules or let an automatic facility (kmod, kerneld) load them. Consult the documentation of your Linux-distribution if you are unsure.

If you are lucky, then just install a package called "Linux Kernel source", which was shipped with your distribution. Afterwards issue the following commands:

cd /usr/src/linux
make menuconfig  # follow instructions and menu
make dep
make zImage      # or "make bzImage"
# insert a floppy-disk before proceding
dd if=arch/i386/boot/zImage of=/dev/fd0
make modules
make modules_install
Table 4:

This will produce a bootable floppy disk. If you are really clueless about this whole stuff, you better get help from a friend before you completely mess up your system. Remember the kernel is the heart of the system.

Special hints up to kernel version 2.2.9

Owners of ATAPI-CD-writers please head up: if your kernel detects your writer as an ATAPI-device during system startup, you have no chance of getting it to work as a CD-writer under Linux. Once the IDE/ATAPI-driver grabs the device, the SCSI-driver can no longer do so. Please recompile a kernel with the CD-ROM-stuff as a module like it is shown in the table above.

With 2.2 and above, you can control the greediness of the ide-cd driver with the parameter ignore=. The driver won't grab the specified device, so it will be available when the SCSI-hostadapotr emulation is activated. Example: use "modprobe ide-cd ignore=hdb", if your ATAPI-writer is hdb and you want the ide-scsi-driver to treat hdb as a scsi-device (usally sr0). There is no way to specify this on the kernel-commandline (like in 2.0).

Up to kernel-version 2.2.9, don't enable CONFIG_SCSI_MULTI_LUN ('probe for multiple luns') and ide-scsi support at the same time, there is an ide-scsi bug that prevents this.

Some users reported conflicts with pre-compiled binaries and the 2.2-release. This is a problem of the Linux-kernel. Solutions:

Special hints with kernel version 2.2.10 and later

It was reported to me, that 2.2.10 provides you with both, the option from the 2.0-series, and the option from the series before 2.2.9. Personally the author prefers the more positive strategie of telling the kernel which device should be managed by the ide-scsi driver like it is done in 2.0.37.

Special hints for the 2.0-series

Kernels prior to 2.0.31 have several bugs and can't read the last file on a CD-ROM. Please upgrade to 2.0.37. For this version, the misleading feature name "SCSI emulation" has been renamed into "SCSI hostadaptor emulation", which is more accurate.

With 2.0.36 and above, you can select which driver (IDE or SCSI) to use for which ATAPI-device. To be more precise, you can add the feature "SCSI emulation" to your kernel and activate the emulation for specific devices on the kernel commandline (before/while booting). For example, if your CD-writer has the devicefile /dev/hdb, then add the statement hdb=ide-scsi. Compared to the 2.2 series, this is a more positive way of thinking.

image=/boot/zImage-2.0.37
  label=Linux
  read-only
  append="hdb=ide-scsi"
Listing 2: Example configuration for lilo (/etc/lilo.conf)

linux "Linux 2.0.37" {
        image=/boot/zImage-2.0.37
        cmdline= root=/dev/hda5 readonly hdb=ide-scsi
}
Listing 3: Example configuration for chos (/etc/chos.conf)

Please note that this is different from 2.2, where you can only pass the options while loading the modules.

2.2 Hardware and devicefiles

After you have installed all necessary drivers, boot the new kernel. It should have all the features you need for the following sections.

[Users of devfs need not to care about the following steps of manually setting up device files. If you use devfs, everything will automacigally appear on the right place.]

Goto the /dev-directory and check for loopback devices. Its not critical if you don't have those devices, but its convenient if you do (see 3.5). If you already have them, the ls-command should show loop0-loop7:

shell> cd /dev
shell> ls loop*
loop0 loop1 loop2 loop3 loop4 loop5 loop6 loop7
Listing: devicefiles for loopback

If you don't have those device-files, then create them by using the /dev/MAKEDEV-script:

shell> cd /dev/
shell> modprobe loop   # load the module called "loop"
shell> ./MAKEDEV loop
Listing: commands to create loopback devices

The last command only succeeds if you have the loop-module in your kernel. What you read so far about handling of loop-devicefiles can be applied to all other devicefiles (sg*, pg*, hd*, ...) and is not explicitely mentioned in the following.

In case your Linux-distribution misses the script /dev/MAKEDEV, then create the devices manually with this loop:

for i in 0 1 2 3 4 5 6 7
do
        mknod /dev/loop$i c 7 $i
done

IDE/ATAPI CD-writers

ATAPI means "SCSI-commands over the IDE-bus". In other words, your IDE/ATAPI-drives speak the SCSI-protocol (with some limitations) and thus can act as if they were SCSI-drives.

Under Linux you can make your IDE-writer appear as a SCSI-devices using the kernel-features "SCSI (hostadaptor) emulation". So activate the associated kernel module ide-scsi like described above and proceed as if you had a SCSI-writer.

SCSI CD-Writers

Please make sure that your writer is recognized by the BIOS of your computer. It makes no sense to proceed if your computer does not accept the hardware (the fact that it doesn't spit it out should not be interpreted as a sign of confirmation; a message on the screen is required).

If you plan to connect your SCSI-drive to your parallel port (not to confuse with the IDE-drives for the parallel port), you need a special active cable and a special kernel-driver. Read read http://www.torque.net/parport/parscsi.html to learn more about this option.

Generic SCSI devices

The devicefiles /dev/sd* and /dev/sr* for accessing SCSI harddisks and SCSI CD-ROM drives are limited to block-oriented data transfer. This makes them so fast and idealy suited for data storage. Driving the laser of a CD-writer is a more complicated task and requires more than block-oriented data transfer. To keep the sd* and sr* devices clean and fast, a new type of SCSI-devices was introduced, the so called generic SCSI-devices. As everthing can be done to SCSI-hardware through the generic devices they are not fixed to a certain purpose - therefore the name generic.

As true for other devices, you should find them in the /dev directory (by convention):

shell> cd /dev
shell> ls sg*
sg0  sg1  sg2  sg3  sg4  sg5  sg6  sg7

If you don't have those device-files then create them by using the /dev/MAKEDEV-script:

shell> cd /dev/
shell> ./MAKEDEV sg

If your Linux-distribution misses the script /dev/MAKEDEV, then create the devices manually with this loop:

for i in 0 1 2 3 4 5 6 7
do
        mknod /dev/sg$i c 21 $i
done

CD-Writers for the parallel port

I have no clue about this, sorry. Please read http://www.torque.net/parport/paride.html or your local file /usr/src/linux/Documentation/paride.txt.

2.3 Get the user-software for burning CD-Rs

A more detailed survey of tools related to produce CD-ROMs is available from http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdb.html.

Command line utilities

One of the following packages are required to generate images of CD-Rs (only required for data CD-ROMs):

ftp://tsx-11.mit.edu/pub/linux/packages/mkisofs/ (mkisofs)

ftp://ftp.ge.ucl.ac.uk/pub/mkhfs (mkhybrid)

To write images to the CD-R, you need one of the following software packages:

ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ (cdrecord)

http://www.ping.de/sites/daneb/cdrdao.html (cdrdao)

Don't trust the man-page of (old) mkisofs which states you need version 1.5 of cdwrite. Just use cdrecord and you are fine. Please note that use the mkisofs shipped with cdrecord has a few extensions (referenced in the documentation of cdrecord).

Graphical user interfaces (optional)

Front-ends are really front-ends under Linux. That means, you still have to install the command-line utilities, but you access them in a better looking manner.

X-CD-Roast is a program-package dedicated to easy CD creation under Linux. It combines command line tools like cdrecord and mkisofs into a nice graphical user interface.

http://www.fh-muenchen.de/home/ze/rz/services/projects/xcdroast/e_overview.html

BurnIT is a JAVA front-end to cdrecord, mksiofs and cdda2wav-0.95 making it a complete package for burning CD's on the Unix platform. Its available from

http://sunsite.auc.dk/BurnIT/

XDaodio

This is a graphical frontend for cdrdao. Its main purpose is to make 1:1-copies of audio CDs.

http://www.lrz-muenchen.de/~MarkusTschan/


Next Previous Contents