Module Name:    src
Committed By:   snj
Date:           Tue Jul 25 02:00:33 UTC 2017

Modified Files:
        src/usr.bin/mkubootimage [netbsd-8]: mkubootimage.1 mkubootimage.c
            uboot.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #142):
        usr.bin/mkubootimage/mkubootimage.1: 1.9-1.10
        usr.bin/mkubootimage/mkubootimage.c: 1.20
        usr.bin/mkubootimage/uboot.h: 1.7
Add support for "kernel_noload" image types. This type is the same as the
"kernel" type, except it can run from any load address.
--
Remove unnecessary macros. Use standard headers.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.8.1 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.6 -r1.6.8.1 src/usr.bin/mkubootimage/uboot.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mkubootimage/mkubootimage.1
diff -u src/usr.bin/mkubootimage/mkubootimage.1:1.8 src/usr.bin/mkubootimage/mkubootimage.1:1.8.8.1
--- src/usr.bin/mkubootimage/mkubootimage.1:1.8	Tue Sep 30 10:30:35 2014
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue Jul 25 02:00:33 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.8 2014/09/30 10:30:35 wiz Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.8.8.1 2017/07/25 02:00:33 snj Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 30, 2014
+.Dd July 15, 2017
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -38,13 +38,13 @@
 .Op Fl h
 .Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc )
 .Fl a Ar address
-.Op Fl C No Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
+.Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
 .Op Fl E Ar address
 .Op Fl e Ar address
 .Op Fl m Ar magic
 .Fl n Ar image
-.Op Fl O No Po freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd Pc
-.Fl T No ( fs Ns | Ns kernel Ns | Ns ramdisk Ns | Ns standalone )
+.Op Fl O Po freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd Pc
+.Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns standalone )
 .Ar source destination
 .\"
 .Sh DESCRIPTION
@@ -62,7 +62,7 @@ This is required.
 Sets the image load address.
 This is an integer between 0 and
 .Dv UINT32_MAX .
-This is required.
+This is required for all image types except for script, ramdisk, and kernel_noload.
 .It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none )
 Defines the compression.
 The default is
@@ -108,7 +108,7 @@ This is required.
 Defines the operating system type.
 The default OS name is
 .Qq netbsd .
-.It Fl T No ( fs Ns | Ns kernel Ns | Ns ramdisk Ns | Ns standalone Ns | Ns script )
+.It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns standalone Ns | Ns script )
 Defines the image type.
 This is required.
 .El
@@ -120,7 +120,7 @@ The required
 .Ar destination
 argument is the filename of the image file that is created.
 .\"
-.Sh RETURN VALUES
+.Sh EXIT STATUS
 .Nm
 returns 1 on failure to read the kernel,
 generate a header, or create the image.

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.18.8.1 src/usr.bin/mkubootimage/mkubootimage.c:1.18.8.2
--- src/usr.bin/mkubootimage/mkubootimage.c:1.18.8.1	Wed Jul  5 20:15:33 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Tue Jul 25 02:00:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.18.8.1 2017/07/05 20:15:33 snj Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.18.8.2 2017/07/25 02:00:33 snj Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <[email protected]>
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mkubootimage.c,v 1.18.8.1 2017/07/05 20:15:33 snj Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.18.8.2 2017/07/25 02:00:33 snj Exp $");
 
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -144,11 +144,12 @@ static const struct uboot_type {
 	enum uboot_image_type type;
 	const char *name;
 } uboot_type[] = {
-	{ IH_TYPE_STANDALONE,	"standalone" },
-	{ IH_TYPE_KERNEL,	"kernel" },
-	{ IH_TYPE_RAMDISK,	"ramdisk" },
-	{ IH_TYPE_FILESYSTEM,	"fs" },
-	{ IH_TYPE_SCRIPT,	"script" },
+	{ IH_TYPE_STANDALONE,		"standalone" },
+	{ IH_TYPE_KERNEL,		"kernel" },
+	{ IH_TYPE_KERNEL_NOLOAD,	"kernel_noload" },
+	{ IH_TYPE_RAMDISK,		"ramdisk" },
+	{ IH_TYPE_FILESYSTEM,		"fs" },
+	{ IH_TYPE_SCRIPT,		"script" },
 };
 
 static enum uboot_image_type
@@ -221,7 +222,7 @@ usage(void)
 	    "<arm|arm64|i386|mips|mips64|or1k|powerpc>");
 	fprintf(stderr, " -C <none|bz2|gz|lzma|lzo>");
 	fprintf(stderr, " -O <openbsd|netbsd|freebsd|linux>");
-	fprintf(stderr, " -T <standalone|kernel|ramdisk|fs|script>");
+	fprintf(stderr, " -T <standalone|kernel|kernel_noload|ramdisk|fs|script>");
 	fprintf(stderr, " -a <addr> [-e <ep>] [-m <magic>] -n <name>");
 	fprintf(stderr, " <srcfile> <dstfile>\n");
 
@@ -429,11 +430,21 @@ main(int argc, char *argv[])
 
 	if (image_arch == IH_ARCH_UNKNOWN ||
 	    image_type == IH_TYPE_UNKNOWN ||
-	    (image_type != IH_TYPE_SCRIPT && image_type != IH_TYPE_RAMDISK &&
-	     image_loadaddr == 0) ||
 	    image_name == NULL)
 		usage();
 
+	switch (image_type) {
+	case IH_TYPE_SCRIPT:
+	case IH_TYPE_RAMDISK:
+	case IH_TYPE_KERNEL_NOLOAD:
+		break;
+	default:
+		if (image_loadaddr == 0)
+			usage();
+			/* NOTREACHED */
+		break;
+	}
+
 	src = argv[0];
 	dest = argv[1];
 

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.6 src/usr.bin/mkubootimage/uboot.h:1.6.8.1
--- src/usr.bin/mkubootimage/uboot.h:1.6	Tue Sep 30 10:21:50 2014
+++ src/usr.bin/mkubootimage/uboot.h	Tue Jul 25 02:00:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.6 2014/09/30 10:21:50 msaitoh Exp $ */
+/* $NetBSD: uboot.h,v 1.6.8.1 2017/07/25 02:00:33 snj Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <[email protected]>
@@ -54,6 +54,7 @@ enum uboot_image_type {
 	IH_TYPE_RAMDISK = 3,
 	IH_TYPE_SCRIPT = 6,
 	IH_TYPE_FILESYSTEM = 7,
+	IH_TYPE_KERNEL_NOLOAD = 14,
 };
 
 enum uboot_image_comp {

Reply via email to