Title: CD-ROM Drives on Sun Hardware
Author(s): Kyle Downey <96kfd@williams.edu>
Last Modified: June, 1994
Version: 1.0

CHAPTER 1: INTRODUCTION AND SPECIAL INSTRUCTIONS
================================================
Format
------
	Although CHAPTER 2 and CHAPTER 3 look like a normal FAQ (a
list of questions followed by a section with answers), I have added a
section before that steps you through modifying a Toshiba XM-3401 for
use on a Sun and modifying a Sparcstation and Solaris to accept a
Toshiba or NEC drive that has not been so modified. Based on the half
megabyte of posts about CD-ROMs, a majority of users have problems
with this process and configuration.
	If you do not plan to use a Toshiba XM-3401/3301 or NEC
CDR-84.1 in PC-mode on a Sparc ROM rev. 2.3 (or later) running Solaris
2.x or modified for Sun mode on another configuration, search ahead
for CHAPTER 2: QUESTIONS and look for a question dealing with your
particular configuration. I broke the questions and answers (CHAPTER
3: ANSWERS) into subsections for further convenience.

Thanks
------
	Special thanks goes out to Jurgen Keil, Carl Mueller and Brent
Byer. Mr. Keil works for TooLs GmBh, a company that provides a
3rd-party CD-ROM driver; he stands as the most-quoted source in this
FAQ. Mr. Mueller and Mr. Byer both sent along their collections of
articles to add to my own. Thanks to them an others, I had half a
megabyte of information to turn into this FAQ.
	I cited each source below and literally quoted to separate my
own writing from that of others. Sometimes the technical explanation
was sufficiently clear and concise that any rewrite would be
pointless.

Finding This FAQ
----------------
	I will post this to alt.cdrom and comp.sys.sun.hardware, as
well as rtfm.mit.edu. I am not setting up a distribution list on email
for it, but if you send me mail asking for the FAQ I have no problem
with sending it to you. Give me a month and I will try to configure
some sort of auto-reply system.

Help, New Questions, Author, Author
-----------------------------------
	This FAQ is presently maintained by Kyle Downey at Williams
College, 96kfd@williams.edu--'at's me. I cannot promise frequent
updates (once every month or two) or answers to questions mailed to
me. I am open to any editorial criticisms or additions, though, so if
you have a new question and answer pair or a correction (spelling,
technical, grammatical, fashion, etc.), I will gladly add it to the
FAQ and credit you.
	This FAQ comprises everything I know on the subject, so if you
can't find it here, you will get no further by mailing me. Post to
alt.cdrom or comp.sys.sun.hardware; I will keep half an eye on each
group for threads that answer such questions and would appreciate your
bouncing mail to me if you get a reply that works. You can also help
by adding to the list of Winning Combinations (see below).
	If you think you have a firmer technical grasp and more time,
you can take over this FAQ.

Big Indrawn Breath
------------------
	Enough of this, let's get to the useful stuff.

Using a Toshiba 3401 CD-ROM Drive on a Sparcstation Running Solaris
-------------------------------------------------------------------
	Sun supports 2048 byte instead of 512 byte formatting, which
presents the first barrier to booting from or mounting a CD-ROM
designed for the PC or the Mac. If your Sparc has EEPROM revision 2.3
or later, your PROM can read 2048 bytes drives, but booting and
mounting will still fail because Sun sr() driver does not recognize
2048 byte sectoring. Sun also uses SCSI-II commands exclusively, so
SCSI-I drives will not work.
	You have two options: modify the drive so it uses the 512 byte
format or modify your system so it recognizes 2048 byte sectoring on
all levels. The first option requires physically modifying the drive
or (for some) flipping a switch; the second option requires a
Sparcstation with PROM revision 2.3 or higher and a kernel patch.
Either way, after you have made the changes, you will be able to use
any SCSI-II clone CD-ROM.

Option 1: Modify the Drive
--------------------------

	If you only use the drive for Sun hardware and/or if you do
not have a computer with the proper PROM revision, modifying the
drive is the easiest route. To make shipping drives for multiple
vendors easy, Toshiba has two connectors on the back of the drive's
circuit board. To modify the drive for 2048 bytes block size, take a
razor blade and cut the solder connecting the leads for each. To use
the drive with both a PC and a Sun, you will need to solder together a
simple switch.
	A pair of caveats:

1) Toshiba does not recognize or support this modification
2) this invalidates your warranty, so make sure the drive works before
you do it

	Here is the patch:
	"The 3301 and 3401 both have two jumper pads on the accessible back
part of the circuit board. The pads are solder joints shaped like two
sets of opposing half-moons.

	On the drives shipped to the PC market, both pairs are
jumpered.  On drives shipped to Sun, [both] of the pairs is cut.
Drives
shipped to SGI have a different combination cut. The two pad pairs are
labeled 0 and 1. The combinations are:

0       1       Selected Version
-----------------------------------------
Connect Connect Toshiba Standard Version
Connect Cut     512 Byte Block Length
Cut     Connect SGI Version
Cut     Cut     Intergraph/Sun Micro

You will quickly ascertain that once you cut a trace, your drive
is then altered for use on a different system. The only way to
go back and forth is to cut both traces and wire the pads to two
simple switches so you can set any of the four combinations as will. "

[The procedure came originally from the Sun Managers mailing
list. Copy courtesy: bwright@world.std.com (Barton Wright)]

	Here is a slighly more graphical version:

"Cut the pattern(between 2 pads, ``0'' and ``1'') near ID select
jumpers,
then you can use the drive for sun.

   0 v--- cut here
  -(|-|)-
  -(|-|)-
   1 ^--- cut here"

[Courtesy: futoshi@sra.co.jp (Futoshi Miyamori)]

	Once you have done this, your drive will use the Sun 512 byte
format. You will be able to boot from and mount CD's without any
problems. You will, however, have to deal with the "unrecognized
vendor" problem; only Hitachi and Sony are listed in the PROMs, so the
machine will enter a brief xenophobic mode that is completely
harmless; aside from a console message you should have no errors. Here
is an example:

"Jan 12 22:01:40 sparky vmunix: sr0: Unrecongized Vendor 'TOSHIBA ',
product
		'CD-ROM XM-3301TA'sr0 at esp0 target 6 lun 0"

[example courtesy thad@cup.portal.com (Thad P Floryan); information
>from  others who also had and diagnosed the vendor problem]

Option 2: Modifying Solaris
---------------------------

	If you have boot PROM revision 2.3 or later and either a NEC
CDR-84.1 or a Toshiba XM-3301/3401, you can boot the drives in normal
(2048 byte) mode and then use kadb and a kernel patch to convince sr
read 512-byte formatting. Note that this procedure lets you both
install and mount non-Sun CDs:

"Enable SCSI-2; in SCSI-1 mode the NEC requires 'Vendor unique' SCSI
commands that are not supported by Sun's cdrom driver.

With the NEC in SCSI-2 mode, one problem remains: NEC's cdrom drive
uses a default SCSI block size of 2048 bytes/block while sun's cdrom
driver assumes that a cdrom drive uses 512 bytes/block.  This can we
fixed by patching the harddisc driver (see the appended message for
the patch).  You can even boot Solaris 2.1 from cdrom by using kadb to
patch the harddisc driver during the boot process.

For installing Solaris 2.1 from a Toshiba XM-3[34]01 or a NEC CDR 84.1
CDROM drive you can use the following procedure:

  1. At the monitor prompt, boot kadb from the Solaris 2.1 CD
     (Btw. you need at least Boot Prom revision 2.4, older Boot
     Proms can't boot from a 2048 bytes/sector CDROM drive)

	ok boot cdrom kadb -d

     The monitor loads kadb an says something like

	Rebooting with command: cdrom kadb -d
	Boot device: /sbus/esp..../sd@6,0:c  File and Args: kadb -d
	kadb:

  2. At the kadb: prompt press , this will load
     /kernel/unix from the cd.

	kadb: /kernel/unix
	Size: xxx+yyy+zzz bytes
	/kernel/unix loaded - wwwwww bytes used
	kadb[0]:

  3. At the kadb[0]: prompt, set a breakpoint at main+10 and start the
     kernel:

	kadb[0]: main+10:b
	kadb[0]: :c

     The kernel starts and loads all required device drivers (esp. the
     harddisk driver, which we'll want to patch). Then it will stop at
     our  breakpoint.  The following messages appear on the screen:

	SunOS Release 5.1 Version ....
	  .
	  .
	  .
	breakpoint      main+10: call clkstart
	kadb[0]:

  4. Now the harddisk driver (which also supports cdrom drives) is
loaded
     and we can install the patch: Again at the kadb[0]: prompt type

	kadb[0]: sr_mode_select+24?W 2d054400 ec27bff8

     Before patching, you might want to verify the original code: Type

	kadb[0]: sr_mode_select?i

     and some more returns. The original code should look like this:

	sr_mode_select:                 save    %sp, -0x68, %sp
	sr_mode_select+4:               mov     0x24, %o0
	sr_mode_select+8:               call    sr_mode_select + 8
	sr_mode_select+0xc:             clr     %o1
	sr_mode_select+0x10:            mov     %o0, %i5
	sr_mode_select+0x14:            add     %fp, -0x8, %o0
	sr_mode_select+0x18:            call    sr_mode_select + 0x18
	sr_mode_select+0x1c:            mov     0x6, %o1
	sr_mode_select+0x20:            stb     %i2, [%fp - 0x4]
	sr_mode_select+0x24:            mov     0x15, %l6
	sr_mode_select+0x28:            stb     %l6, [%fp - 0x8]
	sr_mode_select+0x2c:            add     %fp, -0x8, %l7

     After the patch is installed, we have

	sr_mode_select+0x24:            sethi   %hi(0x15100000), %l6
	sr_mode_select+0x28:            st      %l6, [%fp - 0x8]

  5. Continue the installation with :c at the kadb[0]: prompt

	kadb[0]: :c

The kernel will complain once about a data overrun on the first access
to the CDROM, but should have no further problems with the Toshiba/NEC
CDROM drive.

[note: you will also get a message regarding "unrecognized vendor"
--ed]

The same patch can be used on an already installed Solaris 2.1 system:
As root, type:

	# cp /kernel/drv/sd /kernel/drv/sd.orig
	# adb -w /kernel/drv/sd
	sr_mode_select+24?W 2d054400 ec27bff8
	$q
	#

and reboot.

With this patch installed you can access mode1 data cds and audio cds
(with x_cdplayer, workman).  To make use of the other features of the
Toshiba drives (reading XA type discs (Electronic Book CDs, Photo
CDs), multisession discs (PhotoCD) or the digital audio samples from
audio tracks) you'll need a third party scsi target driver (e.g our's
:-), though. "

[courtesy jk@tools.de (Juergen Keil); his company is mentioned under
the question regarding third-party drivers --ed]

CHAPTER 2: THE QUESTIONS
========================
Ok, I hope that introduction gets a lot of you out of the blocks.
However, not everyone owns a Sparc with recent boot PROMs and uses
Solaris 2.x with a Toshiba or NEC drive! The remainder of this FAQ
will address the following questions:


Section 1: Background Information
---------------------------------
Q1) Where can I find out more?
Q2) What are the relevant newsgroups?
Q3) As as overview, what are my options for using a CD-ROM on a Sun?
Q4) What drives have been shown to work?
Q5) What is doomed to fail?
Q6) What are the specifications of the SunCD/SunCD+

Section 2: Booting a Sun from a Non-Sun CD-ROM
----------------------------------------------
Q7) I just modified the drive according to these directions. It boots
fine, but I get an "unrecognized vendor" error. Is this a problem?
Q8) What do you do if you have an old Sun that doesn't know about boot
cdrom (or CD-ROMs for that matter)?
Q9) Can I make a bootable tape from a CD?
Q10) Not to look a gift horse in the mouth, but why does my AppleCD
300
work for booting and mounting?

Section 3: Mounting Discs
-------------------------
Q11) If I have a drive that has 2048 bytes/block and want to be able
to
mount it (but not boot), what are my options?
Q12) Why does SunOS 4.1.1 bomb when I try to mount CD-ROM discs and
what
can I do about it?
Q13) Why can't I mount certain ISO-9660 discs and what does XAR have
to
do with it?
Q14) How can I set up my kernel and drive to mount all 6 discs from a
Pioneer multi-disk CD-ROM reader?
Q15) If I mount a PC-format CD, will SoftPC let DOS applications
access it?
Q16) If none of this works, is there any other way to access a PC
CD-ROM?

Section 4: SunCDs on Other Computers
------------------------------------
Q17) How do I mount a SunCD on my Macintosh, assuming I have the right
cabling?
Q18) How do I use a SunCD under DOS?

Section 5: Multimedia
---------------------
Q19) Can I use a CD-ROM to play audio CD's? What programs are
available?
Q20) My NEC CDR-1750 works fine as a drive, but I can't get it to play
audio CD's with workman, x_cdplayer, etc. How can I get it to work?
Q21) Can I record audio tracks on a Sparcstation?
Q22) Can I digitize audio tracks over the SCSI bus? (CDDA tracks)
Q23) Why can't I read Electronic Books discs?
Q24) Why can't I mount any XA discs (such as multisession PhotoCDs)?
Q25) Are there any PD/shareware utilities for reading and converting
PhotoCD images?
Q26) OK, ALREADY! I get the point that multimedia features don't work
well with all of the solutions presented above? What are my options?


CHAPTER 3: THE ANSWERS
======================
Section 1: Background Information
---------------------------------
Q1) Where can I find out more?

	Grab the alt.cdrom FAQ from rtfm.mit.edu; it has a great deal
of general information about CD-ROM drives. If you are interested in
seeing the technical innards, Linux source is one route:

"You could look at the linux CDROM file system sources, they're
available on tsx-11.mit.edu and AFAIK it fully implements the ISO
format with rock ridge extensions. "

[courtesy  (Derek Fawkus)]

Toshiba has specifications for its drives available for $15 if
you want to write a Toshiba driver yourself.

[courtesy rkling@austin.intel.com (Ralph Kling)]


Q2) What are the relevant newsgroups?

	If you have an additional question, post to alt.cdrom or
comp.sys.sun.hardware.

Q3) As as overview, what are my options for using a CD-ROM on a Sun?

	You can purchase a SunCD or SunCD+ from Sun, a reseller or
used. Pros: this guarantees you almost complete compatibility for
booting and mounting typical data CDs and audio CDs on a wide range of
Sun hardware. Even if your PROMs are not aware of CD-ROMs, you can
fool them into recognizing the CD as a boot device. Cons: the drives
are neither the fastest nor the least expensive, to say the least. You
are restricted to 512 byte/block mode, so the drive cannot be used on
a Mac or PC without special software.
	If you don't want to go the Sun route and want to be able to
boot from the drive, you must get a CD that has Sun-compatible PROMs
available, a DIP switch or some hack (such as the Toshiba method
outlined above) that allows you to switch from 2048 byte/block mode to
512 byte/block mode. If you want to be able to mount discs, you
can usually patch the kernel so it will recognize 2048 byte-format
discs.
	Either way, keep these caveats in mind: 1) SunOS 4.1.x has
SCSI ID 6 hard-wired into the kernel, so if you try to mount or boot
>from  any other location it will fail. 2) only SCSI-2 drives will work,
period. 3) unless you purchase a $400+ third-party SCSI driver, many
of the advanced multimedia features (multisession XA discs,
multisession PhotoCD discs, direct digital sampling) will be out of
reach. Solaris 2.2 supports multi-session CD access, but only with the
SunCD+.

Q4) What drives have been shown to work?

	The following information provides no explicit endorsement for any
of these products other than the fact that 'Net users posted success
using them with Suns; any configuration-specific details are listed
with the comments:

Drive: Anadacto
---------------
Courtesy: ggall@netlink.nix.com (George Gall)
Comments: Not much information on this, but it's supposed to be a
clone Sun drive; should work right out of the box.

Drive: Apple CD300
------------------
Modification -> Sun: none needed
Sun Version?: no
Courtesy: jk@tools.de (Juergen Keil)
Comments: this drive is nearly-identical to the SunCD. The Sony inside
will accept the MODE SELECT command and switch to 512 byte mode. While
mounting and initializing, it will complain, but will work.

Drive: Chinon 535
-----------------
Modification -> Sun: switch EPROMs ($20)
Sun Version?: order with Sun EPROMs pre-installed
Courtesy: zbig@junior.wariat.or
Comments: swapping EPROMs is a pain if you switch machines often

Drive: DEC RD42
---------------
Modification -> Sun: none
Sun Version?: no
Courtesy: Gordon Vickers 
Comments: make sure the SCSI ID number is 6; should work transparently

Drive: Denon DS-253
-------------------
Modification -> Sun: none, maybe PROM switch
Sun Version?: *unknown*
Courtesy: ishikawa@ds5200.personal-media.co.jp (Chiaki Ishikawa)
Comments: can be used to mount CDs with kernel patch but cannot boot
unless used with a Sparc with the right patch and ROM revision;
apparently there is a Hitachi drive hiding under the label

Hitachi CDR-1750S
-----------------
Modification -> Sun: DIP switch on back for 512/2048 modes
Sun Version?: yes
Courtesy: bob@sna.co.umist.ac.uk (bob nutter)
Comments: will get "unrecognized vendor error"; it also has a problem
with the command set definition so it will not play back (to the Sun)
any audio track from a multi-media disc. [additional courtesy Robert
Bonomi ]

Drive: NEC CDR-84.1
-------------------
Modification -> Sun: none, maybe PROM switch
Sun Version?: yes
Courtesy: jk@tools.de (Juergen Keil)
Comments: as with the Denon, unless there is a PROM swap available,
this drive can only be used with a modified copy of Solaris and
ROM rev. 2.3 or higher. Note: make sure it is in SCSI-2 mode (there
is a DIP switch). Do not confuse the drive with its sibling the
CDR-84; the 84 will not work because it is straight SCSI-1.

Drive: Pioneer DRM600
---------------------
Modification -> Sun: DIP switch on back for 512/2048 modes
Sun Version?: yes
Courtesy: dclunie@sirius.ucs.adelaide.edu.au (David Clunie)
Comments: 6-disk changer, can be made to work with all six (see
question below)

Drive: Plextor-Texel 5028/3028 (ext/int)
------------------------------
Modification -> Sun: DIP switch on back for 512/2048 modes
Sun Version?: built-in
Courtesy: zbig@junior.wariat.org (Zbigniew J. Tyrlik)
Comments: high 'Netcommendations for ease-of-switch from Sun->PC

Drive: Toshiba 3201/3301/3401
-----------------------------
Modification -> Sun: the pad-cutting hack mentioned above
Sun Version?: 3301U/3401U
Courtesy: jk@tools.de (Juergen Keil)
Comments: the switch allows moving from PC to Sun and back more easily
 than a PROM swap, but it is a hack and voids your warranty.

Drive: Toshiba XM4401B
----------------------
Modification -> Sun: *unknown* (see below)
Sun Version?: XM440U (presumably)
Curtesy: elfchief@lupine.org
Comments: I am basing this on one article from elfchief@lupine.org,
who
 got it to work on a Sparcstation 1+. It tries to initialize the
drive,
 then gives "serious error in phase. " Turning off the drive breaks
the
 hang when he mounts it. This drive _should_ work if you turn off
 synchronous I/O on the kernel level. Please add to this.

Drive: Sony CDU-541/561/8012
----------------------------
Modification -> Sun: none
Sun Version?: SunCD, SunCD+
Courtesy: bhepple@hk.net (Bob Hepple)
Comments: You can install Solaris 2.x from these drives with
the 2048 byte blocksize with Boot Prom Rev 2.3 or higher.


Q5) What is doomed to fail?

	I culled these stories from the bleeding edge of alt.cdrom and
other sources. If you know the cause of the problem or have succeeded
with these copies, mail a solution to the listed address and cc: a
copy
to me so I can add the solution to the FAQ

Configuration: Sun 3/80 + any CD
--------------------------------
Courtesy: uunet!cs.bham.ac.uk!A.H.Speedie-SE0 (Andrew Speedie)
Comments: no success at all

Configuration: NEC CDR-73 on Sun-3
----------------------------------
Courtesy: 
Comments: generated so many SCSI errors that it corrupted the hard
drive; using SCSI-2 and SCSI-3 host adaptors. Another caveat from
ishikawa@ds5200.personal-media.co.jp (Chiaki Ishikawa): turning off
the CD-ROM during operation causes disk errors.

Add more or correct these, please!


Q6) What are the specifications of the SunCD/SunCD+?

	The SunCD is a repackaged Sony CDU-8012, while the SunCD+ is a
CDU-561. Both are the versions with 512 byte/block functionality, but
they support a MODE SELECT command to change mode from 2048 to 512 if
so configured.

Section 2: Booting a Sun from a Non-Sun CD-ROM
----------------------------------------------
Q7) I just modified the drive according to these directions. It boots
fine, but I get an "unrecognized vendor" error. Is this a problem?

	There will not be any errors; all the system is telling you is
that the sr driver does not recognize anything other than Sony and
Hitachi (SunOS 4.1.3). You can try to correct this if you are into
hacking:

"If you've got the source of the SunOS CDROM device driver (sr.c), you
could
add a line to the sr_drivetypes[] array of structures and specify the
Toshiba and its (SCSI) capabilities. "

[courtesy adrie@ica.philips.nl (Adrie Koolen)]


Q8) What do you do if you have an old Sun that doesn't know about boot
cdrom (or CD-ROMs for that matter)?

	The generic practice is ">b sd(,30,1)"; that seems to have
worked in mant cases. At issue is where on the disc Sun has placed the
various architectures. There has been some `Net debate about this. I
found this table, but cannot confirm it:

"       0 .. mountable HSFS format
	1 .. sun4  bootable image       > b sd(,18,1)
	2 .. sun4c bootable image       > b sd(, 6,2)
	3 .. sun3x bootable image       > b sd(,30,3)
	4 .. sun3  bootable image       > b sd(,30,6)"

[courtesy Yutaka.Matsumoto@Japan.Sun.COM (MATSUMOTO Yutaka - Nihon Sun
Engineer) and doleh@mcs.kent.edu (Yaser Doleh)]

my own experience contradicts this, incidentally: my Sun 4/110 booted
with b sd(0,30,1). Please clarify this if you can.


Q9) Can I make a bootable tape from a CD?

	In short, yes. Sun no longer offers SunOS on tape, but clone
manufacturers do [courtesy Carl Mueller ]. If you
do not have a tape drive attached to your system, you can either use
one of these clone tapes, set up another machine as a boot server or
install on another machine and move the disk. If none of these options
appeals to you and you have access to a CD that you can mount but from
which you cannot boot, you can make your own boot tapes:

"Select the appropriate MUNIX file for your KARCH:

	karch   file                    CDROM partition
	-----   ----                    ---------------
	sun4    MUNIX-sun4-4.1.3        1
	sun4c   MUNIX-sun4c-4.1.3       2
	sun4m   MUNIX-sun4m-4.1.3       3

	The only way I know to copy MUNIX off of CDROM is using SunOS
5.x
	(Solaris 2.x).  If some clever person knows how to do this
using
	SunOS 4.1.x, I would like to hear from you.

	Note: The 4.1.3 CDROM MUNIX differs from the 4.1.1 QIC MUNIX
	in that the CDROM MUNIX has the MUNIX kernel and the MUNIX
filesystem
	combined together.  In other words, you no longer need to load
the
	MUNIX filesystem after booting the MUNIX kernel.


Mount your CDROM and select the appropriate miniroot for your KARCH:

	karch   file
	-----   ----
	sun4    /cdrom/export/exec/kvm/sun4_sunos_4_1_3/miniroot_sun4
	sun4c
/cdrom/export/exec/kvm/sun4c_sunos_4_1_3/miniroot_sun4c
	sun4m
/cdrom/export/exec/kvm/sun4m_sunos_4_1_3/miniroot_sun4m


Build your QIC-150 tape as follows:

	mt -f /dev/nrst0 rew
	dd if=MUNIX    of=/dev/nrst0 bs=8k conv=sync
	dd if=miniroot of=/dev/nrst0 bs=100k conv=sync

	You may also want to dump a copy of your "/" and "/usr"
filesystems
	to the end of tape as once booted you won't be able to run
SunInstall
	(for obvious reasons).


The procedure to boot MUNIX from tape is as follows:

	Press L1-A (i.e. STOP-A) to enter console mode and type:
	ok> boot tape

	Make the following selection when asked:
	2 - exit to single user shell

	Format and/or partition your disk if necessary.

	Copy miniroot to disk:
	(You have to do this step manually, as the automated procedure
	 will attempt to copy it from CDROM.)
	# mt -f /dev/rst0 rew
	# mt -f /dev/nrst0 fsf 1
	# dd if=/dev/nrst0 of=/dev/rsd0b bs=100k conv=sync


The procedure to boot the just loaded miniroot is as follows:

	Press L1-A (i.e. STOP-A) to enter console mode and type:
	ok> boot disk:b -sw

	Once miniroot is booted you can then restore your "/" and
"/usr"
	partitions from tape, etc. "

[Courtesy markb@elen.utah.edu]


Q10) Not to look a gift horse in the mouth, but why does my AppleCD
300
work for booting and mounting?

As mentioned above in the brief review of the AppleCD 300, the Apple
is an OEM Sony drive, just as the SunCD is. Consequently, it is the
correct vendor (Sony) _and_ it will respond to the MODE SELECT command
>from  the system. Thus, when the Apple is brought on-line, it tells the
system that it uses 2048 bytes/block, which generates an error.
the system responds by telling the drive to switch to 512 bytes/block.
Thus, you can mount and boot from an AppleCD. Contrast this to what
happens with a NEC or Toshiba drive: the command is ignored, so it
stays in the improper mode, causing the boot or mount to fail.


Section 3: Mounting Discs
-------------------------
Q11) If I have a drive that has 2048 bytes/block and want to be able
to
mount it (but not boot), what are my options?

There are several solutions out on the 'Net for changing the default
block size to 512 bytes. If you followed the above advice for Solaris
2.x, you have already patched the kernel and should have no problems.
If you use it on SunOS 4.x, you will need to patch the driver so it
can read discs with XAR (see below).
	There can also find programs that change the block size. Every
time you reboot you will have to run this program before booting:


"Here is the program to set the transfer length to 512 bytes:

	# include 
	# include 
	# include 
	# include 
	# include 
	# include 

	# include 

	char cdrom[] =  "/dev/rsr0";

	extern char *   cdrom_status();

	/* group 0 commands */

	#define TEST            0x00
	#define REZERO          0x01
	#define SENSEREQ        0x03
	#define READ            0x08
	#define SEEK            0x0b
	#define NOP             0x0d
	#define INQ             0x12
	#define MODESEL         0x15
	#define RESERVE         0x16
	#define RELEASE         0x17
	#define MODESENSE       0x1a
	#define STARTSTOP       0x1b
	#define DIAGRCV         0x1c
	#define DIAGSND         0x1d
	#define MEDIUMLOCK      0x1e

	/* group 1 commands */

	#define READCAP         0x25
	#define READEXT         0x28
	#define SEEKEXT         0x2b

	/* group 6 commands */

	#define AUDIOTRACK      0xc0
	#define AUDIOPLAY       0xc1
	#define AUDIOSTILL      0xc2
	#define AUDIOSTOP       0xc3
	#define EJECT           0xc4
	#define CLOSE           0xc5
	#define AUDIOSUB        0xc6
	#define AUDIODISK       0xc7
	#define ROMMODE         0xc8

	/***/

	#define CMDLEN(cmd) ((cmd >= 0x20) ? 10 :  6)

	/***/

	main() {
		int                     fd;
		int                     i;
		struct uscsi_cmd        ucmd;
		char *                  s_command;
		char *                  s_buffer;

		if ((fd = open(cdrom, 0)) == -1) {
			fprintf(stderr, "open: ");
			perror(cdrom);
			exit(1);
		}
		s_command = (char *) malloc(10);
		if (s_command == NULL) {
			printf("malloc error (command)\n");
			exit(-1);
		}
		bzero(s_command, 10);
		s_buffer = (char *) malloc(256);
		if (s_buffer == NULL) {
			printf("malloc error (buffer)\n");
			exit(-1);
		}
		bzero(s_buffer, 256);
		s_command[0] = MODESEL;
		s_command[1] = 0x10;
		s_command[4] = 12;
		s_buffer[3] = 0x08;
		s_buffer[10] = 0x02;
		ucmd.uscsi_cdb = s_command;
		ucmd.uscsi_cdblen = 6;
		ucmd.uscsi_bufaddr = s_buffer;
		ucmd.uscsi_buflen = 4096;
		ucmd.uscsi_flags = USCSI_WRITE;
		i = ioctl(fd, USCSICMD, ucmd);
		close(fd);
		exit(i);
	}

Please mail the author of the program with questions. Another user
posted the method below for mounting Toshiba XM3401B discs (i.e. it
also changes the blocksize). Since I do not have the hardware on hand
to check either solution, I will just present the alternatives. Please
send me feedback if either one does not work:

"Changing the block size using a user SCSI command with Solaris 1.x:
#include 
#include 
#include 
#include 

struct  uscsi_cmd       usc;
union   scsi_cdb        cdb;
u_char  cd_mode[] = { 0, 0, 0, 0x8, 0, 0, 0, 0, 0, 0,
	0x2,    /* 0x2 = 512, 0x8 = 2k */
	0 };

main()
{
    int cfd;

    if ((cfd = open("/dev/rsr0", O_RDONLY | O_NDELAY)) < 0) {
	perror("open");
	exit (1);
    }

    cdb.cdb_un.cmd = SCMD_MODE_SELECT;
    cdb.g0_count0 = sizeof(cd_mode);

    usc.uscsi_cdb = (caddr_t) &cdb;
    usc.uscsi_cdblen = CDB_GROUP0;
    usc.uscsi_bufaddr = (caddr_t) cd_mode;
    usc.uscsi_buflen = sizeof(cd_mode);
    usc.uscsi_flags = USCSI_DIAGNOSE | USCSI_ISOLATE;

    if ((ioctl(cfd, USCSICMD, (struct uscsi_cmd *) &usc)) < 0) {
	perror("USCSICMD ioctl");
	exit (1);
    }
    exit(0);
}"


Q12) Why does SunOS 4.1.1 bomb when I try to mount CD-ROM discs and
what
can I do about it?

	SunOS 4.1.1 has problems with mounting ISO 9660 discs;
resultingly, it turns the mount directory into a data file. In the
case cited, a user typed

mount -rt hsfs /dev/sr0 /hsfs

and was rewarded with a 202 byte file for /mnt. Here is the solution:

"Again I got a few replies, and the solution in SunOS 4.1.1 is to
implement:

   Patch-ID# 100217-01
   Synopsis: mounting certain iso 9660 cd's succeed but directory
becomes data
   Date: 04/Feb/91
   BugID's fixed with this patch:1047295

Another solution is to upgrade to SunOS 4.1.2."

[courtesy thorsen@stc.nato.int (Einar C. Thorsen)]


Q13) Why can't I mount certain ISO-9660 discs and what does XAR have
to
do with it?

The best explanation for this I could find came from Peter Ford at
MIT. He also offers a way around the problem:

"t the raw level, all CD-ROMs appear identical to the reader--they
consist of a fixed number of 2048 byte physical blocks (sectors).
Under
the standard SunOS 4.1.x configuration, you could access any block on
the disk by opening /dev/rsr0 and calling lseek() and read(), as does
my "cdio" package, see below.

[Note: this is not -exactly- true; a CD-ROM reader uses -logical-
blocking; this is what lets a SCSI command (MODE SELECT) be used to
switch between 512- and 2048-byte mode on Sony-based drives like the
AppleCD -- see explanation above. --ed, original correction courtesy
olson@zuni.esd.sgi.com (Dave Olson)]

Higher-level CD-ROM access is performed by software. This is where the
disk format matters--the most popular current choices among system-
independent formats are "High Sierra" and its international extension:
ISO-9660.  Other CD-ROMs are written in a machine-dependent format,
e.g. as {VMS,Macintosh,UNIX} file systems which are intended to be
accessed only by those operating systems.

SunOS 4.1.x contains software that lets you "mount" SunOS, High
Sierra,
and ISO-9660 disks. For SunOS disks, use the "-t 4.2" option. For the
other two formats, use "-t hsfs" (having made sure that the HSFS
option
was selected in the SunOS system configuration file!)  In either case,
use the /dev/sr0 device name. Once mounted, you can access the
contents
as a tree of directories and files. If you are going to export the
disk to NFS users, be sure to include the "ro" option in your local
/etc/exports file.

One problem should be mentioned in the context of the ISO-9660 format.
This ISO standard allows for an "extended attribute record" (XAR) to
be
associated with each file on the CD-ROM. This is for the convenience
of
those operating systems, e.g. VMS, that need additional data on file
formats (e.g. logical blocking information and record lengths).
Current versions of SunOS will refuse to open any file that possesses
an XAR. I'm told that this situation will be fixed in the next
incremental SunOS release. Meanwhile, I know of two alternatives if
you
need to read such a disk:

(1) access the disk as a raw device using the PD "cdio" software
    package available from the anonymous ftp server "space.mit.edu"
    [18.75.0.10]. The file is "src/cdio.shar". This gives you an
    interface to the CD-ROM that is similar to "ftp".

(2) get the patch "src/SunOS.4.x.CD-ROM.patch" from the
"space.mit.edu"
    server and apply to your SunOS. It by-passes the XAR checking-code
    in the SunOS kernel.

The above discussion applies only to the Sun CD-ROM drive and SCSI
interface. Some earlier drives couldn't access all possible High
Sierra
+r ISO-9660 disks because their SCSI interfaces didn't support sub-
sector addressing, needed because these disk formats use the concept
of
a virtual disk block size that can differ from the 2048-byte sector
size. "

[courtesy pgf@space.mit.edu (Peter G. Ford)]

Q14) How can I set up my kernel and drive to mount all 6 discs from a
Pioneer multi-disk CD-ROM reader?

	Without any special driver, Mr. Clunie managed to get the
following to work without any problems:

	-mounting and reading HSFS discs
	-mounting and reading Sun UFS discs
	-mixing both (note: 2nd access hanges until first unmounted)
	-booting mini-root off one CD
	-installing SunOS 4.1.2
	
	The Pioneer has a DIP switch on the back for setting to Sun
mode, so these successes are not too surprising. However, in his
article he explained how to mount all six discs sequentially without a
special driver:

"Add the following to your kernel:

disk sr0 at scsibus0 target 6 lun0      #CD-ROM drive
disk sr1 at scsibus0 target 6 lun1      #CD-ROM drive
disk sr2 at scsibus0 target 6 lun2      #CD-ROM drive
disk sr3 at scsibus0 target 6 lun3      #CD-ROM drive
disk sr4 at scsibus0 target 6 lun4      #CD-ROM drive
disk sr5 at scsibus0 target 6 lun5      #CD-ROM drive

Make the following devices in /dev:

mknod sr1 b XX 8
mknod sr2 b XX 16
mknod sr3 b XX 24
mknod sr4 b XX 32
mknod sr5 b XX 40

mknod rsr1 c YY 8
mknod rsr2 c YY 16
mknod rsr3 c YY 24
mknod rsr4 c YY 32
mknod rsr5 c YY 40

The devices may already be there ... mine were. "

[courtesy dclunie@sirius.ucs.adelaide.edu.au (David Clunie)]

	In short, treat the Pioneer like six different CD-ROM drives;
SunOS will not be able to tell the difference so long as you have the
right driver for each one and set the lun properly.


Q15) If I mount a PC-format CD, will SoftPC let DOS applications
access it?

	Yes. As far as your DOS applications are concerned, it will
look like a regular DOS CD-ROM. Here's how you do it:

"as root:
$ mkdir /cdrom
$ mount -rt hsfs /dev/sr0 /cdrom

in DOS:
C:\> net use g: /cdrom"

[courtesy pek@logos.res.utc.com (Paul Kirschner)]


Q16) If none of this works, is there any other way to access a PC
CD-ROM?

	One 'Netter pointed out that you don't always need a PC CD-ROM
hooked up to your Sun:

"Some folks may be like me - they have a PC clone w/ CD-ROM, and also
a
Sun workstation (4/110 in my case).  I just want to load some CD_ROM-
distributed software onto the Sun.  I futzed around a few days trying
to make the Sun talk SCSI to the CD-ROM with no joy.  Then I realized
that $60 gets an ethernet board for the PC, and there's enough
freeware
& shareware around (I'm using Trumpet Winsock & WFTPd) to just FTP
the stuff over from a CD-ROM mounted on the PC.  The only thing that's
not smooth for me is automatically converting the Rock Ridge
filenames."

[courtesy harr@netcom.com (Charles (Chuck) Harrison)]

	You can also try to use dd to read the information directly:

"Here's a thought: WITHOUT mounting the troublesome CD-ROM (but having
it in the drive), do something like:

	dd if=/dev/rsr0 of=/tmp/foo count=20
		   ^
		   Note the "r"

and then do the same using a CD-ROM with which you have no trouble
mounting.

Using Emacs (or some binary comparator), determine the differences
between
the two extracted CD-ROM headers.  The ISO-9660 and RockRidge formats
are
documented at (I believe) cdrom.com for ftp in the pub directory.

The "count=20" may be too much (or too little); read what the specs
state."

[courtesy thad@cup.portal.com (Thad P Floryan)]

Section 4: SunCDs on Other Computers
------------------------------------
Q17) How do I mount a SunCD on my Macintosh, assuming I have the right
cabling?

"Supposedly Optical Media International
	  180 Knowles Drive
	  Los Gatos CA 95030
	  408-376-3511
sells software for using Sun CD-ROM wth a Mac."

[courtesy schwer@unix.sri.com (Leonard E. Schwer)]


Q18) How do I use a SunCD under DOS?

"On ftp.germany.eu.net:/pub/comp/msdos/utils/cdblksize.zip is a small
utiliy, that allows the use of the SunCD drive (512 bytes/block) under
MSDOS.  The utility requires an APSI interface to the cdrom drive
(e.g.  Adaptec SCSI controller + ASPI4DOS). "

[courtesy jk@tools.de (Juergen Keil)]


Section 5: Multimedia
---------------------
Q19) Can I use a CD-ROM to play audio CD's? What programs are
available?

	Look for x_cdplayer, xcdplayer, xcd and Workman:

ftp: space.mit.edu :/src/xcd.tar.Z (xcd)
ftp: sparc.mit.edu :/usr/demo/CDROM/x_cdplayer (x_cdplayer)

	They should run under SunOS 4.1.x with any drive that normally
boots and/or mounts on a Sun.

[courtesy guy@Auspex.COM (Guy Harris)]

"The best CD player program I've seen is Workman, a complete CD player
with a song database, a variety of play options, and even the kitchen
sink!  You can get Workman 3.1beta and a starter song database by
anonymous ftp to ftp.hyperion.com in the /Workman directory.  Enjoy!"

[courtesy jback@East.Sun.COM (Joe Backo - Special Projects Mgr Sun
Baltimore,Md.)]


Q20) My NEC CDR-1750 works fine as a drive, but I can't get it to play
audio CD's with workman, x_cdplayer, etc. How can I get it to work?

" The CDR-1750 is not SCSI-2 compliant and uses vendor-unique commands
for audio playback.  The only UNIX-based CD player that supports the
Hitachi is xmcd, written by yours truly.  The source code to xmcd-1.1
is available via anonymuos FTP:

	ftp.x.org:/contrib/xmcd-1.1.README
	ftp.x.org:/contrib/xmcd-1.1.tar.gz

Also available is a 1600+ CD database for xmcd:

	ftp.x.org:/contrib/xmcd-cddb.README
	ftp.x.org:/contrib/xmcd-cddb.tar.gz

Xmcd requires Motif to compile.

Special Note for SunOS 4.1.x/Solaris 1.x (sparc):
Although xmcd-1.1 supports SunOS 4.1.x, you will run into
problems playing audio using the Hitachi CDR-1750S.
This is because SunOS 4.1.x has a bug in its SCSI CD-ROM
driver that makes it malfunction when delivering 12-byte
SCSI commands, which the Hitachi require for audio playback. "

[courtesy ti@bazooka.amb.org (Ti Kan)]


Q21) Can I record audio tracks on a Sparcstation?

If you have the proper cabling, you can simply plug the audio output
into the audio input on the Sparcstation and use Audiotool to record
normally. This is not the same as digitizing.


Q22) Can I digitize audio tracks over the SCSI bus? (CDDA tracks)

	Not without a third-party driver (which see).


Q23) Why can't I read Electronic Books discs?

	The Electronic Books discs are multisession, so you cannot
read them without a third-party driver (which see).


Q24) Why can't I mount multisession PhotoCDs?

"[T]he filesystem on a PhotoCD is ISO 9660 (at least the first
session).  And on a multisession PhotoCD it's still pretty close to
ISO 9660, the only difference is that the 'volume descriptor sequence'
doesn't start at sector #16 but at sector #'first block of last
session + 16'.

PhotoCDs are XA discs recorded in Mode-2/Form-1, while ordinary cdrom
discs are recorded in Mode-1.  And that's also the reason why the
Toshiba drive refuses to access PhotoCD discs, you have to switch the
drive into CDROM/XA mode before you can access PhotoCDs.
Unfortunatelly the Toshiba drives can't read 512 bytes/sector in XA
mode, so you have to use a third party cdrom driver (that supports XA
reading, 2K sectors and multisession) to access PhotoCDs on a Sun with
a Toshiba drive.

The SunCD drive and Pioneer's DRM-604x automatically detect
Mode-2/Form-1 discs and switch transparently into XA mode, so that you
can use the drives with Sun's sr(7) cdrom drive to mount
(singlesession) PhotoCDs. "

[courtesy jk@tools.de (Jurgen Keil)]

It is possible to mount multisession discs with a third-party driver.


Q25) Are there any PD/shareware utilities for reading and converting
PhotoCD images?

	Yes! I came across a reference to one:

"[I] have posted the Versions v0.1 and v0.2 of my
Photo-CD-to-PPM Converter hpcdtoppm to alt.sources some
days ago. It runs on Unix machines, but it should not be difficult
to port to other machines. It reads all resolutions of a normal
Photo-CD. Some ftp-Servers keep v0.1, i will try to put v0.2 on
Servers. I have also put three images on a german ftp-Server.

The images are at switek.uni-muenster.de = 128.176.120.210 in
directory /pub/pictures/PCD. "

[courtesy danisch@ira.uka.de (Hadmut Danisch)]


Q26) OK, ALREADY! I get the point that multimedia features don't work
well with all of the solutions presented above. What are my options?

	If you want to explore multimedia functions with your Sun, you
will need a third-party SCSI driver. There is one exception: "SunOS
5.3 has support for multisession, but this only works with Sony CDROM
drives (SunCD+, CDU-561)" [courtesy jk@tools.de (Jurgen Keil)]
	Here are a few firms to try:

	Instar                  Voice: 403-264-7274
	Suite 306               Fax: 403-264-7286
	205 9th Avenue S.E.
	Calgary, Alberta
	Canada T2G 0R3

	Kintronics Computer Products
	914-347-2530 or 800-431-1658

	Relax Technology        Voice: 510-471-6112
	3101 Whipple Road       FAX: 510-471-6267
	Union City, CA 94587

	Tracer Technologies             Voice: 800-872-2370
	19584 Clubhouse Road            Voice: 301-977-1398
	Gaithersburg, MD 20879            FAX: 301-869-7033

	Young Minds             Voice: 714-335-1350
	(southern California)

[courtesy dclunie@sirius.ucs.adelaide.edu.au (David Clunie) and
wbe@bbn.com (Winston Edmond)]

	Since Mr. Keil provided so much for this FAQ, I think I owe
him an ad in his own words:

"We (Tools GmbH) sell [a driver] that supports Toshiba XM-3401B, NEC
CDR-84.1,
Sony CDU-561, and SunCD.

The driver support multisession & CDROM/XA formats, both for SunOS 4 &
5.

Contact info@tools.de for additional information."