[Midnightbsd-cvs] src [10181] trunk/sys/boot/userboot: sync up

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jun 1 19:11:55 EDT 2018


Revision: 10181
          http://svnweb.midnightbsd.org/src/?rev=10181
Author:   laffer1
Date:     2018-06-01 19:11:55 -0400 (Fri, 01 Jun 2018)
Log Message:
-----------
sync up

Modified Paths:
--------------
    trunk/sys/boot/userboot/Makefile
    trunk/sys/boot/userboot/ficl/Makefile
    trunk/sys/boot/userboot/libstand/Makefile
    trunk/sys/boot/userboot/libstand/amd64/_setjmp.S
    trunk/sys/boot/userboot/test/Makefile
    trunk/sys/boot/userboot/test/test.c
    trunk/sys/boot/userboot/userboot/Makefile
    trunk/sys/boot/userboot/userboot/autoload.c
    trunk/sys/boot/userboot/userboot/bootinfo.c
    trunk/sys/boot/userboot/userboot/bootinfo32.c
    trunk/sys/boot/userboot/userboot/bootinfo64.c
    trunk/sys/boot/userboot/userboot/conf.c
    trunk/sys/boot/userboot/userboot/copy.c
    trunk/sys/boot/userboot/userboot/devicename.c
    trunk/sys/boot/userboot/userboot/elf32_freebsd.c
    trunk/sys/boot/userboot/userboot/elf64_freebsd.c
    trunk/sys/boot/userboot/userboot/host.c
    trunk/sys/boot/userboot/userboot/libuserboot.h
    trunk/sys/boot/userboot/userboot/main.c
    trunk/sys/boot/userboot/userboot/userboot_cons.c
    trunk/sys/boot/userboot/userboot/userboot_disk.c
    trunk/sys/boot/userboot/userboot/version
    trunk/sys/boot/userboot/userboot.h

Added Paths:
-----------
    trunk/sys/boot/userboot/userboot/biossmap.c
    trunk/sys/boot/userboot/zfs/
    trunk/sys/boot/userboot/zfs/Makefile

Property Changed:
----------------
    trunk/sys/boot/userboot/libstand/amd64/_setjmp.S
    trunk/sys/boot/userboot/userboot/version

Modified: trunk/sys/boot/userboot/Makefile
===================================================================
--- trunk/sys/boot/userboot/Makefile	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,8 +1,9 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/sys/boot/userboot/Makefile 268932 2014-07-20 22:54:03Z jhb $
 
 .include <bsd.own.mk>
 
-SUBDIR=		ficl libstand test userboot
+SUBDIR=		ficl libstand test zfs userboot
 
 .include <bsd.subdir.mk>
 

Modified: trunk/sys/boot/userboot/ficl/Makefile
===================================================================
--- trunk/sys/boot/userboot/ficl/Makefile	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/ficl/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,5 +1,5 @@
 # $MidnightBSD$
-# $FreeBSD: stable/9/sys/boot/userboot/ficl/Makefile 260096 2013-12-30 20:15:46Z dim $
+# $FreeBSD: stable/10/sys/boot/userboot/ficl/Makefile 260096 2013-12-30 20:15:46Z dim $
 #
 .include <bsd.own.mk>
 MK_SSP=		no

Modified: trunk/sys/boot/userboot/libstand/Makefile
===================================================================
--- trunk/sys/boot/userboot/libstand/Makefile	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/libstand/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,167 +1,13 @@
 # $MidnightBSD$
-# $FreeBSD: stable/9/sys/boot/userboot/libstand/Makefile 260096 2013-12-30 20:15:46Z dim $
-# Originally from	$NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
-#
-# Notes:
-# - We don't use the libc strerror/sys_errlist because the string table is
-#   quite large.
-#
+# $FreeBSD: stable/10/sys/boot/userboot/libstand/Makefile 312403 2017-01-19 07:29:52Z delphij $
 
-NO_MAN=
-
 .include <bsd.own.mk>
-MK_SSP=		no
 
-S=		${.CURDIR}/../../../../lib/libstand
+LIBSTAND_SRC=	${.CURDIR}/../../../../lib/libstand
 
-.PATH:		${S}
-LIB=		stand
 INTERNALLIB=
-NO_PROFILE=
-NO_PIC=
+INCS=
+MAN=
+.PATH:	${LIBSTAND_SRC}
 
-WARNS?=		0
-
-CFLAGS+= -ffreestanding -Wformat -fPIC
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
-
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2
-.endif
-.if ${MACHINE_CPUARCH} == "i386"
-CFLAGS.gcc+=	-mpreferred-stack-boundary=2
-CFLAGS+=	-mno-sse3
-.endif
-.if ${MACHINE} == "pc98"
-CFLAGS+=	-Os
-.endif
-.if ${MACHINE_CPUARCH} == "powerpc"
-CFLAGS+=	-msoft-float -D_STANDALONE -DNETIF_DEBUG
-.endif
-.if ${MACHINE_CPUARCH} == "arm"
-CFLAGS+=	-msoft-float -D_STANDALONE
-.endif
-
-# standalone components and stuff we have modified locally
-SRCS+=	gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
-	globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
-	sbrk.c twiddle.c zalloc.c zalloc_malloc.c
-
-# private (pruned) versions of libc string functions
-SRCS+=	strcasecmp.c
-
-LIBC=	${.CURDIR}/../../../../lib/libc
-
-.PATH: ${LIBC}/net
-
-SRCS+= ntoh.c
-
-# string functions from libc
-.PATH: ${LIBC}/string
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
-	${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
-	${MACHINE_CPUARCH} == "arm"
-SRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
-        memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
-        strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
-	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
-.endif
-.if ${MACHINE_CPUARCH} == "arm"
-.PATH: ${LIBC}/arm/gen
-SRCS+= divsi3.S
-.endif
-.if ${MACHINE_CPUARCH} == "ia64"
-.PATH: ${LIBC}/ia64/string
-SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
-	memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
-	strcmp.c strcpy.c strcspn.c strlen.c \
-	strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
-	strspn.c strstr.c strtok.c swab.c
-
-.PATH: ${LIBC}/ia64/gen
-SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
-SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
-.endif
-.if ${MACHINE_CPUARCH} == "powerpc"
-.PATH: ${LIBC}/libc/quad
-SRCS+=	ashldi3.c ashrdi3.c
-.PATH: ${LIBC}/powerpc/gen
-SRCS+=	syncicache.c
-.endif
-
-# uuid functions from libc
-.PATH: ${LIBC}/uuid
-SRCS+= uuid_equal.c uuid_is_nil.c
-
-# _setjmp/_longjmp
-.if ${MACHINE_CPUARCH} == "amd64"
-.PATH: ${.CURDIR}/amd64
-.elif ${MACHINE_ARCH} == "powerpc64"
-.PATH: ${S}/powerpc
-.else
-.PATH: ${S}/${MACHINE_CPUARCH}
-.endif
-SRCS+=	_setjmp.S
-
-# decompression functionality from libbz2
-# NOTE: to actually test this functionality after libbz2 upgrade compile
-# loader(8) with LOADER_BZIP2_SUPPORT defined
-.PATH: ${.CURDIR}/../../../../contrib/bzip2
-CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
-SRCS+=	libstand_bzlib_private.h
-
-.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
-SRCS+=	_${file}
-CLEANFILES+=	_${file}
-
-_${file}: ${file}
-	sed "s|bzlib_private\.h|libstand_bzlib_private.h|" ${.ALLSRC} > ${.TARGET}
-.endfor
-
-CLEANFILES+= libstand_bzlib_private.h
-libstand_bzlib_private.h: bzlib_private.h
-	sed -e 's|<stdlib.h>|"stand.h"|' \
-		${.ALLSRC} > ${.TARGET}
-
-# decompression functionality from libz
-.PATH: ${.CURDIR}/../../../../contrib/zlib
-CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../../../../contrib/zlib
-SRCS+=	adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
-
-.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
-SRCS+=	_${file}
-CLEANFILES+=	_${file}
-
-_${file}: ${file}
-	sed -e "s|zutil\.h|libstand_zutil.h|" \
-	    -e "s|gzguts\.h|libstand_gzguts.h|" ${.ALLSRC} > ${.TARGET}
-.endfor
-
-# depend on stand.h being able to be included multiple times
-.for file in zutil.h gzguts.h
-CLEANFILES+= libstand_${file}
-libstand_${file}: ${file}
-	sed -e 's|<fcntl.h>|"stand.h"|' \
-	    -e 's|<stddef.h>|"stand.h"|' \
-	    -e 's|<string.h>|"stand.h"|' \
-	    -e 's|<stdio.h>|"stand.h"|' \
-	    -e 's|<stdlib.h>|"stand.h"|' \
-	    ${.ALLSRC} > ${.TARGET}
-.endfor
-
-# io routines
-SRCS+=	closeall.c dev.c ioctl.c nullfs.c stat.c \
-	fstat.c close.c lseek.c open.c read.c write.c readdir.c
-
-# network routines
-SRCS+=	arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
-
-# network info services:
-SRCS+=	bootp.c rarp.c bootparam.c
-
-# boot filesystems
-SRCS+=	ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
-SRCS+=	dosfs.c ext2fs.c
-SRCS+=	splitfs.c
-
-.include <bsd.lib.mk>
+.include "${LIBSTAND_SRC}/Makefile"

Modified: trunk/sys/boot/userboot/libstand/amd64/_setjmp.S
===================================================================
--- trunk/sys/boot/userboot/libstand/amd64/_setjmp.S	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/libstand/amd64/_setjmp.S	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.


Property changes on: trunk/sys/boot/userboot/libstand/amd64/_setjmp.S
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/boot/userboot/test/Makefile
===================================================================
--- trunk/sys/boot/userboot/test/Makefile	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/test/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,8 +1,8 @@
 # $MidnightBSD$
-# $FreeBSD: stable/9/sys/boot/userboot/test/Makefile 256266 2013-10-10 12:46:26Z bdrewery $
+# $FreeBSD: stable/10/sys/boot/userboot/test/Makefile 276486 2014-12-31 23:25:37Z ngie $
 
 
-NO_MAN=
+MAN=
 
 .include <bsd.own.mk>
 MK_SSP=		no

Modified: trunk/sys/boot/userboot/test/test.c
===================================================================
--- trunk/sys/boot/userboot/test/test.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/test/test.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 Google, Inc.
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/boot/userboot/test/test.c 242935 2012-11-12 22:38:54Z neel $
  */
 
 #include <sys/types.h>
@@ -364,6 +365,18 @@
         *highmem = 0;
 }
 
+const char *
+test_getenv(void *arg, int idx)
+{
+	static const char *vars[] = {
+		"foo=bar",
+		"bar=barbar",
+		NULL
+	};
+
+	return (vars[idx]);
+}
+
 struct loader_callbacks cb = {
 	.putc = test_putc,
 	.getc = test_getc,
@@ -391,6 +404,8 @@
 	.delay = test_delay,
 	.exit = test_exit,
         .getmem = test_getmem,
+
+	.getenv = test_getenv,
 };
 
 void
@@ -450,5 +465,5 @@
 	term.c_lflag &= ~(ICANON|ECHO);
 	tcsetattr(0, TCSAFLUSH, &term);
 
-	func(&cb, NULL, USERBOOT_VERSION_2, disk_fd >= 0);
+	func(&cb, NULL, USERBOOT_VERSION_3, disk_fd >= 0);
 }

Modified: trunk/sys/boot/userboot/userboot/Makefile
===================================================================
--- trunk/sys/boot/userboot/userboot/Makefile	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,7 +1,7 @@
 # $MidnightBSD$
-# $FreeBSD: stable/9/sys/boot/userboot/userboot/Makefile 256266 2013-10-10 12:46:26Z bdrewery $
+# $FreeBSD: stable/10/sys/boot/userboot/userboot/Makefile 314922 2017-03-08 22:39:45Z pfg $
 
-NO_MAN=
+MAN=
 
 .include <bsd.own.mk>
 MK_SSP=		no
@@ -12,6 +12,7 @@
 LIBDIR=		/boot
 
 SRCS=		autoload.c
+SRCS+=		biossmap.c
 SRCS+=		bootinfo.c
 SRCS+=		bootinfo32.c
 SRCS+=		bootinfo64.c
@@ -45,17 +46,24 @@
 
 .if ${MK_FORTH} != "no"
 BOOT_FORTH=	yes
-CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
+CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+=        -I${.CURDIR}/../../ficl/i386
+CFLAGS+=	-DBF_DICTSIZE=15000
 LIBFICL=	${.OBJDIR}/../ficl/libficl.a
 LIBSTAND=	${.OBJDIR}/../libstand/libstand.a
 .endif
 
+.if ${MK_ZFS} != "no"
+CFLAGS+=	-DUSERBOOT_ZFS_SUPPORT
+LIBZFSBOOT=	${.OBJDIR}/../zfs/libzfsboot.a
+.endif
+
 # Always add MI sources 
 .PATH:		${.CURDIR}/../../common
 .include	"${.CURDIR}/../../common/Makefile.inc"
 CFLAGS+=	-I${.CURDIR}/../../common
 CFLAGS+=	-I.
-DPADD=		${LIBFICL} ${LIBSTAND}
-LDADD=		${LIBFICL} ${LIBSTAND}
+DPADD+=		${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} 
+LDADD+=		${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND}
 
 .include <bsd.lib.mk>

Modified: trunk/sys/boot/userboot/userboot/autoload.c
===================================================================
--- trunk/sys/boot/userboot/userboot/autoload.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/autoload.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/autoload.c 223695 2011-06-30 16:08:56Z dfr $");
 
 int
 userboot_autoload(void)

Added: trunk/sys/boot/userboot/userboot/biossmap.c
===================================================================
--- trunk/sys/boot/userboot/userboot/biossmap.c	                        (rev 0)
+++ trunk/sys/boot/userboot/userboot/biossmap.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -0,0 +1,75 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 1998 Michael Smith <msmith at freebsd.org>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/biossmap.c 267399 2014-06-12 15:20:59Z jhb $");
+
+#include <stand.h>
+#include <sys/param.h>
+#include <sys/reboot.h>
+#include <sys/linker.h>
+#include <machine/pc/bios.h>
+#include <machine/metadata.h>
+
+#include "bootstrap.h"
+#include "libuserboot.h"
+
+#define GB (1024UL * 1024 * 1024)
+
+void
+bios_addsmapdata(struct preloaded_file *kfp)
+{
+	uint64_t lowmem, highmem;
+	int smapnum, len;
+	struct bios_smap smap[3], *sm;
+
+	CALLBACK(getmem, &lowmem, &highmem);
+
+	sm = &smap[0];
+
+	sm->base = 0;				/* base memory */
+	sm->length = 640 * 1024;
+	sm->type = SMAP_TYPE_MEMORY;
+	sm++;
+
+	sm->base = 0x100000;			/* extended memory */
+	sm->length = lowmem - 0x100000;
+	sm->type = SMAP_TYPE_MEMORY;
+	sm++;
+
+	smapnum = 2;
+
+        if (highmem != 0) {
+                sm->base = 4 * GB;
+                sm->length = highmem;
+                sm->type = SMAP_TYPE_MEMORY;
+		smapnum++;
+        }
+
+        len = smapnum * sizeof(struct bios_smap);
+        file_addmetadata(kfp, MODINFOMD_SMAP, len, &smap[0]);
+}


Property changes on: trunk/sys/boot/userboot/userboot/biossmap.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/boot/userboot/userboot/bootinfo.c
===================================================================
--- trunk/sys/boot/userboot/userboot/bootinfo.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/bootinfo.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,39 +26,17 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/bootinfo.c 271132 2014-09-04 20:47:14Z emaste $");
 
 #include <stand.h>
 #include <sys/param.h>
 #include <sys/reboot.h>
 #include <sys/linker.h>
+#include <sys/boot.h>
 
 #include "bootstrap.h"
 #include "libuserboot.h"
 
-/*
- * Return a 'boothowto' value corresponding to the kernel arguments in
- * (kargs) and any relevant environment variables.
- */
-static struct 
-{
-    const char	*ev;
-    int		mask;
-} howto_names[] = {
-    {"boot_askname",	RB_ASKNAME},
-    {"boot_cdrom",	RB_CDROM},
-    {"boot_ddb",	RB_KDB},
-    {"boot_dfltroot",	RB_DFLTROOT},
-    {"boot_gdb",	RB_GDB},
-    {"boot_multicons",	RB_MULTIPLE},
-    {"boot_mute",	RB_MUTE},
-    {"boot_pause",	RB_PAUSE},
-    {"boot_serial",	RB_SERIAL},
-    {"boot_single",	RB_SINGLE},
-    {"boot_verbose",	RB_VERBOSE},
-    {NULL,	0}
-};
-
 int
 bi_getboothowto(char *kargs)
 {

Modified: trunk/sys/boot/userboot/userboot/bootinfo32.c
===================================================================
--- trunk/sys/boot/userboot/userboot/bootinfo32.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/bootinfo32.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/bootinfo32.c 267399 2014-06-12 15:20:59Z jhb $");
 
 #include <stand.h>
 #include <sys/param.h>
@@ -67,7 +67,7 @@
     COPY32(strlen(s) + 1, a, c);		\
     if (c)					\
         CALLBACK(copyin, s, a, strlen(s) + 1);  \
-    a += roundup(strlen(s) + 1, sizeof(u_long));\
+    a += roundup(strlen(s) + 1, sizeof(uint32_t));\
 }
 
 #define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
@@ -79,7 +79,7 @@
     COPY32(sizeof(s), a, c);			\
     if (c)					\
         CALLBACK(copyin, &s, a, sizeof(s));	\
-    a += roundup(sizeof(s), sizeof(u_long));	\
+    a += roundup(sizeof(s), sizeof(uint32_t));	\
 }
 
 #define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -90,7 +90,7 @@
     COPY32(mm->md_size, a, c);			\
     if (c)					\
         CALLBACK(copyin, mm->md_data, a, mm->md_size);    \
-    a += roundup(mm->md_size, sizeof(u_long));\
+    a += roundup(mm->md_size, sizeof(uint32_t));\
 }
 
 #define MOD_END(a, c) {				\
@@ -147,6 +147,7 @@
     int				bootdevnr, howto;
     char			*kernelname;
     const char			*kernelpath;
+    uint64_t			lowmem, highmem;
 
     howto = bi_getboothowto(args);
 
@@ -199,9 +200,7 @@
     file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto);
     file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp);
     file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
-#if 0
     bios_addsmapdata(kfp);
-#endif
 
     /* Figure out the size and location of the metadata */
     *modulep = addr;
@@ -238,11 +237,10 @@
         bi.bi_bios_geom[i] = bd_getbigeom(i);
 #endif
     bi.bi_size = sizeof(bi);
+    CALLBACK(getmem, &lowmem, &highmem);
     bi.bi_memsizes_valid = 1;
-#if 0
-    bi.bi_basemem = bios_basemem / 1024;
-    bi.bi_extmem = bios_extmem / 1024;
-#endif
+    bi.bi_basemem = 640;
+    bi.bi_extmem = (lowmem - 0x100000) / 1024;
     bi.bi_envp = envp;
     bi.bi_modulep = *modulep;
     bi.bi_kernend = kernend;
@@ -252,7 +250,7 @@
     /*
      * Copy the legacy bootinfo and kernel name to the guest at 0x2000
      */
-    bi.bi_kernelname = (char *) (0x2000 + sizeof(bi));
+    bi.bi_kernelname = 0x2000 + sizeof(bi);
     CALLBACK(copyin, &bi, 0x2000, sizeof(bi));
     CALLBACK(copyin, kernelname, 0x2000 + sizeof(bi), strlen(kernelname) + 1);
 

Modified: trunk/sys/boot/userboot/userboot/bootinfo64.c
===================================================================
--- trunk/sys/boot/userboot/userboot/bootinfo64.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/bootinfo64.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/bootinfo64.c 267399 2014-06-12 15:20:59Z jhb $");
 
 #include <stand.h>
 #include <sys/param.h>
@@ -170,53 +170,6 @@
 #endif
 }
 
-struct smap {
-        uint64_t       base;
-        uint64_t       length;
-        uint32_t       type;
-} __packed;
-
-/* From FreeBSD <machine/pc/bios.h> */
-#define SMAP_TYPE_MEMORY	1
-
-#define GB (1024UL * 1024 * 1024)
-
-#define MODINFOMD_SMAP          0x1001
-
-static void
-bios_addsmapdata(struct preloaded_file *kfp)
-{
-	uint64_t lowmem, highmem;
-	int smapnum, len;
-	struct smap smap[3], *sm;
-
-	CALLBACK(getmem, &lowmem, &highmem);
-
-	sm = &smap[0];
-
-	sm->base = 0;				/* base memory */
-	sm->length = 640 * 1024;
-	sm->type = SMAP_TYPE_MEMORY;
-	sm++;
-
-	sm->base = 0x100000;			/* extended memory */
-	sm->length = lowmem - 0x100000;
-	sm->type = SMAP_TYPE_MEMORY;
-	sm++;
-
-	smapnum = 2;
-
-        if (highmem != 0) {
-                sm->base = 4 * GB;
-                sm->length = highmem;
-                sm->type = SMAP_TYPE_MEMORY;
-		smapnum++;
-        }
-
-        len = smapnum * sizeof (struct smap);
-        file_addmetadata(kfp, MODINFOMD_SMAP, len, &smap[0]);
-}
-
 /*
  * Load the information expected by an amd64 kernel.
  *

Modified: trunk/sys/boot/userboot/userboot/conf.c
===================================================================
--- trunk/sys/boot/userboot/userboot/conf.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/conf.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -33,12 +33,16 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/boot/userboot/userboot/conf.c 284312 2015-06-12 11:41:47Z avg $");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/conf.c 284311 2015-06-12 11:41:33Z avg $");
 
 #include <stand.h>
 
 #include "libuserboot.h"
 
+#if defined(USERBOOT_ZFS_SUPPORT)
+#include "../zfs/libzfs.h"
+#endif
+
 /*
  * We could use linker sets for some or all of these, but
  * then we would have to control what ended up linked into
@@ -52,6 +56,9 @@
 struct devsw *devsw[] = {
 	&host_dev,
 	&userboot_disk,
+#if defined(USERBOOT_ZFS_SUPPORT)
+	&zfs_dev,
+#endif
 	NULL
 };
 
@@ -58,6 +65,10 @@
 struct fs_ops *file_system[] = {
 	&host_fsops,
 	&ufs_fsops,
+	&cd9660_fsops,
+#if defined(USERBOOT_ZFS_SUPPORT)
+	&zfs_fsops,
+#endif
 	&gzipfs_fsops,
 	&bzipfs_fsops,
 	NULL
@@ -88,8 +99,10 @@
  * data structures from bootstrap.h as well.
  */
 extern struct console userboot_console;
+extern struct console userboot_comconsole;
 
 struct console *consoles[] = {
 	&userboot_console,
+	&userboot_comconsole,
 	NULL
 };

Modified: trunk/sys/boot/userboot/userboot/copy.c
===================================================================
--- trunk/sys/boot/userboot/userboot/copy.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/copy.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/copy.c 239057 2012-08-05 11:59:46Z ae $");
 
 #include <stand.h>
 

Modified: trunk/sys/boot/userboot/userboot/devicename.c
===================================================================
--- trunk/sys/boot/userboot/userboot/devicename.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/devicename.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/devicename.c 268932 2014-07-20 22:54:03Z jhb $");
 
 #include <stand.h>
 #include <string.h>
@@ -35,6 +35,10 @@
 #include "disk.h"
 #include "libuserboot.h"
 
+#if defined(USERBOOT_ZFS_SUPPORT)
+#include "../zfs/libzfs.h"
+#endif
+
 static int	userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path);
 
 /* 
@@ -120,7 +124,6 @@
 
     case DEVT_CD:
     case DEVT_NET:
-    case DEVT_ZFS:
 	unit = 0;
 
 	if (*np && (*np != ':')) {
@@ -142,6 +145,16 @@
 	    *path = (*cp == 0) ? cp : cp + 1;
 	break;
 
+    case DEVT_ZFS:
+#if defined(USERBOOT_ZFS_SUPPORT)
+	    err = zfs_parsedev((struct zfs_devdesc *)idev, np, path);
+	    if (err != 0)
+		    goto fail;
+	    break;
+#else
+	    /* FALLTHROUGH */
+#endif
+
     default:
 	err = EINVAL;
 	goto fail;
@@ -180,8 +193,15 @@
 	return (disk_fmtdev(vdev));
 
     case DEVT_NET:
+	sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+	break;
+
     case DEVT_ZFS:
+#if defined(USERBOOT_ZFS_SUPPORT)
+	return (zfs_fmtdev(vdev));
+#else
 	sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+#endif
 	break;
     }
     return(buf);

Modified: trunk/sys/boot/userboot/userboot/elf32_freebsd.c
===================================================================
--- trunk/sys/boot/userboot/userboot/elf32_freebsd.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/elf32_freebsd.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,12 +26,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/elf32_freebsd.c 267399 2014-06-12 15:20:59Z jhb $");
 
 #include <sys/param.h>
 #include <sys/exec.h>
 #include <sys/linker.h>
 #include <string.h>
+#define	_MACHINE_ELF_WANT_32BIT
 #include <i386/include/bootinfo.h>
 #include <i386/include/elf.h>
 #include <stand.h>
@@ -45,6 +46,9 @@
 struct file_format i386_elf = { elf32_loadfile, elf32_exec };
 struct file_format i386_elf_obj = { elf32_obj_loadfile, elf32_obj_exec };
 
+#define	GUEST_STACK	0x1000		/* Initial stack base */
+#define	GUEST_GDT	0x3000		/* Address of initial GDT */
+
 /*
  * There is an ELF kernel and one or more ELF modules loaded.  
  * We wish to start executing the kernel image, so make such 
@@ -57,7 +61,7 @@
 	Elf_Ehdr 		*ehdr;
 	vm_offset_t		entry, bootinfop, modulep, kernend;
 	int			boothowto, err, bootdev;
-	uint32_t		stack[1024];
+	uint32_t		stack[1024], *sp;
 
 
 	if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
@@ -78,16 +82,27 @@
 	/*
 	 * Build a scratch stack at physical 0x1000
 	 */
-	stack[0] = boothowto;
-	stack[1] = bootdev;
-	stack[2] = 0;
-	stack[3] = 0;
-	stack[4] = 0;
-	stack[5] = bootinfop;
-	stack[6] = modulep;
-	stack[7] = kernend;
-	CALLBACK(copyin, stack, 0x1000, sizeof(stack));
-	CALLBACK(setreg, 4, 0x1000);
+	memset(stack, 0, sizeof(stack));
+	sp = (uint32_t *)((char *)stack + sizeof(stack));
+	*--sp = kernend;
+	*--sp = modulep;
+	*--sp = bootinfop;
+	*--sp = 0;
+	*--sp = 0;
+	*--sp = 0;
+	*--sp = bootdev;
+	*--sp = boothowto;
+
+	/*
+	 * Fake return address to mimic "new" boot blocks.  For more
+	 * details see recover_bootinfo in locore.S.
+	 */
+	*--sp = 0xbeefface;
+	CALLBACK(copyin, stack, GUEST_STACK, sizeof(stack));
+	CALLBACK(setreg, 4, (char *)sp - (char *)stack + GUEST_STACK);
+
+	CALLBACK(setgdt, GUEST_GDT, 8 * 4 - 1);
+
         CALLBACK(exec, entry);
 
 	panic("exec returned");

Modified: trunk/sys/boot/userboot/userboot/elf64_freebsd.c
===================================================================
--- trunk/sys/boot/userboot/userboot/elf64_freebsd.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/elf64_freebsd.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/elf64_freebsd.c 223695 2011-06-30 16:08:56Z dfr $");
 
 #define __ELF_WORD_SIZE 64
 #include <sys/param.h>

Modified: trunk/sys/boot/userboot/userboot/host.c
===================================================================
--- trunk/sys/boot/userboot/userboot/host.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/host.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/host.c 223695 2011-06-30 16:08:56Z dfr $");
 
 /*
  * Read from the host filesystem

Modified: trunk/sys/boot/userboot/userboot/libuserboot.h
===================================================================
--- trunk/sys/boot/userboot/userboot/libuserboot.h	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/libuserboot.h	2018-06-01 23:11:55 UTC (rev 10181)
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/boot/userboot/userboot/libuserboot.h 267399 2014-06-12 15:20:59Z jhb $
  */
 
 #include "userboot.h"
@@ -66,3 +66,4 @@
 int	bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
     vm_offset_t *modulep, vm_offset_t *kernend);
 int	bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend);
+void	bios_addsmapdata(struct preloaded_file *kfp);

Modified: trunk/sys/boot/userboot/userboot/main.c
===================================================================
--- trunk/sys/boot/userboot/userboot/main.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/main.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/main.c 295475 2016-02-10 17:49:22Z allanjude $");
 
 #include <stand.h>
 #include <string.h>
@@ -37,8 +37,17 @@
 #include "disk.h"
 #include "libuserboot.h"
 
-#define	USERBOOT_VERSION	USERBOOT_VERSION_2
+#if defined(USERBOOT_ZFS_SUPPORT)
+#include "../zfs/libzfs.h"
 
+static void userboot_zfs_probe(void);
+static int userboot_zfs_found;
+#endif
+
+#define	USERBOOT_VERSION	USERBOOT_VERSION_3
+
+#define	MALLOCSZ		(10*1024*1024)
+
 struct loader_callbacks *callbacks;
 void *callbacks_arg;
 
@@ -70,7 +79,8 @@
 void
 loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
 {
-	static char malloc[512*1024];
+	static char mallocbuf[MALLOCSZ];
+	const char *var;
 	int i;
 
         if (version != USERBOOT_VERSION)
@@ -82,10 +92,9 @@
 
 	/*
 	 * initialise the heap as early as possible.  Once this is done,
-	 * alloc() is usable. The stack is buried inside us, so this is
-	 * safe.
+	 * alloc() is usable.
 	 */
-	setheap((void *)malloc, (void *)(malloc + 512*1024));
+	setheap((void *)mallocbuf, (void *)(mallocbuf + sizeof(mallocbuf)));
 
         /*
          * Hook up the console
@@ -92,13 +101,6 @@
          */
 	cons_probe();
 
-	/*
-	 * March through the device switch probing for things.
-	 */
-	for (i = 0; devsw[i] != NULL; i++)
-		if (devsw[i]->dv_init != NULL)
-			(devsw[i]->dv_init)();
-
 	printf("\n");
 	printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
 	printf("(%s, %s)\n", bootprog_maker, bootprog_date);
@@ -108,12 +110,33 @@
 
 	setenv("LINES", "24", 1);	/* optional */
 
+	/*
+	 * Set custom environment variables
+	 */
+	i = 0;
+	while (1) {
+		var = CALLBACK(getenv, i++);
+		if (var == NULL)
+			break;
+		putenv(var);
+	}
+
 	archsw.arch_autoload = userboot_autoload;
 	archsw.arch_getdev = userboot_getdev;
 	archsw.arch_copyin = userboot_copyin;
 	archsw.arch_copyout = userboot_copyout;
 	archsw.arch_readin = userboot_readin;
+#if defined(USERBOOT_ZFS_SUPPORT)
+	archsw.arch_zfs_probe = userboot_zfs_probe;
+#endif
 
+	/*
+	 * March through the device switch probing for things.
+	 */
+	for (i = 0; devsw[i] != NULL; i++)
+		if (devsw[i]->dv_init != NULL)
+			(devsw[i]->dv_init)();
+
 	extract_currdev();
 
 	if (setjmp(jb))
@@ -135,6 +158,20 @@
 
 	//bzero(&dev, sizeof(dev));
 
+#if defined(USERBOOT_ZFS_SUPPORT)
+	if (userboot_zfs_found) {
+		struct zfs_devdesc zdev;
+	
+		/* Leave the pool/root guid's unassigned */
+		bzero(&zdev, sizeof(zdev));
+		zdev.d_dev = &zfs_dev;
+		zdev.d_type = zdev.d_dev->dv_type;
+		
+		dev = *(struct disk_devdesc *)&zdev;
+		init_zfs_bootenv(zfs_fmtdev(&dev));
+	} else
+#endif
+
 	if (userboot_disk_maxunit > 0) {
 		dev.d_dev = &userboot_disk;
 		dev.d_type = dev.d_dev->dv_type;
@@ -142,11 +179,13 @@
 		dev.d_slice = 0;
 		dev.d_partition = 0;
 		/*
-		 * Figure out if we are using MBR or GPT - for GPT we
-		 * set the partition to 0 since everything is a GPT slice.
+		 * If we cannot auto-detect the partition type then
+		 * access the disk as a raw device.
 		 */
-		if (dev.d_dev->dv_open(NULL, &dev))
-			dev.d_partition = 255;
+		if (dev.d_dev->dv_open(NULL, &dev)) {
+			dev.d_slice = -1;
+			dev.d_partition = -1;
+		}
 	} else {
 		dev.d_dev = &host_dev;
 		dev.d_type = dev.d_dev->dv_type;
@@ -159,6 +198,81 @@
             env_noset, env_nounset);
 }
 
+#if defined(USERBOOT_ZFS_SUPPORT)
+static void
+userboot_zfs_probe(void)
+{
+	char devname[32];
+	uint64_t pool_guid;
+	int unit;
+
+	/*
+	 * Open all the disks we can find and see if we can reconstruct
+	 * ZFS pools from them. Record if any were found.
+	 */
+	for (unit = 0; unit < userboot_disk_maxunit; unit++) {
+		sprintf(devname, "disk%d:", unit);
+		pool_guid = 0;
+		zfs_probe_dev(devname, &pool_guid);
+		if (pool_guid != 0)
+			userboot_zfs_found = 1;
+	}
+}
+
+COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset",
+	    command_lszfs);
+
+static int
+command_lszfs(int argc, char *argv[])
+{
+	int err;
+
+	if (argc != 2) {
+		command_errmsg = "a single dataset must be supplied";
+		return (CMD_ERROR);
+	}
+
+	err = zfs_list(argv[1]);
+	if (err != 0) {
+		command_errmsg = strerror(err);
+		return (CMD_ERROR);
+	}
+	return (CMD_OK);
+}
+
+COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments",
+	    command_reloadbe);
+
+static int
+command_reloadbe(int argc, char *argv[])
+{
+	int err;
+	char *root;
+
+	if (argc > 2) {
+		command_errmsg = "wrong number of arguments";
+		return (CMD_ERROR);
+	}
+
+	if (argc == 2) {
+		err = zfs_bootenv(argv[1]);
+	} else {
+		root = getenv("zfs_be_root");
+		if (root == NULL) {
+			return (CMD_OK);
+		}
+		err = zfs_bootenv(root);
+	}
+
+	if (err != 0) {
+		command_errmsg = strerror(err);
+		return (CMD_ERROR);
+	}
+
+	return (CMD_OK);
+}
+#endif /* USERBOOT_ZFS_SUPPORT */
+
 COMMAND_SET(quit, "quit", "exit the loader", command_quit);
 
 static int

Modified: trunk/sys/boot/userboot/userboot/userboot_cons.c
===================================================================
--- trunk/sys/boot/userboot/userboot/userboot_cons.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/userboot_cons.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/userboot_cons.c 268953 2014-07-21 19:08:02Z jhb $");
 
 #include <stand.h>
 #include "bootstrap.h"
@@ -34,8 +34,12 @@
 
 int console;
 
+static struct console *userboot_comconsp;
+
 static void userboot_cons_probe(struct console *cp);
 static int userboot_cons_init(int);
+static void userboot_comcons_probe(struct console *cp);
+static int userboot_comcons_init(int);
 static void userboot_cons_putchar(int);
 static int userboot_cons_getchar(void);
 static int userboot_cons_poll(void);
@@ -51,6 +55,21 @@
 	userboot_cons_poll,
 };
 
+/*
+ * Provide a simple alias to allow loader scripts to set the
+ * console to comconsole without resulting in an error
+ */
+struct console userboot_comconsole = {
+	"comconsole",
+	"comconsole",
+	0,
+	userboot_comcons_probe,
+	userboot_comcons_init,
+	userboot_cons_putchar,
+	userboot_cons_getchar,
+	userboot_cons_poll,
+};
+
 static void
 userboot_cons_probe(struct console *cp)
 {
@@ -66,6 +85,31 @@
 }
 
 static void
+userboot_comcons_probe(struct console *cp)
+{
+
+	/*
+	 * Save the console pointer so the comcons_init routine
+	 * can set the C_PRESENT* flags. They are not set
+	 * here to allow the existing userboot console to
+	 * be elected the default.
+	 */
+	userboot_comconsp = cp;
+}
+
+static int
+userboot_comcons_init(int arg)
+{
+
+	/*
+	 * Set the C_PRESENT* flags to allow the comconsole
+	 * to be selected as the active console
+	 */
+	userboot_comconsp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
+	return (0);
+}
+
+static void
 userboot_cons_putchar(int c)
 {
 

Modified: trunk/sys/boot/userboot/userboot/userboot_disk.c
===================================================================
--- trunk/sys/boot/userboot/userboot/userboot_disk.c	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/userboot_disk.c	2018-06-01 23:11:55 UTC (rev 10181)
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/boot/userboot/userboot/userboot_disk.c 241809 2012-10-21 12:14:58Z ae $");
 
 /*
  * Userboot disk image handling.

Modified: trunk/sys/boot/userboot/userboot/version
===================================================================
--- trunk/sys/boot/userboot/userboot/version	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot/version	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,4 +1,5 @@
-$FreeBSD$
+$MidnightBSD$
+$FreeBSD: stable/10/sys/boot/userboot/userboot/version 223695 2011-06-30 16:08:56Z dfr $
 
 1.1:	Initial userland boot
 


Property changes on: trunk/sys/boot/userboot/userboot/version
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/boot/userboot/userboot.h
===================================================================
--- trunk/sys/boot/userboot/userboot.h	2018-06-01 23:09:27 UTC (rev 10180)
+++ trunk/sys/boot/userboot/userboot.h	2018-06-01 23:11:55 UTC (rev 10181)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 Doug Rabson
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/boot/userboot/userboot.h 242935 2012-11-12 22:38:54Z neel $
  */
 
 /*
@@ -31,6 +32,7 @@
  */
 #define	USERBOOT_VERSION_1      1
 #define	USERBOOT_VERSION_2      2
+#define	USERBOOT_VERSION_3      3
 
 /*
  * Exit codes from the loader
@@ -176,9 +178,22 @@
          */
 	void		(*getmem)(void *arg, uint64_t *lowmem,
             uint64_t *highmem);
+
 	/*
 	 * ioctl interface to the disk device
 	 */
 	int		(*diskioctl)(void *arg, int unit, u_long cmd,
 	    void *data);
+
+	/*
+	 * Returns an environment variable in the form "name=value".
+	 *
+	 * If there are no more variables that need to be set in the
+	 * loader environment then return NULL.
+	 *
+	 * 'num' is used as a handle for the callback to identify which
+	 * environment variable to return next. It will begin at 0 and
+	 * each invocation will add 1 to the previous value of 'num'.
+	 */
+	const char *	(*getenv)(void *arg, int num);
 };

Added: trunk/sys/boot/userboot/zfs/Makefile
===================================================================
--- trunk/sys/boot/userboot/zfs/Makefile	                        (rev 0)
+++ trunk/sys/boot/userboot/zfs/Makefile	2018-06-01 23:11:55 UTC (rev 10181)
@@ -0,0 +1,19 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/sys/boot/userboot/zfs/Makefile 262331 2014-02-22 07:18:06Z grehan $
+
+S=		${.CURDIR}/../../zfs
+
+.PATH:		${S}
+LIB=		zfsboot
+INTERNALLIB=
+
+SRCS+=		zfs.c
+
+CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
+CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=	-I${.CURDIR}/../../../cddl/boot/zfs
+
+CFLAGS+=	-ffreestanding -fPIC
+CFLAGS+=	-Wformat -Wall
+
+.include <bsd.lib.mk>


Property changes on: trunk/sys/boot/userboot/zfs/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list