Subject: Modification To CD-ROM Device Driver (To Read Partition Tables)
To: None <port-sparc@netbsd.org,tech-kern@netbsd.org,tech-install@netbsd.org>
From: Rob Ginn <rob@olg.com>
List: port-sparc
Date: 04/14/1999 19:55:54
Hi all,
I made a simple modification to the cd.c device driver on the Sparc version
of NetBSD to improve installation.  I think it should be changed across the
board in all versions, but before I submit it as a change request, I thought
I'd see if anyone had any problems with it.

The CD-ROM driver (as currently distributed) does not attempt to read a
partition table off of the disc but instead generates a fake label that
has 2 partitions, a and c, which span the whole disc as an ISO9660 filesystem.
This causes a few problems, specifically:

    to use a CD with a partition table (be it NetBSD or some native format
       such as SunOS), you need to do a "disklabel -r -e" after each mount
       to get the kernal to recognize the label.

    CD's that are not in ISO9660 are harder to read (although the above
       trick can help)

    The boot image on the CD must be ISO9660 (and thus both wastes space and
       runs incredibly slowly)

The change I made simply has the device driver _try_ to read the partition
table,
then, if the disc has one it uses it.  If there is not there, it fakes one
up as before.  The result is that:

    On a Sparc, the system can now recognize CD's with NetBSD partitions, CD's
       with SunOS partitions, and ISO9660 CD's with no partitions.  Other
       systems should see the same benefits.  No error messages occur, in
       every case, the patch works smoothly.  Mounting any disc type seems
       to run at the same speed as before.  Other systems should be able to
       mount discs with native partition tables.

    You can burn a CD image of a disk drive with any filesystem and use it.
       
    Install CD's for Sparc run much faster (at _least_ 5x faster) and can be
       run with a simple "boot cdrom" command at the BIOS.  It is even
       comfortable now to run the whole thing off the CD as an emergency disc.

    The boot image on the end of the disc is no longer a "throw-away".  My 
       install CD's now have an ISO image with the tarballs followed by a
       copy of the miniroot (FFS) which is actually executed (instead of a
       copy of the miniroot data on the ISO partition being used).  I did
       have to re-write the mkbootcd program, but that didn't take long.

If there is no heartburn, I'll submit the change request with the diffs
(or email it if that's simpler).

- Rob Ginn
rob (no spam) @ olg dot com

BTW, I am only on the port-sparc list, so email me or cross-post please.