Categories: Top ::

Tech: Kernel compiling, and failing succeeding to burn DVDs
Tue, 02 Aug 2005

Update: Success! See down at the bottom.

Earlier I started mucking with burning DVDs and CDRs from this new FreeBSD 5.4 box and didn't really get anywhere with DVDs but did get CDRs working great. I thought I'd waste a few more hours and attempt to get DVD-R's to burn - alas.. no luck yet. Fired off a question to freebsd-questions though in hopes others can help.. however, I thought I'd summarize my experiences so far.

'cdrecord' comes with the OS and is the most commonly used tool so I figured I'd work that angle. You use the same mkisofs to produce the intermediate .iso file that is fed into the burning process, so see the prior blog entry for details about that. cdrecord needs ATAPICAM added to the kernel (since the GENERIC kernel doesn't include that option) as it allows use of 'SCSI' devices on the ATAPI (IDE) hard drive bus.


To build the kernel is nearly out of scope, but heres a quick rundown..

By now we've got a fresh new kernel with the proper ATAPICAM support so cdrecord should work. Too bad that cdrecord refuses to work with .iso images greater than 1MB in size or using DVD-R media, unless you register for a key file with the developer. (Purchased?) Theres some docs in the ftp site for how to ask for a key, and theres some temp keyfiles included if you look hard for them. After a bit of screwing around I found a temporary key file and learned you just set it into an env var (it would be nice if the documentation and man pages were clear both in this requirement and how to find the key file and set it up!) Anyway, long-story-short, I fired up cdrecord and found it not working, so got cdrecord-ProDVD and found it also didn't work -- it would say "you've got to wait a few seconds" (or something like that), count down and then at the last second abort out and spill the wonderful error message of "Alarm clock."

So here we find another reason why Unix isn't being picked up by the masses -- relatively common things just don't work, and theres no documentation, and weird error messages. I'm a developer - give me cryptic stuff and I'll sort it out, but this is just pathetic.

A few hours down the drain, I decide to move onto something else. 'growisofs' has been mentioned around a few times and I see it in the FreeBSD manuals.. and after a bit I find it in the ports, sysutils/dvd+rw-tools . After installing that, I get a little bit of luck.. in that the burner lamp goes to red when I invoke it. Ah, to whit -- "camcontrol" can be used to list the devices attached to the new CAM ATAPI system, and with guessing I figured out you can't refer to /dev/acd0 like normal but instead presumably use /dev/cd0 for some unknown reason. For cdrecord you have to use the SCSI notation of dev=1,1,0 though, so this is another weirdness -- three reference types depending on the mode of use. (It makes sense.. acd0 for ATAPI cdrom, cd0 for plain old cdrom, and 1,1,0 for SCSI reference. But regular people won't know or expect this.)

growisofs -dvd-compat -speed=4 -Z /dev/cd0=buckdvd.iso

After blinking a bit, I get some almost-progress:

Executing 'builtin_dd if=buckdvd.iso of=/dev/pass0 obs=32k seek=0'
/dev/pass0: "Current Write Speed" is 4.1x1385KBps.
   1867776/2937458688 ( 0.1%) @0.4x, remaining 104:46
   7503872/2937458688 ( 0.3%) @1.2x, remaining 45:33
   7503872/2937458688 ( 0.3%) @0.0x, remaining 71:35
...etc...
   7503872/2937458688 ( 0.3%) @0.0x, remaining 182:12
   7503872/2937458688 ( 0.3%) @0.0x, remaining 201:44
  13107200/2937458688 ( 0.4%) @1.2x, remaining 126:25
  13107200/2937458688 ( 0.4%) @0.0x, remaining 141:18
  13205504/2937458688 ( 0.4%) @0.0x, remaining 151:19
...etc...
  16547840/2937458688 ( 0.6%) @0.0x, remaining 435:23
  16547840/2937458688 ( 0.6%) @0.0x, remaining 444:13
  16547840/2937458688 ( 0.6%) @0.0x, remaining 455:59
:-[ WRITE@LBA=1f90h failed with SK=6h/ASC=29h/ACQ=00h]: Input/output error
builtin_dd: 8080*2KB out @ average 0.1x1385KBps
:-( write failed: Input/output error
/dev/pass0: flushing cache
:-[ FLUSH CACHE failed with SK=2h/ASC=04h/ACQ=01h]: Resource temporarily
unavailable
:-[ SYNCHRONOUS FLUSH CACHE failed with SK=2h/ASC=04h/ACQ=01h]: Resource
temporarily unavailable

burncd doesn't seem to work for DVDs for me either (some ioctl error), so I now consider my obvious options exhausted. Theres other things to look into but I've already wasted many hours so heck with it..

Perhaps the wonderful people in freebsd-questions can help sort me out. Stay tuned.

Edit: Heres some good links you may wish to know about..


Success!

It would seem the above was occuring due to starvation of the device -- couldn't get enough data to the burner for it to burn right. Altering it to a speed of 1 did in fact work (better anyway), which clued me in. Some nice folks in freebsd-questions suggested a few things that turned out correct, though I thoght I'd done them.. but I was sloppy. The key is this:

cat /boot/loader.conf
hw.ata.atapi_dma="1"

I had seen this mentioned in the freebsd guide online, and added the hw.ata.atapi_dma line to my rc.local as I'd done other sysctl mods. (You can also do them in /etc/sysctl.conf) However, this particular one needs to be done at boot-time as it is 'read only' during OS runtime. So it hadn't taken when I did it earlier and rebooted. Slapping it into the boot'ers conf allowed it to take, and the burn could now get enough data to keep up.. and voila!

2306441216/2937458688 (78.5%) @3.9x, remaining 2:10
2325020672/2937458688 (79.2%) @3.9x, remaining 2:06
2343501824/2937458688 (79.8%) @3.9x, remaining 2:02
...etc...
2937094144/2937458688 (100.0%) @3.9x, remaining 0:00
builtin_dd: 1434320*2KB out @ average 3.5x1385KBps
/dev/pass0: flushing cache
/dev/pass0: updating RMA
/dev/pass0: closing disc

Another note..

I tried a basic mount after this.. su to root and "mount /cdrom", but the kernel panic'd - not good. I tried to mount using a slice of acd0 instead of acd0 itself, and that did in fact work.. soperhaps the cdrom driver is more forgiving, or doesn't mind the first slice on the cdroms I've tried.. but for future reference, heres the mount I used:

mount -t cd9660 /dev/acd0t01 /cdrom

[ Category: / technology / bsd ] [link] [Comments]