Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using cdrdao to burn iso images to CD
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
tld
Veteran
Veteran


Joined: 09 Dec 2003
Posts: 1383

PostPosted: Wed Dec 28, 2005 4:42 pm    Post subject: Using cdrdao to burn iso images to CD Reply with quote

I always used cdrecord to burn CDs from iso images, but was just plain getting sick of various cdrecord issues (problems running as non-root, whining about your kernel version etc ;)). I finally stumbled on on old post on the openbsd mailing list that explained how to burn iso images with cdrdao.

cdrdao needs a simple toc file that points to the iso image file you're burning. Create a file with the following contents (in this example the iso image file name is myimage.iso):

Code:

CD_ROM

TRACK MODE1
DATAFILE "myimage.iso"



Say for example you name the above text file "myimage.toc", you could burn the image with the command:

Code:

cdrdao write --device your_device myimage.toc


...where your device is the proper device for your cd recorder.

Note that the DATAFILE section can use a relative or fully qualified path as well. This is fairly easy to automate with a script.

Tom
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Thu Dec 29, 2005 8:59 am    Post subject: Reply with quote

Thanks, that worked brilliantly! It also seems to avoid cdrecord creating cds that can't actually be read by my drive. :)
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
tld
Veteran
Veteran


Joined: 09 Dec 2003
Posts: 1383

PostPosted: Thu Dec 29, 2005 2:07 pm    Post subject: Reply with quote

Glad it helped! Here's a perl script I use to automate this. It also verifies the cd against the image file afterwards using md5sum (something that no commercial cd burning programs seem to do as far as I have seen):

Code:

#!/usr/bin/perl
# Make CD from disk image

$device = "/dev/hdd";
$driver = "generic-mmc";

die "Syntax: cdrimg image_file\n" unless (@ARGV == 1);
$file = $ARGV[0];
die "No such file.\n" unless (-r $file);
# Create toc
$tocfile = "$ENV{HOME}/tmp/isotmp.toc";
open(F, ">$tocfile") || die "Can't write to $tocfile!!\n";
print F "CD_ROM\n\nTRACK MODE1\nDATAFILE \"$file\"\n\n";
close(F);
@args = ("cdrdao", "write", "--driver", $driver, "--device", $device, "-n", $tocfile);
print "@args\n";
die "ERROR running cdrdao\n" if (system(@args));
# Open and close tray, then verify
system("eject $device");
system("eject -t $device");
print "VERIFYING...\n";
$source = `md5sum $file`;
chomp($source);
print "$source\n";
@temp = split(/\s/, $source);
$smd5 = shift(@temp);
$dest = `dd if=$device | md5sum`;
chomp($dest);
print "$dest\n";
@temp = split(/\s/, $dest);
$dmd5 = shift(@temp);
if ($smd5 eq $dmd) {
   print "Verified!!\n";
   system("eject $device");
   unlink($tocfile);
   exit(0);
} else {
   print "VERIFY failed!\n";
   exit(-1);
}


The script assumes you have the eject and md5sum programs, and that you have a 'tmp' directory below your home. Just change the $driver and $device assignments at the top to match your drive.

Tom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum