home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / doc / HOWTO / mini / CD-Writer < prev    next >
Text File  |  1995-01-18  |  9KB  |  217 lines

  1. CD Writer mini-HOWTO
  2. by Matt Cutts, cutts@ms.uky.edu
  3. v0.2, 17 Dec 1994
  4.  
  5.   1.  Introduction
  6.  
  7.   This is how I wrote a CD with Linux kernel v1.1.64, Philips CDD 521
  8.   (although outside label was "Kodak PCD Writer 200 PLUS"), and an
  9.   Adaptec 1542cf.  Your mileage may vary; not responsible if this 
  10.   causes your computer to explode; all trademarks are trademarks, etc.
  11.  
  12.   In particular, cdwrite supposedly only works with Philips writers,
  13.   although to my knowledge no one has tested it on other writers.
  14.   The first part is complete reconstruction of the process that I
  15.   did to write a CD.  After everything is done once, you need only
  16.   use mkisofs and cdwrite for each CD you write.
  17.  
  18.   1.1.  Feedback
  19.   
  20.   This document describes my experience in getting a CD writer to work.
  21.   I may be able to answer some questions or comments about this test.
  22.   Please feel free to mail Matt Cutts, at cutts@ms.uky.edu.  Let me know
  23.   if this document helped, or if some other section would be helpful.  
  24.   Please point out any mistakes that you find as well.
  25.  
  26.   2.  The Process
  27.  
  28.   Here's a chronological recreation of what I did.  You may want to skip
  29.   the steps that resulted in kernel panics 8-).  Note that much of this
  30.   process will require you to be super-user on the machine.
  31.  
  32.   2.1.  shut down computer; hook CD writer to computer; reboot
  33.  
  34.   ---> causes a kernel panic
  35.  
  36.   2.2.  upgrade to 1.1.64 kernel
  37.  
  38.   ---> still causes a kernel panic
  39.  
  40.   2.3.  change 1542CF settings
  41.  
  42.   Mike McKenna (our local hardware guru) and I changed around quite
  43.   a few settings, so I'm going to do a complete list of them.  One
  44.   of them fixed everything.  I'm 90% sure that it was changing "Enable 
  45.   Disconnection" to "no" for the SCSI ID# corresponding to the CD writer,
  46.   but I haven't written a CD since I've played with the settings.
  47.   Try changing that first; if that doesn't work, try changing some
  48.   of the other setting that I mentioned.  When you boot, hit <Ctrl><A> 
  49.   to get into the SCSI-Select utility.  Go into "Configure/View Host 
  50.   Adapter Settings".  Here are my working settings when I wrote the CD:
  51.  
  52.   Host Adapter IRQ Channel -> 11
  53.   Host Adapter DMA Channel -> 5
  54.   Host Adapter SCSI ID     -> 7
  55.   [BIOS Revision:  2.02;  Base Address:  DC000h; Firmware:  Rev. B.0;
  56.     Checksum:  A223h]
  57.   (these should be irrelevant to you; DO NOT change the settings above)
  58.  
  59.   SCSI Parity Checking        Enabled
  60.   DMA Transfer Rate        5.0 MB/sec
  61.   Host Adapter SCSI Termination    Enabled
  62.  
  63.   SCSI Device Configuration 
  64.   (note hard drive = #0, writer = #1, 1542 = #7)
  65.                   #0   #1   #2   #3   #4   #5   #6   #7
  66.   Enable Sync Negotiation     no   no   no   no   no   no   no   no
  67.   Enable FAST SCSI         no   no   no   no   no   no   no   no
  68.   Enable Disconnection         yes  no   yes  yes  yes  yes  yes  yes
  69.   Send Start Unit Command      no   yes  no   no   no   no   no   no
  70.   *(default is all yes for Enable Disconnection and all no for Send Start
  71.     Unit Command)
  72.  
  73.   Advanced Configuration Options
  74.   Floppy Controller I/O Port (AHA-1542CF only)            3F0h-3F7h
  75.   Reset SCSI Bus at Power-On                    Enabled
  76.   Host Adapter BIOS (Configuration Utility Reserves BIOS Space) Enabled
  77.   System Boot (INT 19h) Controlled by Host Adapter BIOS        Enabled
  78.   Extended BIOS Translation for DOS Drives > 1 GByte        Disabled
  79.   *Support Removable Disks Under BIOS as Fixed Disks        Enabled
  80.   Dynamically Scan SCSI Bus for BIOS Devices            Disabled
  81.   BIOS Support for More Than 2 Drives (MS-DOS(R) 5.0 and above) Disabled
  82.   Immediate Return On Seek Command                Enabled
  83.   Display <Ctrl><A> Message During BIOS Initialization        Enabled
  84.   *BIOS Support for Floptical Drives                Enabled
  85.   
  86.   Items with an asterisk are different from the default.  Sorry to
  87.   dump this whole options list for those who don't need it, but I
  88.   figured a few SCSI novices might appreciate it.  REMEMBER:  I think
  89.   that the only needed change is Enable Disconnection for the ID# of
  90.   your CD Writer.  Make it "no" instead of "yes".
  91.   
  92.   The result:
  93.   no panic; recognizes as CDROM drive (sr0); SCSI generic driver doesn't 
  94.   say anything either way, so couldn't tell if recognized
  95.  
  96.   2.4.  use mkisofs to produce binary image (I used mkisofs v1.00)
  97.  
  98.   e.g. "mkisofs -o /home/cd.image /home/dir_to_archive"
  99.   [I used mkisofs1.00, from tsx-11.mit.edu, at
  100.   /pub/linux/BETA/cdrom/mkisofs-1.00.tar.gz; version 1.01 is also 
  101.   available and would probably work even better].  Can also get
  102.   iso9660-diagnose.tar.gz from the same directory, which is another
  103.   cdrom tool (I haven't tried it).  See mkisofs usage in section 3.
  104.  
  105.   2.5.  make SCSI generic devices
  106.  
  107.   e.g. "/dev/MAKEDEV sg" (will create sga -> sgh; generic devices
  108.   are allocated/assigned at boot time).
  109.  
  110.   2.6.  realize that the SCSI generic driver isn't reading things correctly.
  111.  
  112.   Joseph Julicher at Rose-Hulman suggested a kernel hack to
  113.   process the SCSI inquiry byte (it needs a bitwise and with 0x1f).  I also
  114.   changed the TYPE_WORM drive to be writeable; not sure that this is
  115.   required for things to function correctly.  In fact, I made everything
  116.   writable (tacky, but effective!).
  117.   
  118.   The original /usr/src/{linux-1.1.64/}linux/drivers/scsi/scsi.c
  119.   (beginning around line 361)
  120.   
  121.       switch (type = scsi_result[0])
  122.     {
  123.     case TYPE_TAPE :
  124.     case TYPE_DISK :
  125.     case TYPE_MOD :
  126.       SDpnt->writeable = 1;
  127.       break;
  128.     case TYPE_WORM :
  129.     case TYPE_ROM :
  130.       SDpnt->writeable = 0;
  131.       break;
  132.     default :
  133.  
  134.   I changed it to:
  135.  
  136.       switch (type = scsi_result[0] & 0x1f)
  137.     {
  138.     case TYPE_TAPE :
  139.     case TYPE_DISK :
  140.     case TYPE_MOD :
  141.     case TYPE_WORM :
  142.     case TYPE_ROM :          /* probably shouldn't be writeable :) */
  143.       SDpnt->writeable = 1;
  144.       break;
  145.     default :
  146.  
  147.   2.7.  fix cdwrite (version that I changed was v1.3)
  148.   [I obtained cdwrite from tsx-11.mit.edu, at
  149.   /pub/linux/BETA/cdrom/private/mkisofs/cdwrite-1.3.tar.gz]
  150.   original program had following code (beginning around line 439):
  151.  
  152.      set_timeout(fd, timeout);
  153.  
  154.      /* First make sure we know how to talk to this writer */
  155.      inquiry (fd, &reply_len, &reply, &manufacturer[0], &model[0]);
  156.      if(strcmp(manufacturer,"PHILLIPS")) {
  157.  
  158.   I changed program to following:
  159.   (added the next two lines near the top)
  160.  
  161.     /* new #define from drivers/scsi/scsi.h; orig program had this defined */
  162.     #define SG_SET_TIMEOUT    0x2201
  163.  
  164.   (Following code replaced orig. code around line 439)
  165.  
  166.      /*   set_timeout(fd, timeout);*/
  167.      if (ioctl(fd, SG_SET_TIMEOUT, SG_SET_TIMEOUT, &timeout) < 0) {
  168.         perror ("ioctl SG_SET_TIMEOUT");
  169.         exit(5);
  170.      }
  171.  
  172.      /* First make sure we know how to talk to this writer */
  173.      inquiry (fd, &reply_len, &reply, &manufacturer[0], &model[0]);
  174.      if(strcmp(manufacturer,"IMS")) {
  175.  
  176.   Note that the Philips CDD 521 returns "IMS" as its manufacturer, and that
  177.   I used modified the newer program to set the timeout as the original
  178.   program did.  When you untar cdwrite, the original program is in the "orig"
  179.   directory.
  180.  
  181.   2.8.  recompile kernel and reboot for change to take effect
  182.  
  183.   Make sure to say yes to SCSI generic support, or else the generic driver
  184.   won't be included in the kernel.  You must reboot for the new kernel to
  185.   replace the currently running one.
  186.  
  187.   2.9.  write a CD!
  188.  
  189.   e.g. "cdwrite /dev/sgb < /home/cd.image"
  190.   Note that sgb was the CD writer, i.e. SCSI generic device b (because the 
  191.   hard drive was generic device a), and that /home/cd.image is an ISO9660 
  192.   image produced by mkisofs.
  193.  
  194.   3.  After the First Time
  195.  
  196.   That should take you through the process of getting ready to write one
  197.   CD.  After that things are trivially easy.  Make sure you have plenty o'
  198.   space on your disk.  Then just do "mkisofs -o filename path", where path
  199.   is the path of the directory tree to be copied into ISO9660 format, and
  200.   filename is the name of the resulting binary image.  The mkisofs program
  201.   has lots of other great options (like Rock Ridge extensions); check out
  202.   the man page that Eric Youngdale included for his program.  Next, do
  203.   "cdwrite scsi_device < cdrom_file", where scsi_device is the generic
  204.   SCSI device and cdrom_file is the ISO9660 image.  The cdwrite program also
  205.   has a few options, like -speed (to write single/double speed) and -dummy
  206.   (to test everything without actually writing the disk).  Check the cdwrite.c
  207.   program to see the options it has.
  208.  
  209.   4.  Thank you
  210.  
  211.   Thanks to all the people who wrote with suggestions for my problems; thanks
  212.   also to Eric Youngdale for the mkisofs code, Adam Richter for the original
  213.   cdwrite program, Joseph Julicher for noticing the SCSI generic problem, 
  214.   Mike McKenna for figuring out the 1542 settings, and my employers for 
  215.   paying me to explore with a neat toy.
  216.  
  217.