Gentoo Wiki ArchivesGentoo Wiki

HOWTO_ATAPI_CD_Burning

Contents

Kernel Setup

Note: The following applies to kernels >=2.6.18.

You must have both SCSI CDROM support and ATAPI CDROM support in the kernel. You can compile them in-kernel, or as modules, as shown here.


Launch menuconfig:

 # cd /usr/src/linux
 # make menuconfig

For genkernel users:

 # genkernel --menuconfig all


Add SCSI and ATAPI CDROM support:

Linux Kernel Configuration: SCSI and ATAPI CDROM Support

SCSI CDROM support:

 Device Drivers  --->
   SCSI device support  --->
     --- SCSI device support
     --- SCSI support type (disk, tape, CD-ROM)
     <M> SCSI CDROM support
     [*]   Enable vendor-specific extensions (for SCSI CDROM)

ATAPI CDROM support:

 Device Drivers  --->
   ATA/ATAPI/MFM/RLL support  --->
     <M> ATA/ATAPI/MFM/RLL support
     <M>   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
     ---     Please see Documentation/ide.txt for help/info on IDE dri
     <M>     Include IDE/ATAPI CDROM support

Note: You may not need to enable vendor-specific extensions, read the help provided (< Help >) for more information.


Again, both SCSI CDROM support and ATAPI CDROM support must be compiled (either as modules, or in-kernel).


Compile:

Genkernel users, skip this step.

Compile the new kernel:

 # make && make modules_install

Mount your /boot partition if it isn't already and copy over the new kernel, replacing "kernel-2.6.20-*" with the name of your kernel:

 # mount /boot
 # cp arch/i386/boot/bzImage /boot/kernel-2.6.20-* 

If you compiled SCSI and ATAPI CDROM support in-kernel (not as modules), reboot and skip the two next steps. Otherwise, proceed on to loading the modules.


Load the modules:

If you compiled the SCSI and ATAPI CDROM support above as modules (<M> and not <*>), you may now load them.

First, you must know the names of the modules you just compiled. Do so with the following command:

 modprobe --list

The (relevant) output should look something like this:

Code: modprobe --list
 /lib/modules/2.6.20-hardened-r2/kernel/drivers/cdrom/cdrom.ko
 /lib/modules/2.6.20-hardened-r2/kernel/drivers/scsi/sr_mod.ko
 /lib/modules/2.6.20-hardened-r2/kernel/drivers/ide/ide-cd.ko
 /lib/modules/2.6.20-hardened-r2/kernel/drivers/ide/ide-core.ko

Note: Output will differ according to the kernel version (2.6.20-*) you have and which options you configured above.

Now you can load the modules. E.g., for the output above, the correct command would be:

for i in "cdrom sr_mod ide-cd ide-core"
  do modprobe $i
done


Auto load modules on boot:

If you compiled the SCSI and ATAPI CDROM support above as modules, edit kernel-2.6, located in the /etc/modules.autoload.d/ directory, to automatically load them at boot time.

File: /etc/modules.autoload.d/kernel-2.6
cdrom
sr_mod
ide-cd
ide-core


dmesg:

If everything went fine, dmesg should now output something similar to this:

Code: dmesg
scsi 0:0:0:0: CD-ROM            MATSHITA DVD-RAM UJ-841S  1.50 PQ: 0 ANSI: 5
Uniform CD-ROM driver Revision: 3.20
sr 0:0:0:0: Attached scsi CD-ROM sr0

Your CD/DVD drive should now appear as /dev/sr0. You should also see symbolic links named, e.g, /dev/cdrom1.

Basic tools

First, lets make sure you have the following software installed

emerge -n cdrtools

Even if you plan to write DVDs, you can do that with cdrtools. You don't need cdrecord-prodvd or dvdrtools, just cdrtools (and cdrdao and dvd+rw-tools) are enough.

user burning for kernel >= 2.6.8.1 - (18.04.05)

You cannot use the special bit setuid root anymore.

This means: users wanting to use the XCDRoast software, cannot. See http://www.xcdroast.org for more details. However, XCDRoast can still be run under 'root' sucessfully.

Managing the groups and permissions

Set binary permissions:

chmod 750 /usr/bin/cdrdao
chmod 750 /usr/bin/cdrecord
chown root:cdrw /usr/bin/cdrdao
chown root:cdrw /usr/bin/cdrecord
Note: If cdrecord still complains about permissions, try setting 4711 permissions on /usr/bin/cdrecord.[1]

Set device permissions:

Permissions should be set up properly by default:

 $ ls -l /dev/sr0
 brw-rw---- 1 root cdrom 11, 0 May  9 08:22 /dev/sr0 

Group should read cdrom and the device should be group writable, as above.

If not:

 # chown root:cdrom /dev/sr0 
 # chmod g+w /dev/sr0 


Grant user permissions:

Finally, add the user to the cdrom group and log in to the new group:

 # gpasswd -a $username cdrom
 # gpasswd -a $username cdrw
 # newgrp

Note: remember to substitute the $username variable with the actual username you wish to add to the cdrom/cdrw groups.


User burning should now work.


Note: On 2006.1 with cdrtools-2.01.01_alpha10 you need to create symbolic link /dev/cdroms/cdromN to /dev/hdX additionally. Where N starting from zero. Because for some reasons cdrecord assume you have listed your devices in that directory. root permissions required to burn/erase the disc. Normal users may scan devices only :)

Get your device id

To burn an iso with cdrecord you will have to find out the device id. This is used to identify your burner on the scsi bus. Yes even for ATAPI drives you will need the device id. Find it by issuing the following command

cdrecord dev=ATAPI -scanbus

It will give out put like below

Cdrecord-ProDVD-Clone 2.01.01a11 (x86_64-unknown-linux-gnu) Copyright (C) 1995-2006 Jörg Schilling
scsidev: 'ATAPI'
devname: 'ATAPI'
scsibus: -2 target: -2 lun: -2
Warning: Using ATA Packet interface.
Warning: The related Linux kernel interface code seems to be unmaintained.
Warning: There is absolutely NO DMA, operations thus are slow.
Using libscg version 'schily-0.8'.
scsibus0:
        0,0,0     0) '_NEC    ' 'DVD_RW ND-3540A ' '1.F1' Removable CD-ROM
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) *
        0,7,0     7) *

Notice the 3 numbers seperated by commas, this is the device id that should be used for cdrecord. Mine is 0,0,0 but yours could be different so you need to replace it below with your device id.

Some people will advice to use dev=/dev/hdc but this is unsupported and might not work. It might work for you, but it is wrong. Try this method, however, if the recommended method returns no results.

If you get this message: Warning: dev=ATA: is preferred over dev=ATAPI:. Warning: Using ATA Packet interface. Warning: The related Linux kernel interface code seems to be unmaintained. Warning: There is absolutely NO DMA, operations thus are slow. cdrecord: No such file or directory. Cannot open or use SCSI driver. cdrecord: For possible targets try 'cdrecord -scanbus'. Make sure you are root. cdrecord: For possible transport specifiers try 'cdrecord dev=help'.

then change ATAPI to ATA, or try removing the dev option altogether: cdrecord dev=ATA -scanbus or cdrecord -scanbus

Preparing the ISO image

First, create a directory and then copy all the files you want to burn into /tmp/iso. Then create the image.iso

mkdir /tmp/iso
cp *.doc /tmp/iso
mkisofs -o /tmp/image.iso /tmp/iso

For Rock Ridge (UNIX) and Joliet (Windows) extensions:

mkisofs -RJ -o /tmp/image.iso /tmp/iso

(optional) Mount the iso image to check it

mkdir /tmp/loop
mount -o loop=/dev/loop/0 /tmp/image.iso /tmp/loop

Now you have the iso filesystem mounted at /tmp/loop and can browse it.

ls /tmp/loop

Finally, don't forget to unmount.

umount /tmp/loop

Burning the ISO image

To burn the iso use the following command. Replace the 0,0,0 (device id) with the id you found in chapter 5.

cdrecord dev=ATAPI:0,0,0 /tmp/image.iso

You might also want to add driveropts=burnfree to turn on buffer underrun protection. Note that your burner will have to support buffer underrun protection for this to work. Note: Sometimes while doing dev=ATAPI:#,#,# fails so do chapter 5 with option OLDATAPI and cdrecord dev=OLDATAPI also to fix that problem.

Example: Burning image.iso using device 1001,0,0 with burner protection turned on: cdrecord dev=1001,0,0 driveropts=burnfree /tmp/image.iso

Blanking a CDRW

cdrecord blank=fast dev=ATAPI:0,0,0
Or
cdrecord blank=fast dev=/dev/cdrom

Change 0,0,0 with the device id you found in chapter 5.

Burning an audio CD

See the Audio CD HOWTO for more information.

More tricks

mkisofs -RJ <path_to_dir_with_files> | cdrecord -v dev=ATAPI:0,0,0 -eject -

cdrecord will run without creating an .iso file then (on-the-fly)
Note: dash at the end of line is required

mkisofs -RJ <path_to_dir_with_files> | cdrecord -v dev=ATAPI:0,0,0 -eject tsize=`mkisofs -RJ -quiet -print-size <path_to_dir_with_files>`s -

Save the settings to the config file

Create the config file for cdrecord: /etc/default/cdrecord

And put there something like this:

mycdr=ATAPI:0,0,0	-1	-1	burnfree
CDR_DEVICE=mycdr
CDR_SPEED=24
CDR_FIFOSIZE=30000k

In this example the cd-r device is /dev/hdb, burnfree is enabled, writing speed is reduced to 24x (set CDR_SPEED to -1 and max speed supported by drive and media will be used) and fifo size is increased to 30 megs.

See also

Retrieved from "http://www.gentoo-wiki.info/ATAPI_CD_Burning"

Last modified: Sun, 07 Sep 2008 08:36:00 +1000 Hits: 77,900

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.