Changes to make FreeBSD use a CDROM as rootdev, for installation purposes.

If "BOOTCDROM" is defined, you get this pretty special case stuff.
This commit is contained in:
Poul-Henning Kamp 1995-04-10 07:44:31 +00:00
parent 83d05492ed
commit 17755ac806
3 changed files with 94 additions and 5 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.20 1995/02/18 18:04:30 wpaul Exp $
* $Id: autoconf.c,v 1.21 1995/03/16 18:11:24 bde Exp $
*/
/*
@ -74,6 +74,9 @@ int ffs_mountroot __P((void));
#ifdef NFS
int nfs_mountroot __P((void));
#endif
#ifdef CD9660
int cd9660_mountroot __P((void));
#endif
#include "isa.h"
#if NISA > 0
@ -85,6 +88,36 @@ int nfs_mountroot __P((void));
#include <pci/pcivar.h>
#endif
#ifdef BOOTCDROM
/* We need to try out all our potential CDROM drives, so we need a table. */
static struct {
char *name;
int major;
} try_cdrom[] = {
{ "cd", 6 },
{ "mcd", 7 },
{ "scd", 16 },
{ "matcd", 17 },
{ 0, 0}
};
int
find_cdrom_root()
{
int i,j,k;
for (j = 0 ; j < 2; j++)
for (k = 0 ; try_cdrom[k].name ; k++) {
rootdev = makedev(try_cdrom[k].major,j*8);
printf("trying rootdev=%x (%s%d)\n",
rootdev, try_cdrom[k].name,j);
i = (*cd9660_mountroot)();
if (!i) return i;
}
return EINVAL;
}
#endif
/*
* Determine i/o configuration for a machine.
*/
@ -100,8 +133,15 @@ configure()
pci_configure();
#endif
#ifdef CD9660
#ifdef BOOTCDROM
if (!mountroot) {
mountroot = find_cdrom_root;
}
#endif
#endif
#ifdef NFS
if (nfs_diskless_valid)
if (!mountroot && nfs_diskless_valid)
mountroot = nfs_mountroot;
#endif /* NFS */
#ifdef FFS

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.20 1995/02/18 18:04:30 wpaul Exp $
* $Id: autoconf.c,v 1.21 1995/03/16 18:11:24 bde Exp $
*/
/*
@ -74,6 +74,9 @@ int ffs_mountroot __P((void));
#ifdef NFS
int nfs_mountroot __P((void));
#endif
#ifdef CD9660
int cd9660_mountroot __P((void));
#endif
#include "isa.h"
#if NISA > 0
@ -85,6 +88,36 @@ int nfs_mountroot __P((void));
#include <pci/pcivar.h>
#endif
#ifdef BOOTCDROM
/* We need to try out all our potential CDROM drives, so we need a table. */
static struct {
char *name;
int major;
} try_cdrom[] = {
{ "cd", 6 },
{ "mcd", 7 },
{ "scd", 16 },
{ "matcd", 17 },
{ 0, 0}
};
int
find_cdrom_root()
{
int i,j,k;
for (j = 0 ; j < 2; j++)
for (k = 0 ; try_cdrom[k].name ; k++) {
rootdev = makedev(try_cdrom[k].major,j*8);
printf("trying rootdev=%x (%s%d)\n",
rootdev, try_cdrom[k].name,j);
i = (*cd9660_mountroot)();
if (!i) return i;
}
return EINVAL;
}
#endif
/*
* Determine i/o configuration for a machine.
*/
@ -100,8 +133,15 @@ configure()
pci_configure();
#endif
#ifdef CD9660
#ifdef BOOTCDROM
if (!mountroot) {
mountroot = find_cdrom_root;
}
#endif
#endif
#ifdef NFS
if (nfs_diskless_valid)
if (!mountroot && nfs_diskless_valid)
mountroot = nfs_mountroot;
#endif /* NFS */
#ifdef FFS

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.19 1995/03/16 18:12:27 bde Exp $
* $Id: init_main.c,v 1.20 1995/03/28 07:56:24 bde Exp $
*/
#include <sys/param.h>
@ -359,10 +359,14 @@ main(framep)
* List of paths to try when searching for "init".
*/
static char *initpaths[] = {
#ifdef BOOTCDROM
"/bootcd/stand/sysinstall",
#else
"/sbin/init",
"/sbin/oinit",
"/sbin/init.bak",
"/stand/sysinstall",
#endif
NULL,
};
@ -417,6 +421,11 @@ start_init(p, framep)
options = 1;
}
#endif
#ifdef BOOTCDROM
(void)subyte(--ucp, 'C');
options = 1;
#endif
if (options == 0)
(void)subyte(--ucp, '-');
(void)subyte(--ucp, '-'); /* leading hyphen */