Subject: port-i386/2925: NetBSD/i386 can not boot from CD-ROM
To: None <gnats-bugs@gnats.netbsd.org>
From: None <martin@rumolt.teuto.de>
List: netbsd-bugs
Date: 11/10/1996 10:43:35
>Number:         2925
>Category:       port-i386
>Synopsis:       NetBSD/i386 can not boot from CD-ROM
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 10 01:50:02 1996
>Last-Modified:
>Originator:     Martin Husemann
>Organization:
	private
>Release:        1.2
>Environment:
System: NetBSD rumolt.teuto.de 1.2 NetBSD 1.2 (RUMOLT) #1: Fri Oct 4 04:57:09 MET DST 1996 root@rumolt.teuto.de:/usr/src/sys/arch/i386/compile/RUMOLT i386
Any i386 based system running the 1.2 release.


>Description:
The root filesystem is statically bound to ffs. The function pointer
"moutroot" always is asigned "ffs_mountroot".

>How-To-Repeat:
Something along the lines of

mkdir /tmp/cd
cd /usr/src
setenv DESTDIR /tmp/cd
make distrib
cd /tmp/cd
mkisofs -a -R -d -L -o /tmp/image /tmp/cd

and burn /tmp/image on a CD-R, then try to boot from this CD by booting a
generic kernel with -a

>Fix:

There was a discussion of a real solution on tech-kern. It modifies config(8)
syntax and changes quite a lot things. I'll be working on that one and generate
another pr when I've come up with something working.

This is the short-term solution, taken from port-amiga (thanx to Ignatious
Souvatzis for pointing me in this direction).

It's minimal in size, and gives at least the minimal functionality. With
this patch, all kernels with option GENERIC are able to boot from SCSI-CDROM
or Mitsumi CD-ROM. When other CDROM types are added (eg. ATAPI) they have to
be added to the major exception list and force the filesystem type to cd9660.

As Chris Demetriou said, this works, but not realy is a solution.

I think it should be applied in the meantime anyway, because it doesn't make
sense to give the user a option (-a) to boot from CD-ROM, which doesn't work.

This diff is against plain 1.2.
 
*** swapgeneric.c.old	Sat Nov  2 14:13:57 1996
--- swapgeneric.c	Sun Nov 10 10:17:46 1996
***************
*** 111,114 ****
--- 111,115 ----
  };
  
+ extern int cd9660_mountroot __P((void *));
  extern int ffs_mountroot __P((void *));
  int (*mountroot) __P((void *)) = ffs_mountroot;
***************
*** 171,174 ****
--- 172,186 ----
  found:
  	rootdev = makedev(gc->gc_major, unit * MAXPARTITIONS);
+ 
+ 	/* Check if we boot off a CD drive */
+ #if NCD > 0
+ 	if (major(rootdev) == 6)
+ 		mountroot = cd9660_mountroot;
+ #endif
+ #if NMCD > 0
+ 	if (major(rootdev) == 7)
+ 		mountroot = cd9660_mountroot;
+ #endif
+ 
  doswap:
  	swdevt[0].sw_dev = argdev = dumpdev =

>Audit-Trail:
>Unformatted: