fix several related bugs that cause sysctl machdep.diskinfo to
lose when booted from pxeboot. . make sure that i386_alldisks gets initialized even if bios geometry information is not available in the bootinfo . if i386_alldisks is not initialized, have sysctl return EOPNOTSUPP . compile pxeboot with -DPASS_BIOSGEOM and I386_INCLUDE_DISK=yes this may increase the size of pxeboot which is required to run in 64k. However, it seems to be working ok on my system
This commit is contained in:
parent
3b326e5df0
commit
1abd4b8f46
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.76 2004/04/22 00:34:52 itojun Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.77 2004/08/05 18:04:35 dbj Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -44,7 +44,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.76 2004/04/22 00:34:52 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.77 2004/08/05 18:04:35 dbj Exp $");
|
||||
|
||||
#include "opt_compat_oldboot.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -183,11 +183,11 @@ matchbiosdisks(void)
|
||||
char mbr[DEV_BSIZE];
|
||||
int dklist_size;
|
||||
int bmajor;
|
||||
int numbig;
|
||||
|
||||
big = lookup_bootinfo(BTINFO_BIOSGEOM);
|
||||
|
||||
if (big == NULL)
|
||||
return;
|
||||
numbig = big ? big->num : 0;
|
||||
|
||||
/*
|
||||
* First, count all native disks
|
||||
@ -196,22 +196,17 @@ matchbiosdisks(void)
|
||||
if (is_valid_disk(dv))
|
||||
i386_ndisks++;
|
||||
|
||||
if (i386_ndisks == 0)
|
||||
return;
|
||||
|
||||
dklist_size = sizeof (struct disklist) + (i386_ndisks - 1) *
|
||||
sizeof (struct nativedisk_info);
|
||||
|
||||
/* XXX M_TEMP is wrong */
|
||||
i386_alldisks = malloc(dklist_size, M_TEMP, M_NOWAIT);
|
||||
i386_alldisks = malloc(dklist_size, M_TEMP, M_NOWAIT | M_ZERO);
|
||||
if (i386_alldisks == NULL)
|
||||
return;
|
||||
|
||||
memset(i386_alldisks, 0, dklist_size);
|
||||
|
||||
i386_alldisks->dl_nnativedisks = i386_ndisks;
|
||||
i386_alldisks->dl_nbiosdisks = big->num;
|
||||
for (i = 0; i < big->num; i++) {
|
||||
i386_alldisks->dl_nbiosdisks = numbig;
|
||||
for (i = 0; i < numbig; i++) {
|
||||
i386_alldisks->dl_biosdisks[i].bi_dev = big->disk[i].dev;
|
||||
i386_alldisks->dl_biosdisks[i].bi_sec = big->disk[i].sec;
|
||||
i386_alldisks->dl_biosdisks[i].bi_head = big->disk[i].head;
|
||||
@ -271,7 +266,7 @@ matchbiosdisks(void)
|
||||
|
||||
for (ck = i = 0; i < DEV_BSIZE; i++)
|
||||
ck += mbr[i];
|
||||
for (m = i = 0; i < big->num; i++) {
|
||||
for (m = i = 0; i < numbig; i++) {
|
||||
be = &big->disk[i];
|
||||
#ifdef GEOM_DEBUG
|
||||
printf("match %s with %d ", dv->dv_xname, i);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.556 2004/07/22 15:12:46 mycroft Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.557 2004/08/05 18:04:35 dbj Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.556 2004/07/22 15:12:46 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.557 2004/08/05 18:04:35 dbj Exp $");
|
||||
|
||||
#include "opt_beep.h"
|
||||
#include "opt_compat_ibcs2.h"
|
||||
@ -470,10 +470,12 @@ sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
|
||||
struct sysctlnode node;
|
||||
|
||||
node = *rnode;
|
||||
if (!i386_alldisks)
|
||||
return(EOPNOTSUPP);
|
||||
node.sysctl_data = i386_alldisks;
|
||||
node.sysctl_size = sizeof(struct disklist) +
|
||||
(i386_ndisks - 1) * sizeof(struct nativedisk_info);
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.6 2003/04/01 21:25:35 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.7 2004/08/05 18:04:35 dbj Exp $
|
||||
|
||||
S= ${.CURDIR}/../../../../
|
||||
|
||||
@ -49,7 +49,9 @@ CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
|
||||
SAMISCCPPFLAGS+= -DHEAP_START=0x10000 -DHEAP_LIMIT=0x30000
|
||||
SAMISCMAKEFLAGS+= SA_USE_CREAD=yes # Read compressed kernels
|
||||
|
||||
I386MISCMAKEFLAGS= I386_INCLUDE_DISK=no
|
||||
CPPFLAGS+= -DPASS_BIOSGEOM
|
||||
# if you don't use -DPASS_BIOSGEOM, then set I386_INCLUDE_DISK=no
|
||||
#I386MISCMAKEFLAGS= I386_INCLUDE_DISK=no
|
||||
|
||||
.if (${BASE} == "pxeboot_ia32")
|
||||
VERSIONFILE= ${.CURDIR}/version
|
||||
|
Loading…
Reference in New Issue
Block a user