Modifying Solaris 2.1 for PC type CD-ROM drives

If you have boot PROM revision 2.3 or later and either a NEC CDR-84.1 or a Toshiba XM-3301/3401 and quite possibly other SCSI-2 CD-ROMs (most of those listed above should work, Panasonic CR-503B's are known to) you can boot the drives in normal (2048 byte) mode and then use kadb and a kernel patch to convince sr to 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]