Subject: Re: install/37521: qemu install from NetBSD-current install floppiesfails
To: None <install-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 12/12/2007 13:50:02
The following reply was made to PR install/37521; it has been noted by GNATS.
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: sborrill@netbsd.org
Cc: gson@gson.org, gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: install/37521: qemu install from NetBSD-current install floppiesfails
Date: Wed, 12 Dec 2007 22:45:13 +0900
sborrill@netbsd.org wrote:
> Yes, it would be best to use -DSMALL when building /boot for floppies. I
> suspect we are using the same /boot throughout (though I've not
> checked). Or as Izumi suggests, we detect the target file system type
> and return early from parsebootconf().
Could you please take this PR?
(My too ugly patch attached)
---
Izumi Tsutsui
Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.16
diff -u -r1.16 boot2.c
--- boot2.c 23 Nov 2007 13:47:03 -0000 1.16
+++ boot2.c 12 Dec 2007 13:38:16 -0000
@@ -52,6 +52,9 @@
#include <libi386.h>
#include "devopen.h"
+#ifdef SUPPORT_USTARFS
+#include "ustarfs.h"
+#endif
#ifdef SUPPORT_PS2
#include <biosmca.h>
#endif
@@ -298,6 +301,26 @@
int fd, err, off;
struct stat st;
char *value, *key;
+#ifdef SUPPORT_USTARFS
+ void *op_open;
+#endif
+
+ /* don't try to open BOOTCONF if the target fs is ustarfs */
+#ifdef SUPPORT_USTARFS
+#if !defined(LIBSA_SINGLE_FILESYSTEM)
+ fd = open("boot", 0); /* assume we are loaded as "boot" from here */
+ if (fd < 0)
+ op_open = NULL; /* XXX */
+ else {
+ op_open = files[fd].f_ops->open;
+ close(fd);
+ }
+#else
+ op_open = file_system[0].open;
+#endif /* !LIBSA_SINGLE_FILESYSTEM */
+ if (op_open == ustarfs_open)
+ return;
+#endif /* SUPPORT_USTARFS */
/* Clear bootconf structure */
bzero((void *)&bootconf, sizeof(bootconf));
@@ -305,14 +328,16 @@
/* Set timeout to configured */
bootconf.timeout = boot_params.bp_timeout;
- err = stat(BOOTCONF, &st);
- if (err == -1)
- return;
-
fd = open(BOOTCONF, 0);
if (fd < 0)
return;
+ err = fstat(fd, &st);
+ if (err == -1) {
+ close(fd);
+ return;
+ }
+
bc = alloc(st.st_size + 1);
if (bc == NULL) {
printf("Could not allocate memory for boot configuration\n");