Module Name:    src
Committed By:   jmcneill
Date:           Sat Jul 15 11:13:08 UTC 2017

Modified Files:
        src/usr.bin/mkubootimage: mkubootimage.1 mkubootimage.c uboot.h

Log Message:
Add support for "kernel_noload" image types. This type is the same as the
"kernel" type, except it can run from any load address.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.6 -r1.7 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.9
--- src/usr.bin/mkubootimage/mkubootimage.1:1.8	Tue Sep 30 10:30:35 2014
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Jul 15 11:13:08 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.8 2014/09/30 10:30:35 wiz Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.9 2017/07/15 11:13:08 jmcneill 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
@@ -44,7 +44,7 @@
 .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 )
+.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

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.19 src/usr.bin/mkubootimage/mkubootimage.c:1.20
--- src/usr.bin/mkubootimage/mkubootimage.c:1.19	Wed Jul  5 01:09:17 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Jul 15 11:13:08 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.19 2017/07/05 01:09:17 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mkubootimage.c,v 1.19 2017/07/05 01:09:17 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill 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.7
--- src/usr.bin/mkubootimage/uboot.h:1.6	Tue Sep 30 10:21:50 2014
+++ src/usr.bin/mkubootimage/uboot.h	Sat Jul 15 11:13:08 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.6 2014/09/30 10:21:50 msaitoh Exp $ */
+/* $NetBSD: uboot.h,v 1.7 2017/07/15 11:13:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -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