Pay attention to the file name provided by the DHCP server, using
it rather than the default of "netbsd" if it's in the reply.
This commit is contained in:
parent
00994a7564
commit
77fa5a7974
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: devopen.c,v 1.1 2002/02/16 03:37:40 thorpej Exp $ */
|
||||
/* $NetBSD: devopen.c,v 1.2 2002/02/17 20:14:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* Copyright 2001, 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
||||
@ -50,6 +50,7 @@
|
||||
|
||||
#ifdef _STANDALONE
|
||||
struct btinfo_bootpath bibp;
|
||||
extern char bootfile[];
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -71,10 +72,24 @@ devopen(struct open_file *f, const char *fname, char **file)
|
||||
struct devsw *dp;
|
||||
char *filename;
|
||||
size_t fsnamelen;
|
||||
int i;
|
||||
int i, error;
|
||||
|
||||
dp = &devsw[0];
|
||||
|
||||
/* Set the default boot file system. */
|
||||
bcopy(pxeboot_fstab[0].fst_ops, file_system, sizeof(struct fs_ops));
|
||||
|
||||
/* Open the device; this might give us a boot file name. */
|
||||
error = (*dp->dv_open)(f, NULL);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
f->f_dev = dp;
|
||||
|
||||
/* If the DHCP server provided a file name, use it. */
|
||||
if (bootfile[0] != '\0')
|
||||
fname = bootfile;
|
||||
|
||||
filename = strchr(fname, ':');
|
||||
if (filename != NULL) {
|
||||
fsnamelen = (size_t)((const char *)filename - fname);
|
||||
@ -89,24 +104,28 @@ devopen(struct open_file *f, const char *fname, char **file)
|
||||
if (i == npxeboot_fstab) {
|
||||
printf("Invalid file system type specified in %s\n",
|
||||
fname);
|
||||
return (EINVAL);
|
||||
error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
filename++;
|
||||
if (filename[0] == '\0') {
|
||||
printf("No file specified in %s\n", fname);
|
||||
return (EINVAL);
|
||||
error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
} else
|
||||
filename = (char *)fname;
|
||||
|
||||
*file = filename;
|
||||
dp = &devsw[0];
|
||||
f->f_dev = dp;
|
||||
|
||||
#ifdef _STANDALONE
|
||||
strncpy(bibp.bootpath, filename, sizeof(bibp.bootpath));
|
||||
BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
|
||||
#endif
|
||||
|
||||
return ((*dp->dv_open)(f, NULL));
|
||||
return (0);
|
||||
bad:
|
||||
(*dp->dv_close)(f);
|
||||
f->f_dev = NULL;
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.2 2002/02/16 16:52:10 thorpej Exp $ */
|
||||
/* $NetBSD: main.c,v 1.3 2002/02/17 20:14:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -125,6 +125,10 @@ main(void)
|
||||
bootmenu(); /* does not return */
|
||||
}
|
||||
|
||||
/*
|
||||
* The file name provided here is just a default. If the
|
||||
* DHCP server provides a file name, we'll use that instead.
|
||||
*/
|
||||
bootit("netbsd", 0);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user