--- ./dosboot/main.c-dist	Sun Aug 13 18:09:27 2000
+++ ./dosboot/main.c	Thu Nov 29 13:56:12 2001
@@ -44,6 +44,133 @@
 
 #include <libi386.h>
 
+#ifdef ANYBSD
+#include "k_vars.h"
+
+#ifndef DEFAULT_BOOT_KERNEL
+#  if defined(DEFAULT_FREEBSD)
+#    define DEFAULT_BOOT_KERNEL K_FREEBSD
+#    define DEFAULT_FILENAME "kernel"
+#  elif defined(DEFAULT_OPENBSD)
+#    define DEFAULT_BOOT_KERNEL K_OPENBSD
+#    define DEFAULT_FILENAME "bsd"
+#  else
+#    define DEFAULT_BOOT_KERNEL K_NETBSD
+#    define DEFAULT_FILENAME "netbsd"
+#  endif
+#endif
+
+#define RBX_MASK	0xffff
+
+/* FreeBSD options
+ *
+ * /sys/i386/boot/dosboot/reboot.h
+ * /sys/i386/boot/dosboot/fbsdboot.c
+ * /sys/i386/boot/biosboot/boot.c
+ * /sys/i386/boot/biosboot/boot.h
+ */
+#define	RBF_AUTOBOOT	0	/* flags for system auto-booting itself */
+
+#define	RBF_ASKNAME	0x01	/* ask for file name to reboot from */
+#define	RBF_SINGLE	0x02	/* reboot to single user only */
+#define	RBF_NOSYNC	0x04	/* dont sync before reboot */
+#define	RBF_HALT		0x08	/* don't reboot, just halt */
+#define	RBF_INITNAME	0x10	/* name given for /etc/init (unused) */
+#define	RBF_DFLTROOT	0x20	/* use compiled-in rootdev */
+#define	RBF_KDB		0x40	/* give control to kernel debugger */
+#define	RBF_RDONLY	0x80	/* mount root fs read-only */
+#define	RBF_DUMP		0x100	/* dump kernel memory before reboot */
+#define	RBF_MINIROOT	0x200	/* mini-root present in memory at boot time */
+#define RBF_CONFIG	0x400	/* invoke user configuration routing */
+#define RBF_VERBOSE	0x800	/* print all potentially useful info */
+#define RBF_SERIAL	0x1000	/* user serial port as console */
+#define RBF_CDROM	0x2000	/* use cdrom as root */
+#define RBF_POWEROFF     0x4000  /* if you can, turn the power off */
+#define RBF_GDB          0x8000  /* use GDB remote debugger instead of DDB */
+#define	RBF_DUAL		0x40000		/* XXX */
+#define	RBF_PROBEKBD	0x80000		/* XXX */
+
+#define NOPTS_FREEBSD		11
+static const char *optstr_freebsd = "rsacdgvChDP";
+static const unsigned int flags_freebsd[NOPTS_FREEBSD] = {
+    RBF_DFLTROOT,
+    RBF_SINGLE,
+    RBF_ASKNAME,
+    RBF_CONFIG,
+    RBF_KDB,
+    RBF_GDB,
+    RBF_VERBOSE,
+    RBF_CDROM,
+    RBF_SERIAL,
+    RBF_DUAL,
+    RBF_PROBEKBD,
+};
+
+/*
+ * NetBSD options
+ *
+ * /sys/arch/i386/stand/lib/netbsd_opts.c
+ * /sys/sys/reboot.h
+ */
+#define	RBN_AUTOBOOT	0	/* flags for system auto-booting itself */
+
+#define	RBN_ASKNAME	0x001	/* ask for file name to reboot from */
+#define	RBN_SINGLE	0x002	/* reboot to single user only */
+#define	RBN_NOSYNC	0x004	/* dont sync before reboot */
+#define	RBN_HALT		0x008	/* don't reboot, just halt */
+#define	RBN_INITNAME	0x010	/* name given for /etc/init (unused) */
+#define	__RBN_UNUSED1	0x020	/* was RBN_DFLTROOT, obsolete */
+#define	RBN_KDB		0x040	/* give control to kernel debugger */
+#define	RBN_RDONLY	0x080	/* mount root fs read-only */
+#define	RBN_DUMP		0x100	/* dump kernel memory before reboot */
+#define	RBN_MINIROOT	0x200	/* mini-root present in memory at boot time */
+#define	RBN_STRING	0x400	/* use provided bootstr */
+#define	RBN_POWERDOWN	(RBN_HALT|0x800) /* turn power off (or at least halt) */
+
+#define NOPTS_NETBSD		3
+static const char *optstr_netbsd = "asd";
+static const unsigned int flags_netbsd[NOPTS_NETBSD] = {
+    RBN_ASKNAME,
+    RBN_SINGLE,
+    RBN_KDB,
+};
+
+/*
+ * OpenBSD options
+ *
+ * /sys/stand/boot/vars.c
+ * /sys/sys/reboot.h
+ */
+
+#define	RBO_AUTOBOOT	0	/* flags for system auto-booting itself */
+
+#define	RBO_ASKNAME	0x0001	/* ask for file name to reboot from */
+#define	RBO_SINGLE	0x0002	/* reboot to single user only */
+#define	RBO_NOSYNC	0x0004	/* dont sync before reboot */
+#define	RBO_HALT		0x0008	/* don't reboot, just halt */
+#define	RBO_INITNAME	0x0010	/* name given for /etc/init (unused) */
+#define	RBO_DFLTROOT	0x0020	/* use compiled-in rootdev */
+#define	RBO_KDB		0x0040	/* give control to kernel debugger */
+#define	RBO_RDONLY	0x0080	/* mount root fs read-only */
+#define	RBO_DUMP		0x0100	/* dump kernel memory before reboot */
+#define	RBO_MINIROOT	0x0200	/* mini-root present in memory at boot time */
+#define	RBO_CONFIG	0x0400	/* change configured devices */
+#define	RBO_TIMEBAD	0x0800	/* don't call resettodr() in boot() */
+#define	RBO_POWERDOWN	0x1000	/* attempt to power down machine */
+#define	RBO_SERCONS	0x2000	/* use serial console if available */
+
+#define NOPTS_OPENBSD		5
+static const char *optstr_openbsd = "abcsd";
+static const unsigned int flags_openbsd[NOPTS_OPENBSD] = {
+    RBO_ASKNAME,
+    RBO_HALT,
+    RBO_CONFIG,
+    RBO_SINGLE,
+    RBO_KDB,
+};
+
+#endif /* ANYBSD */
+
 #ifdef SUPPORT_LYNX
 extern int exec_lynx __P((const char*, int));
 #endif
@@ -64,6 +191,9 @@
 static void bootit __P((const char *, int, int));
 void usage __P((void));
 int main __P((int, char **));
+#ifdef ANYBSD
+int anybsd_opts __P((char *, int *));
+#endif
 
 void	command_help __P((char *));
 void	command_ls __P((char *));
@@ -241,9 +371,69 @@
 void 
 usage()
 {
-	printf("dosboot [-u] [-c <commands>] [-i] [filename [-bootopts]]\n");
+	printf("bsdboot [-u] [-c <commands>] [-i][-[f|n|o]] [filename [-bootopts]]\n");
 }
 
+#ifdef ANYBSD
+int
+anybsd_opts(arg, howto)
+     char *arg;
+     int *howto;
+{
+   int i;
+   char c;
+   int nopts;
+   const char *optstr;
+   const unsigned int *optflags;
+
+   /* skip '-' */
+   while ((c = *++arg) != 0){
+      switch(boot_kernel){
+       case K_OPENBSD:
+	  optstr = optstr_openbsd;
+	  nopts = NOPTS_OPENBSD;
+	  optflags = flags_openbsd;
+	  break;
+       case K_NETBSD:
+	  optstr = optstr_netbsd;
+	  nopts = NOPTS_NETBSD;
+	  optflags = flags_netbsd;
+	  break;
+       case K_FREEBSD:
+       default:
+	  optstr = optstr_freebsd;
+	  nopts = NOPTS_FREEBSD;
+	  optflags = flags_freebsd;
+	  break;
+      }
+      for (i = 0; c != optstr[i]; i++)
+	 if (i == nopts - 1) {
+	    printf("-%c: unknown kernel option\n", c);
+	    printf("valid options are : %s\n", optstr);
+	    return 0;
+	 }
+
+      *howto |= optflags[i];
+   }
+
+   *howto &= RBX_MASK;
+
+#if 0
+   switch(boot_kernel){
+    case K_FREEBSD:
+       *howto |= RB_BOOTINFO;
+       break;
+    case K_OPENBSD:
+    case K_NETBSD:
+    default:
+       break;
+   }
+#endif
+
+   return 1;
+}
+#endif
+
 int 
 main(argc, argv)
 	int             argc;
@@ -268,9 +458,14 @@
 	default_devname = "hd";
 	default_unit = 0;
 	default_partition = 0;
-	default_filename = "netbsd";
+	default_filename = DEFAULT_FILENAME;
 
+#ifdef ANYBSD
+	boot_kernel = DEFAULT_BOOT_KERNEL;
+	while ((ch = getopt(argc, argv, "c:iufno")) != -1) {
+#else
 	while ((ch = getopt(argc, argv, "c:iu")) != -1) {
+#endif
 		switch (ch) {
 		case 'c':
 			docommand(optarg);
@@ -282,6 +477,17 @@
 		case 'u':
 			current_fsmode = "ufs";
 			break;
+#ifdef ANYBSD
+		case 'f':
+			boot_kernel = K_FREEBSD;
+			break;
+		case 'n':
+			boot_kernel = K_NETBSD;
+			break;
+		case 'o':
+			boot_kernel = K_OPENBSD;
+			break;
+#endif
 		default:
 			usage();
 			return (1);
@@ -301,10 +507,15 @@
 		return (1);
 	}
 	howto = 0;
+#ifdef ANYBSD
+	if (argc > 1 && !anybsd_opts(argv[1], &howto))
+	    return 1;
+#else
 	if (argc > 1 && !parseopts(argv[1], &howto))
 		return (1);
+#endif
 
-	bootit((argc > 0 ? argv[0] : "netbsd"), howto, 1);
+	bootit((argc > 0 ? argv[0] : default_filename), howto, 1);
 	return (1);
 }
 
--- ./dosboot/Makefile-dist	Thu Oct 19 23:18:47 2000
+++ ./dosboot/Makefile	Thu Nov 29 13:35:58 2001
@@ -1,18 +1,25 @@
 #	$NetBSD: Makefile,v 1.13.14.4 2000/10/19 14:18:47 he Exp $
 
+# specify default kernel from following
+# FREEBSD, NETBSD, OPENBSD
+KERNEL=NETBSD
+
 S=	${.CURDIR}/../../../../
 
-BASE= dosboot
+BASE= bsdboot
 PROG= ${BASE}.com
 MKMAN=	no
-NEWVERSWHAT=	"DOS Boot"
+NEWVERSWHAT=	"DOS Boot for *BSD"
 
-SRCS= main.c devopen.c exec.c
+SRCS= main.c devopen.c exec.c ob_bootarg.c
 
 CLEANFILES+= ${DOSSTART} ${BASE}.sym
 
 CPPFLAGS+= -DCOMPAT_OLDBOOT -DCOMPAT_386BSD_MBRPART
 CPPFLAGS+= -DXMS
+CPPFLAGS+= -DANYBSD -DDEFAULT_$(KERNEL)
+CPPFLAGS+= -D__NetBSD__ -D_STANDALONE
+
 #uncomment if there are problems with memory detection
 #CPPFLAGS+= -DCONSERVATIVE_MEMDETECT
 
@@ -21,7 +28,7 @@
 
 # XXX should go into library
 SRCS+= getopt.c
-.PATH: ${.CURDIR}/../libsa
+.PATH: ${S}arch/i386/stand/libsa
 
 SAMISCCPPFLAGS+= -DHEAP_START=0x10000 -DHEAP_LIMIT=0x40000
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_INCLUDE_NET=no
@@ -37,7 +44,7 @@
 	@false
 .else
 release:
-	cp dosboot.com ${RELEASEDIR}/installation/misc
+	cp bsdboot.com ${RELEASEDIR}/installation/misc
 .endif
 
-.include "../Makefile.booters"
+.include "${S}arch/i386/stand/Makefile.booters"
--- ./dosboot/k_vars.h-dist	Thu Nov 29 13:19:50 2001
+++ ./dosboot/k_vars.h	Thu Nov 29 13:19:50 2001
@@ -0,0 +1,5 @@
+#define K_FREEBSD 0
+#define K_NETBSD  1
+#define K_OPENBSD 2
+
+int boot_kernel;
--- ./dosboot/ob_bootarg.c-dist	Thu Nov 29 13:10:19 2001
+++ ./dosboot/ob_bootarg.c	Tue Mar  5 14:20:58 2002
@@ -0,0 +1,90 @@
+/*	$OpenBSD: bootarg.c,v 1.6 1999/05/20 12:56:40 aaron Exp $	*/
+
+/* /sys/stand/boot/bootarg.c */
+
+/*
+ * Copyright (c) 1997,1998 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <lib/libsa/stand.h>
+#include "ob_bootarg.h"
+
+#define DEBUG
+
+bootarg_t *bootarg_list = NULL;
+
+void
+addbootarg(t, l, p)
+	int t;
+	size_t l;
+	void *p;
+{
+	bootarg_t *q = alloc(sizeof(*q) + l - sizeof(q->ba_arg));
+
+	q->ba_type = t;
+	q->ba_size = sizeof(*q) + l - sizeof(q->ba_arg);
+	bcopy(p, q->ba_arg, l);
+	q->ba_next = bootarg_list;
+	bootarg_list = q;
+}
+
+void
+makebootargs(v, lenp)
+	caddr_t v;
+	size_t *lenp;
+{
+	register bootarg_t *p;
+	register u_char *q;
+	register size_t l;
+
+	/* get total size */
+	l = sizeof(*p);
+	for (p = bootarg_list; p != NULL; p = p->ba_next)
+		l += p->ba_size;
+	if (*lenp < l) {
+#ifdef DEBUG
+		printf("makebootargs: too many args\n");
+#endif
+		l = *lenp;
+	}
+	*lenp = l;
+	/* copy them out */
+	for (p = bootarg_list, q = v;
+	     p != NULL && ((q + p->ba_size) - (u_char*)v) < l;
+	     q += p->ba_size, p = p->ba_next) {
+#ifdef DEBUG
+		printf("%d,%d ", p->ba_type, p->ba_size);
+#endif
+		bcopy(p, q, p->ba_size);
+	}
+	p = (bootarg_t *)q;
+	p->ba_type = BOOTARG_END;
+}
--- ./dosboot/ob_bootarg.h-dist	Thu Nov 29 13:11:25 2001
+++ ./dosboot/ob_bootarg.h	Thu Nov 29 13:11:21 2001
@@ -0,0 +1,62 @@
+/*	$OpenBSD: bootarg.h,v 1.8 1999/08/25 00:54:18 mickey Exp $	*/
+
+/* /sys/stand/boot/bootarg.h */
+
+/*
+ * Copyright (c) 1996-1999 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define	BOOTARG_APIVER	(BAPIV_VECTOR|BAPIV_ENV|BAPIV_BMEMMAP)
+#define	BAPIV_ANCIENT	0x00000000	/* MD old i386 bootblocks */
+#define	BAPIV_VARS	0x00000001	/* MD structure w/ add info passed */
+#define	BAPIV_VECTOR	0x00000002	/* MI vector of MD structures passed */
+#define	BAPIV_ENV	0x00000004	/* MI environment vars vector */
+#define	BAPIV_BMEMMAP	0x00000008	/* MI memory map passed is in bytes */
+
+typedef struct _boot_args {
+	int ba_type;
+	size_t ba_size;
+	struct _boot_args *ba_next;
+	int ba_arg[1];
+} bootarg_t;
+
+#define	BOOTARG_ENV	0x1000
+#define	BOOTARG_END	-1
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+extern void *bootargv;
+extern int bootargc;                                                     
+extern bootarg_t *bootargp;
+#endif
+
+#ifdef _STANDALONE
+void addbootarg __P((int, size_t, void *));
+void makebootargs __P((caddr_t, size_t *));
+#endif /* _STANDALONE */
--- ./lib/exec.c-dist	Tue Feb 22 16:45:04 2000
+++ ./lib/exec.c	Tue Mar  5 15:03:24 2002
@@ -59,6 +59,66 @@
 #include "libi386.h"
 #include "bootinfo.h"
 
+#ifdef ANYBSD
+#include "ob_exec.h"
+#include "ob_bootarg.h"
+#include "k_vars.h"
+
+/*
+ * A zero bootinfo field often means that there is no info available.
+ * Flags are used to indicate the validity of fields where zero is a
+ * normal value.
+ */
+#define	N_BIOS_GEOM		8
+#define	BOOTINFO_VERSION	1
+
+struct fbsd_bootinfo {
+	unsigned long		bi_version;
+	unsigned char		*bi_kernelname;
+	void				*bi_nfs_diskless;
+				/* End of fields that are always present. */
+#define	bi_endcommon		bi_n_bios_used
+	unsigned long		bi_n_bios_used;
+	unsigned long		bi_bios_geom[N_BIOS_GEOM];
+	unsigned long		bi_size;
+	unsigned char		bi_memsizes_valid;
+	unsigned char		bi_pad[3];
+	unsigned long		bi_basemem;
+	unsigned long		bi_extmem;
+	unsigned long		bi_symtab;
+	unsigned long		bi_esymtab;
+};
+struct fbsd_bootinfo	fbsd_bootinfo;
+
+/*
+ * /sys/arch/i386/include/biosvar.h
+ */
+#define	BOOTARG_MEMMAP 0
+typedef struct _bios_memmap {
+	u_int64_t addr;		/* Beginning of block */
+	u_int64_t size;		/* Size of block */
+	u_int32_t type;		/* Type of block */
+} bios_memmap_t;
+
+#define	BOOTARG_CONSDEV	5
+typedef struct _bios_consdev {
+	dev_t	consdev;
+	int	conspeed;
+} bios_consdev_t;
+
+bios_memmap_t memmap[3];
+
+/*
+ * BIOS memory maps
+ */
+#define	BIOS_MAP_END	0x00	/* End of array XXX - special */
+#define	BIOS_MAP_FREE	0x01	/* Usable memory */
+#define	BIOS_MAP_RES	0x02	/* Reserved memory */
+#define	BIOS_MAP_ACPI	0x03	/* ACPI Reclaim memory */
+#define	BIOS_MAP_NVS	0x04	/* ACPI NVS memory */
+
+#endif
+
 #ifdef COMPAT_OLDBOOT
 static int dev2major __P((char *, int *));
 
@@ -79,7 +139,11 @@
 	return (-1);
 }
 #endif
+#ifdef ANYBSD
+#define BOOT_NARGS	8
+#else
 #define BOOT_NARGS	6
+#endif
 
 extern struct btinfo_console btinfo_console;
 
@@ -194,7 +258,18 @@
 #else
 	boot_argv[1] = 0;
 #endif
+#ifdef ANYBSD
+	switch (boot_kernel) {
+	 case K_OPENBSD:
+		 boot_argv[2] = BOOTARG_APIVER;
+		 break;
+	 case K_NETBSD:
+		 boot_argv[2] = vtophys(bootinfo);	/* old cyl offset */
+		 break;
+	}
+#else
 	boot_argv[2] = vtophys(bootinfo);	/* old cyl offset */
+#endif
 	/* argv[3] below */
 	boot_argv[4] = extmem;
 	boot_argv[5] = basemem;
@@ -208,6 +283,29 @@
 	 */
 #ifdef PASS_BIOSGEOM
 	bi_getbiosgeom();
+#ifdef ANYBSD
+	/* for FreeBSD */
+	{
+	   int ret;
+	   struct btinfo_biosgeom *bibg =
+	      (struct btinfo_biosgeom *) bootinfo->entry[bootinfo->nentries -1];
+
+	/* 
+	 * form a longword representing all this gunk:
+	 *       6 bit zero
+	 *	10 bit max cylinder (0 based)
+	 *	 8 bit max head (0 based)
+	 *	 2 bit zero
+	 *	 6 bit max sector (1 based) = # sectors
+	 */
+	   for(ret = 0; ret < N_BIOS_GEOM; ret ++){
+	      fbsd_bootinfo.bi_bios_geom[ret] =
+		 ((bibg->disk[ret].cyl & 0x3ff) << 16) |
+		 ((bibg->disk[ret].head & 0xff) << 8) |
+		 (bibg->disk[ret].sec & 0x3f);
+	   }
+	}
+#endif
 #endif
 #ifdef PASS_MEMMAP
 	bi_getmemmap();
@@ -243,6 +341,77 @@
 	btinfo_symtab.esym = marks[MARK_END];
 	BI_ADD(&btinfo_symtab, BTINFO_SYMTAB, sizeof(struct btinfo_symtab));
 
+#ifdef ANYBSD
+	switch (boot_kernel) {
+	 case K_OPENBSD:
+	     /* /sys/arch/i386/stand/libsa/exec_i386.c */
+	     {
+#ifdef OLDER_KERNEL
+#define	BOOTARG_LEN	(NBPG*1)
+#define	BOOTARG_OFF	(NBPG)
+#else
+#define	BOOTARG_OFF	(NBPG*2)
+#define	BOOTARG_LEN	(NBPG*1)
+#endif
+		 size_t ac = BOOTARG_LEN;
+		 caddr_t av;
+		 av = (caddr_t) alloc(BOOTARG_LEN);
+
+#if 0
+		 bios_consdev_t cd;
+
+		 cd.consdev = makedev(12,0);
+		 cd.conspeed = 9600;
+		 addbootarg(BOOTARG_CONSDEV, sizeof(cd), &cd);
+#endif
+
+		 /* Pass memory map to the kernel */
+		 /* /sys/arch/i386/stand/libsa/memprobe.c */
+		 /* openbsd.c */
+
+		 memmap[0].addr = 0;
+		 memmap[0].size = basemem * 1024;
+		 memmap[0].type = BIOS_MAP_FREE;
+		 memmap[1].addr = 0x100000;
+		 memmap[1].size = extmem * 1024;
+		 memmap[1].type = BIOS_MAP_FREE;
+		 memmap[2].addr = 0;
+		 memmap[2].size = 0;
+		 memmap[2].type = BIOS_MAP_END;
+
+		 addbootarg(BOOTARG_MEMMAP, sizeof memmap,
+			    memmap);
+		 makebootargs(av, &ac);
+		 vpbcopy(av, (caddr_t) BOOTARG_OFF,ac);
+
+		 boot_argv[6] = ac;
+		 boot_argv[7] = (int) BOOTARG_OFF;
+	     }
+	     break;
+
+	 case K_FREEBSD:
+	     {
+		 char *name = "kernel";
+
+		 fbsd_bootinfo.bi_basemem = getbasemem();
+		 fbsd_bootinfo.bi_extmem = extmem;
+		 fbsd_bootinfo.bi_memsizes_valid = 1;
+		 fbsd_bootinfo.bi_symtab = marks[MARK_SYM];
+		 fbsd_bootinfo.bi_esymtab = marks[MARK_END];
+
+		 fbsd_bootinfo.bi_version = BOOTINFO_VERSION;
+		 fbsd_bootinfo.bi_kernelname = (unsigned char *) vtophys(name);
+		 fbsd_bootinfo.bi_nfs_diskless = 0;
+		 fbsd_bootinfo.bi_size = sizeof(fbsd_bootinfo);
+
+		 boot_argv[2] = 0; 
+		 boot_argv[3] = 0; 
+		 boot_argv[4] = 0; 
+		 boot_argv[5] = vtophys(&fbsd_bootinfo);
+	     }
+	     break;
+	}
+#endif
 	startprog(marks[MARK_ENTRY], BOOT_NARGS, boot_argv,
 		i386_trunc_page(basemem*1024));
 	panic("exec returned");
--- ./newvers.sh-dist	Sat Jul 26 10:50:38 1997
+++ ./newvers.sh	Thu Nov 29 13:29:55 2001
@@ -38,7 +38,7 @@
 u=${USER-root} h=`hostname` t=`date`
 r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '`
 
-echo "char bootprog_name[] = \"NetBSD/i386 ${2}\";" > vers.c
+echo "char bootprog_name[] = \"`uname`/i386 ${2}\";" > vers.c
 echo "char bootprog_rev[] = \"${r}\";" >> vers.c
 echo "char bootprog_date[] = \"${t}\";" >> vers.c
 echo "char bootprog_maker[] = \"${u}@${h}\";" >> vers.c
