CDio Writing/Reading CDs and Recommended CD writers FAQ; DT: src/apps/CDio ------------------------------------------------------------------------ CDio Writing/Reading CDs and Recommended CD writers FAQ Carsten Koch, January, 1999 1. Writing CDs. In order to write CDs using an SGI system, you need a CD writer (hardware) and a writer driver (software). If you want to create a file system on the CD (i.e. copy files to it so you can later read them back simply by mounting the CD), you also need a program that creates a file system image that the writer driver can write to the CD. The writer driver can be implemented in the kernel, i.e. treating the CD writer almost like a hard disk, or it can be a user-level SCSI driver that just transfers file system images (for CD-ROMs) or sound files (for CD-DA) to the CD-recordable disc. All SGI writer drivers I am aware of are user-level programs. 1.1. Free writer drivers. 1.1.1. mkdisc. There is a writer driver called mkdisc on the SGI Developer Toolbox (DT) CD and web site. See https://toolbox.sgi.com/toolbox/utilities/CDmastering/ Note that you must be a registerd SGI developer to access that URL. The only CD writer supported by mkdisc is the Sony CDW-900E (and its compatible predecessor, the Sony CDW-E1/CDW-W1). The CDW-900E is somewhat outdated (1993) and very much overpriced according to today's standards. Also, mkdisc only supports CD-ROMs, i.e. data CDs. You cannot create audio CDs, etc. with it. The DT also contains a shell script "make_efs" that creates an SGI EFS image which can be transferred to a CD using mkdisc or other writer drivers. Starting with DT version 4.2, Eric Youngdale's (Eric@aib.com) program "mkisofs", which creates an ISO 9600 CD data image, is also included. The latest version of mkisofs can be found on ftp://tsx-11.mit.edu/pub/linux/packages/mkisofs/ /mkisofs-1.11.3.tar.gz DT CDs are shipped to registered SGI developers. Send E-Mail to devprogram@sgi.com for details. 1.1.2. cdwriter. Paul Bruggemann (bruggemn@netcom.com) has ported the Linux cdwrite writer driver to IRIX 5. Paul has tested the ported program with his Kodak 225PCD writer, but the Linux original was written for the older Philips writers, so it can be assumed that Paul's port still works with some Philips writers. This software is avaialable from ftp://ftp.netcom.com/pub/br/bruggemn/cdrom/cdwriter.tar.Z 1.1.3. WriteCDR. I wrote a writer driver that supports the Sony CDU 920, CDU 924, CDU 926, CDU 948, the Yamaha CDR 100, CDR 102, CDR 400 and CRW4260 both in data and in audio mode (it can write AIFC files directly to an audio CD). This program, together with ReadCD, a program that can read file system images and audio tracks off a CD (see 2.3 below), has been included in the SGI DT and can be found on the DT web site and the >= 6.1 version of the DT CD set. See https://toolbox.sgi.com/toolbox/src/apps/CDio I am unable to give you any direct support for this software. You will have to go through the DT support if you have questions or if you want to submit extensions for additional hardware. You need the "make_efs" script and its helper programs (also on the DT, see 1.1.1) in order to copy a directory tree to an EFS CD. You need mkisofs (see 1.1.1) in order to copy a directory tree to an ISO 9660 / RockRidge CD. 1.2. Commercial writer drivers. There are many. One example is CDR publisher by Creative Digital Research. Check out their web page at http://www.cdr1.com/ or download a demo version from ftp://ftp.cdr1.com/ Other packages that run under IRIX include Elektroson GEAR, JVC RomMaker UNIX Plus, Young Minds Makedisc/CD Studio. The SGI versions of all commercial writer drivers that I am aware of share one common disadvantage: They cost more than the PC version of the same package. Often as much as the sum of the PC version plus a PC itself. 2. Reading CDs Many CD writers can also be used as CD-ROM readers. However, it is questionable whether you should wear off an expensive CD-writer with the workload that a much cheaper CD-ROM can handle better or equally well. Also, as has been discussed in comp.sys.sgi.hardware and the SGI hardware FAQ, IRIX is kind of picky as to which CD-ROMs it chooses to work with. I am aware of the following five problem areas: 2.1. Vendor-specific commands. The SGI software issues Toshiba vendor-specific SCSI commands even to CD-ROM drives that have identified themselves as a non-Toshiba drive. This may cause problems with certain drives and/or other devices on the SCSI bus. For example, the Yamaha CDR 100 just times out causing a SCSI bus reset, which in turn may cause other problems. In fact, I have observed a scenario where the bus reset causes the system disk to time out on the next command, which causes another bus reset, etc. I wrote a patcher program that *may* be able to find the offending code in binaries such as mediad and mount_iso9660 and replace the Vendor-specific command with a harmless test-unit-ready command. See the sample source code at the end of this article. 2.2. PF bit in the modeselect command. According to the SCSI-2 standard, host software should set the PF bit in modeselect commands to SCSI-2 drives: "A page format (PF) bit of zero indicates that the MODE SELECT parameters are as specified in SCSI-1, (i.e. all parameters after the block descriptors are vendor-specific). A PF bit of one indicates that the MODE SELECT parameters following the header and block descriptor(s) are structured as pages of related parameters and are as specified in this standard." Unfortunately, IRIX does not always set the PF bit, but some SCSI-2 CD-ROM drives do require it. The most common problem caused by this is the drive not setting the correct block size, causing subsequent reads to fail. As a workaround you can set the required block size with a separate program, such as Dave Olson's scsicontrol. See http://reality.sgi.com/olson/ 2.3. Audio support. While the Silicon Graphics CD Audio Library was written to make a calling program independant of hardware details, right now it does the opposite: It only works with the Toshiba way of reading digital audio data over the SCSI bus. Therefore, all programs based on this library (including SGI's cdman) cannot play audio CDs with most non-Toshiba drives. I have written a program (ReadCD) that works with any drive that supports the READ-CD-DA SCSI command. It has been tested successfully with the Sony CDU 920S, the CDU 924S and the Yamaha CDR 100 CD writers and with the Sony CDU 76S CD-ROM. This program is not based on the Silicon Graphics CD Audio Library, but uses the SCSI library (dslib) directly. ReadCD is avaialable on the SGI DT. See 1.1.3 above. 2.4. 512 byte blocks. SGI machines can only boot from CD's that contain an EFS filesystem. Also, the driver insists in reading the data in logical 512 byte blocks (instead of the physical 2048 byte blocks that are recorded on the CD). If your drive is not in any way switchable to 512 byte blocks, you're out of luck: IRIX will not boot from it and it will also not mount an EFS CD under the running system. But even if your drive does support 512 byte blocks, IRIX may not figure out how to switch it to 512 byte mode, see 2.2. 2.5. Peripheral device type. Many CD-writers identify themselves as a WORM drive (peripheral device type = 4). However, IRIX does not recognize these as a drive it can read a CD from. In particular, the prom monitor and the sash will not boot from them, mediad will completely ignore them (sorry, no indigo magic desktop icons, no eject command), etc. The latest revision of the CDU 920S now has a jumper that will make the peripheral device type selectable between 4 (WORM) and 5 (CD-ROM). The CDU 924S and the CDU 926S also have this feature. See 3.1 below. Some of the problems mentioned above may be fixed in IRIX 6.2. Problem 2.3 definitely is not fixed in IRIX 6.2. According to SGI, there will be no IRIX 5.3 patches in this area. 3. Recommended CD writers 3.1. IRIX compatibility. Most CD-writers are incompatible with the way IRIX handles SCSI disconnects. This means that you have to reconfigure the kernel in order to disable SCSI disconnects, which will have very bad side effects on your system performance (the whole system will freeze at certain times when you write CDs or access tapes, etc.), unless you have a dedicated SCSI controller you can connect the writer to. CD-writers known to have this problem include: + Kodak PCD 200, 200+, 225 + Philips CDD 521, 521 Upgrade, 522 + Plasmon RF 4100, 4102 + Yamaha CDE 100, CDR 100 up to firmware version 1.09 CD-writers that do not have this problem include: + Sony CDW-E1/CDW-W1, CDW-900E, CDU 920, CDU 924, CDU 926, CDU 948, + Yamaha CDE 100, CDR 100 with firmware version >= 1.10 + Kodak PCD 600. I do not recommend to use any of the former CD-writers under IRIX unless your workstation has a dedicated SCSI controller that you can reserve for the CD-writer. Among the latter ones, I only know the Sony CDU 920S, the Sony CDU 924S, the CDU 926S and the Yamaha CDR 100 well. Here is a comparison: Model Read Write Seek Boot mediad Mount Mount Buffer Speed Speed time ISO EFS CDU 920S 2x 2x 300ms no* no* yes yes 1M CDU 924S 4x 2x 250ms yes yes yes yes 1M CDU 926S 6x 2x 220ms yes yes yes yes 0.5M CDR 100 4x 4x 500ms no no yes no 0.5M PCD 600 6x 6x ? ? ? ? ? 2-8M Note that all CD-writers can write EFS CDs as long as your writer software supports it. Sony CDU 920S models produced after October, 1995 have a jumper that allows them to be configured as a CD-ROM. They should work with mediad and allow you to boot from them. The Sony CDU 92x CD-writers are sold in different configurations. For example, the CDU 920S in an external enclosure is called CDU 921S. Other aliases for the Sony CDU 920S include: Spressa 920 (CDU 920 with bundled PC software), Spressa 9211 (Spressa 920 in an external enclosure), CSP-920S (same as Spressa 920), etc. I also heard that the Smart & Friendly CDR1002 is based on the Sony CDU 920S and that the Smart & Friendly CDR4000 is based on the Yamaha CDR-100. See http://www.cdrmicro.com/cdr_faq.htm 3.2. Price and additional information. The list price of the Sony Spressa CDU948S is $279 (as of January 17th, 1999), see http://www.ita.sel.sony.com/products/storage/cddrives/cdr/spressa948sc.html This URL also has a picture of the drive and its technical data. The Kodak PDC 600 has a list price of $19,995 (that's right: almost twenty thousand US dollars), see http://www.kodak.com/country/US/en/corp/pressReleases/pr19950918-4.shtml I could not find a list price for the Yamahas. Information on the Yamaha writers can be found on http://www.yamahayst.com/ ------------------------------------------------------------------------ /* patcher that replaces vendor-specific 0xc9 command with a harmless test-unit-ready command. use at your own risk. Sample use: cp mediad mediad.orig patchermediad */ main() { unsigned long *buf = (unsigned long *)malloc(32 * 1024 * 1024); unsigned long pat[] = { 0x240600c9, 0x0320f809, 0x00003825}; unsigned long l = read(0, buf, 32 * 1024 * 1024); unsigned long i, j, best_j = 0, best_i = l, duplicates = 0; if (l <= 0) { fprintf(stderr, "No data.\n"); exit(1); } else fprintf(stderr, "%u bytes.\n", l); l /= sizeof(unsigned long); for (i = 0; i < l; i++) { if (buf[i] == pat[0]) { j = 1; while ((buf[i+j] == pat[j]) && (j < sizeof(pat) / sizeof(unsigned long))) j++; if (j > best_j) { best_j = j; best_i = i; duplicates = 0; } else if (j == best_j) duplicates++; } } fprintf(stderr, "best match is %u out of %u at index %u. %u duplicates.\n", best_j, sizeof(pat)/sizeof(unsigned long), best_i, duplicates); if ((best_j > 1) && (duplicates == 0)) { buf[best_i] = 0x24060000; write(1, buf, l*sizeof(unsigned long)); } } } ------------------------------------------------------------------------ Copyright © 1999, Silicon Graphics, Inc.