CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed May 22 00:02:47 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage.1: improve markup


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed May 22 00:02:47 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage.1: improve markup


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mkubootimage/mkubootimage.1

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.19 src/usr.bin/mkubootimage/mkubootimage.1:1.20
--- src/usr.bin/mkubootimage/mkubootimage.1:1.19	Tue May 21 23:31:21 2024
+++ src/usr.bin/mkubootimage/mkubootimage.1	Wed May 22 00:02:46 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.19 2024/05/21 23:31:21 uwe Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.20 2024/05/22 00:02:46 uwe Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,18 +35,65 @@
 .Nd create U-Boot loader image
 .Sh SYNOPSIS
 .Nm
+.
 .Op Fl hu
-.Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns riscv Ns | Ns sh )
+.
+.Fl A Po Xo
+.Li arm Ns \||\| Ns
+.Li arm64   Ns \||\| Ns
+.Li i386Ns \||\| Ns
+.Li mipsNs \||\| Ns
+.Li mips64  Ns \||\| Ns
+.Li or1kNs \||\| Ns
+.Li powerpc Ns \||\| Ns
+.Li riscv   Ns \||\| Ns
+.Li sh
+.Xc Pc
+.
+.br
 .Fl a Ar address
-.Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
+.
+.Oo Fl C Po Xo
+.Li bz2  Ns \||\| Ns
+.Li gz   Ns \||\| Ns
+.Li lzma Ns \||\| Ns
+.Li lzo  Ns \||\| Ns
+.Li none
+.Xc Pc Oc
+.
 .Op Fl E Ar address
+.
 .Op Fl e Ar address
-.Op Fl f Po arm64 Ns | Ns uimg Pc
+.
+.Oo Fl f Po Xo
+.Li arm64 Ns \||\| Ns
+.Li uimg
+.Xc Pc Oc
+.
 .Op Fl m Ar magic
-.Fl n Ar image
-.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 script Ns | Ns standalone )
+.
+.Fl n Ar name
+.
+.br
+.Oo Fl O Po Xo
+.Li freebsd Ns \||\| Ns
+.Li linux   Ns \||\| Ns
+.Li netbsd  Ns \||\| Ns
+.Li openbsd
+.Xc Pc Oc
+.
+.br
+.Fl T Po Xo
+.Li fsNs \||\| Ns
+.Li kernelNs \||\| Ns
+.Li kernel_noload Ns \||\| Ns
+.Li ramdisk   Ns \||\| Ns
+.Li scriptNs \||\| Ns
+.Li standalone
+.Xc Pc
+.
 .Op Fl t Ar epoch
+.
 .Ar source destination
 .\"
 .Sh DESCRIPTION
@@ -56,23 +103,46 @@ utility is used to create an image for D
 .Qq Universal Boot Loader .
 .Pp
 The arguments are as follows:
-.Bl -tag -width indent
-.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns riscv Ns | Ns sh )
+.Bl -tag -width Fl
+.
+.It Fl A Po Xo
+.Li arm Ns \||\| Ns
+.Li arm64   Ns \||\| Ns
+.Li i386Ns \||\| Ns
+.Li mipsNs \||\| Ns
+.Li mips64  Ns \||\| Ns
+.Li or1kNs \||\| Ns
+.Li powerpc Ns \||\| Ns
+.Li riscv   Ns \||\| Ns
+.Li sh
+.Xc Pc
 Defines the architecture.
 This is required for
-.Qq uimg
+.Ql uimg
 format images.
+.
 .It Fl a Ar address
 Sets the image load address.
 This is an integer between 0 and
 .Dv UINT32_MAX .
 This is required for all
-.Qq uimg
-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 )
+.Ql uimg
+image types except for
+.Li script , ramdisk ,
+and
+.Li kernel_noload .
+.
+.It Fl C Po Xo
+.Li bz2  Ns \||\| Ns
+.Li gz   Ns \||\| Ns
+.Li lzma Ns \||\| Ns
+.Li lzo  Ns \||\| Ns
+.Li none
+.Xc Pc
 Defines the compression.
 The default is
-.Qq none .
+.Ql none .
+.
 .It Fl E Ar address
 Define the entry point.
 This is an integer between 0 and
@@ -88,6 +158,7 @@ or
 are not set, the entry point defaults to the
 image load address
 .Pq Fl a .
+.
 .It Fl e Ar address
 Define the entry point.
 This is an integer between 0 and
@@ -99,37 +170,61 @@ or
 are not set, the entry point defaults to the
 image load address
 .Pq Fl a .
-.It Fl f No ( arm64 Ns | Ns uimg )
+.
+.It Fl f Po Xo
+.Li arm64 Ns \||\| Ns
+.Li uimg
+.Xc Pc
 Defines the output image format type.
 The default is
-.Qq uimg .
+.Ql uimg .
+.
 .It Fl h
 Display the usage and exit.
+.
 .It Fl m Ar magic
 Set the magic used for
-.Qq uimg
+.Ql uimg
 format images.
 This is an integer between 0 and
 .Dv UINT32_MAX .
 The default is
-.Qq 0x27051956 .
-.It Fl n Ar image
+.Ql 0x27051956 .
+.
+.It Fl n Ar name
 Defines the image name.
 This is required.
-.It Fl O No ( freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd )
+.
+.It Fl O Po Xo
+.Li freebsd Ns \||\| Ns
+.Li linux   Ns \||\| Ns
+.Li netbsd  Ns \||\| Ns
+.Li openbsd
+.Xc Pc
 Defines the operating system type.
 The default OS name is
-.Qq netbsd .
-.It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
+.Ql netbsd .
+.
+.It Fl T Po Xo
+.Li fsNs \||\| Ns
+.Li kernelNs \||\| Ns
+.Li kernel_noload Ns \||\| Ns
+.Li ramdisk   Ns \||\| Ns
+.Li scriptNs \||\| Ns
+.Li standalone
+.Xc Pc
 Defines the 

CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 21 23:31:21 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage.1: restore .Ed lost in previous


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mkubootimage/mkubootimage.1

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.18 src/usr.bin/mkubootimage/mkubootimage.1:1.19
--- src/usr.bin/mkubootimage/mkubootimage.1:1.18	Tue May 21 22:10:21 2024
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue May 21 23:31:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.18 2024/05/21 22:10:21 gutteridge Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.19 2024/05/21 23:31:21 uwe Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -161,6 +161,7 @@ for example:
  comp:0 (none)
  name:NetBSD/armv7 boot
  header crc:  0x2164b567
+.Ed
 .\" .Sh FILES
 .Sh SEE ALSO
 .Qq Das U-Boot - the Universal Boot Loader



CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 21 23:31:21 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage.1: restore .Ed lost in previous


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 22:10:21 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage(1): adjust example output in man page

Refresh to show current output format (an additional field) and address
a "TODO" comment that's been there for over a decade.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2024-05-21 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 22:10:21 UTC 2024

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
mkubootimage(1): adjust example output in man page

Refresh to show current output format (an additional field) and address
a "TODO" comment that's been there for over a decade.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mkubootimage/mkubootimage.1

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.17 src/usr.bin/mkubootimage/mkubootimage.1:1.18
--- src/usr.bin/mkubootimage/mkubootimage.1:1.17	Tue May 21 04:01:26 2024
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue May 21 22:10:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.17 2024/05/21 04:01:26 gutteridge Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.18 2024/05/21 22:10:21 gutteridge Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -148,20 +148,19 @@ generate a header, or create the image.
 Before the image is written, the header is displayed to standard out;
 for example:
 .Bd -literal -offset 0
+ image type:  uimg
  magic:   0x27051956
- time:Tue Jun  7 15:58:41 2011
- size:2482203
- load addr:   0x0002
- entry point: 0x0002
- data crc:0x700fdf53
+ time:Tue May 21 18:05:09 2024
+ size:137
+ load addr:   0x
+ entry point: 0x
+ data crc:0xface05f2
  os:  2 (netbsd)
- arch:7 (powerpc)
- type:2 (kernel)
- comp:1 (gz)
- name:NetBSD/evbppc 5.99.52 (INSTALL_PMPPC)
- header crc:  0x94ea96cf
-.Ed
-.\" TODO: check the name line above
+ arch:2 (arm)
+ type:6 (script)
+ comp:0 (none)
+ name:NetBSD/armv7 boot
+ header crc:  0x2164b567
 .\" .Sh FILES
 .Sh SEE ALSO
 .Qq Das U-Boot - the Universal Boot Loader



CVS commit: src/usr.bin/mkubootimage

2024-05-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 04:01:26 UTC 2024

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

Log Message:
mkubootimage(1): adjust usage, etc.

In the tool, reflow and reorder usage() output and also consistently
mark which arguments are optional.

In the man page, add missing -t argument in the synopsis and follow
consistent argument ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mkubootimage/mkubootimage.c

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.16 src/usr.bin/mkubootimage/mkubootimage.1:1.17
--- src/usr.bin/mkubootimage/mkubootimage.1:1.16	Tue May 21 03:54:31 2024
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue May 21 04:01:26 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.16 2024/05/21 03:54:31 gutteridge Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.17 2024/05/21 04:01:26 gutteridge Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -46,6 +46,7 @@
 .Fl n Ar image
 .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 script Ns | Ns standalone )
+.Op Fl t Ar epoch
 .Ar source destination
 .\"
 .Sh DESCRIPTION
@@ -119,14 +120,14 @@ This is required.
 Defines the operating system type.
 The default OS name is
 .Qq netbsd .
-.It Fl t Ar epoch
-Use given epoch timestamp as image creation time.
-(This is only used for legacy U-Boot images.)
 .It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
 Defines the image type.
 This is required for
 .Qq uimg
 format images.
+.It Fl t Ar epoch
+Use given epoch timestamp as image creation time.
+(This is only used for legacy U-Boot images.)
 .It Fl u
 Update the header in an existing file instead of creating a new one.
 .El

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.32 src/usr.bin/mkubootimage/mkubootimage.c:1.33
--- src/usr.bin/mkubootimage/mkubootimage.c:1.32	Tue May 21 03:54:31 2024
+++ src/usr.bin/mkubootimage/mkubootimage.c	Tue May 21 04:01:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.32 2024/05/21 03:54:31 gutteridge Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.33 2024/05/21 04:01:26 gutteridge Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.32 2024/05/21 03:54:31 gutteridge Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.33 2024/05/21 04:01:26 gutteridge Exp $");
 
 #include 
 #include 
@@ -264,10 +264,10 @@ __dead static void
 usage(void)
 {
 	fprintf(stderr,
-"Usage: %s [-hu] -A  -a address\n"
-"\t-C  [-E address] [-e address] [-t timestamp]\n"
-"\t[-f ] [-m magic] -n image -O \n"
-"\t-T \n"
+"Usage: %s [-hu] -A \n"
+"\t-a address [-C ] [-E address] [-e address] \n"
+"\t[-f ] [-m magic] -n image [-O ]\n"
+"\t-T  [-t timestamp]\n"
 "\tsource destination\n", getprogname());
 
 	exit(EXIT_FAILURE);



CVS commit: src/usr.bin/mkubootimage

2024-05-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 04:01:26 UTC 2024

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

Log Message:
mkubootimage(1): adjust usage, etc.

In the tool, reflow and reorder usage() output and also consistently
mark which arguments are optional.

In the man page, add missing -t argument in the synopsis and follow
consistent argument ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2024-05-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 03:54:32 UTC 2024

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

Log Message:
mkubootimage(1): add riscv


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.8 -r1.9 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.15 src/usr.bin/mkubootimage/mkubootimage.1:1.16
--- src/usr.bin/mkubootimage/mkubootimage.1:1.15	Fri Feb  9 16:10:18 2024
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue May 21 03:54:31 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.15 2024/02/09 16:10:18 christos Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.16 2024/05/21 03:54:31 gutteridge 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 February 7, 2024
+.Dd May 21, 2024
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl hu
-.Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
+.Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns riscv Ns | Ns sh )
 .Fl a Ar address
 .Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
 .Op Fl E Ar address
@@ -56,7 +56,7 @@ utility is used to create an image for D
 .Pp
 The arguments are as follows:
 .Bl -tag -width indent
-.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
+.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns riscv Ns | Ns sh )
 Defines the architecture.
 This is required for
 .Qq uimg

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.31 src/usr.bin/mkubootimage/mkubootimage.c:1.32
--- src/usr.bin/mkubootimage/mkubootimage.c:1.31	Fri Feb  9 16:10:18 2024
+++ src/usr.bin/mkubootimage/mkubootimage.c	Tue May 21 03:54:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.31 2024/02/09 16:10:18 christos Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.32 2024/05/21 03:54:31 gutteridge Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.31 2024/02/09 16:10:18 christos Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.32 2024/05/21 03:54:31 gutteridge Exp $");
 
 #include 
 #include 
@@ -155,6 +155,7 @@ static const struct uboot_arch {
 	{ IH_ARCH_MIPS64,	"mips64" },
 	{ IH_ARCH_PPC,		"powerpc" },
 	{ IH_ARCH_OPENRISC,	"or1k" },
+	{ IH_ARCH_RISCV,	"riscv" },
 	{ IH_ARCH_SH,		"sh" },
 };
 
@@ -263,7 +264,7 @@ __dead static void
 usage(void)
 {
 	fprintf(stderr,
-"Usage: %s [-hu] -A  -a address\n"
+"Usage: %s [-hu] -A  -a address\n"
 "\t-C  [-E address] [-e address] [-t timestamp]\n"
 "\t[-f ] [-m magic] -n image -O \n"
 "\t-T \n"

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.8 src/usr.bin/mkubootimage/uboot.h:1.9
--- src/usr.bin/mkubootimage/uboot.h:1.8	Fri Sep 29 21:18:28 2017
+++ src/usr.bin/mkubootimage/uboot.h	Tue May 21 03:54:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.8 2017/09/29 21:18:28 jmcneill Exp $ */
+/* $NetBSD: uboot.h,v 1.9 2024/05/21 03:54:31 gutteridge Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -45,7 +45,8 @@ enum uboot_image_arch {
 	IH_ARCH_PPC = 7,
 	IH_ARCH_SH = 9,
 	IH_ARCH_OPENRISC = 21,
-	IH_ARCH_ARM64 = 22
+	IH_ARCH_ARM64 = 22,
+	IH_ARCH_RISCV = 26
 };
 
 enum uboot_image_type {



CVS commit: src/usr.bin/mkubootimage

2024-05-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 21 03:54:32 UTC 2024

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

Log Message:
mkubootimage(1): add riscv


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.8 -r1.9 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.



CVS commit: src/usr.bin/mkubootimage

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:10:18 UTC 2024

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

Log Message:
PR/57914: Jan-Benedict Glaw: Set reproducible timestamp
Cleanup lint.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/crc32.c
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/crc32.h
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/mkubootimage/mkubootimage.c

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/crc32.c
diff -u src/usr.bin/mkubootimage/crc32.c:1.4 src/usr.bin/mkubootimage/crc32.c:1.5
--- src/usr.bin/mkubootimage/crc32.c:1.4	Sat Dec 29 11:18:08 2012
+++ src/usr.bin/mkubootimage/crc32.c	Fri Feb  9 11:10:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: crc32.c,v 1.4 2012/12/29 16:18:08 jmcneill Exp $ */
+/* $NetBSD: crc32.c,v 1.5 2024/02/09 16:10:18 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -33,14 +33,12 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: crc32.c,v 1.4 2012/12/29 16:18:08 jmcneill Exp $");
+__RCSID("$NetBSD: crc32.c,v 1.5 2024/02/09 16:10:18 christos Exp $");
 
 #include 
 #include 
 #include 
-
-uint32_t	crc32(const void *, size_t);
-uint32_t	crc32v(const struct iovec *, int);
+#include "crc32.h"
 
 static uint32_t crc32_tab[] = {
 	0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
@@ -99,6 +97,7 @@ crc32v(const struct iovec *iov, int cnt)
 
 	for (i = 0; i < cnt; i++) {
 		p = iov[i].iov_base;
+/*###102 [lint] warning conversion from 'unsigned long' to 'int' may lose accuracy [132]%%%*/
 		len = iov[i].iov_len;
 		while (len--)
 			crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);

Index: src/usr.bin/mkubootimage/mkubootimage.1
diff -u src/usr.bin/mkubootimage/mkubootimage.1:1.14 src/usr.bin/mkubootimage/mkubootimage.1:1.15
--- src/usr.bin/mkubootimage/mkubootimage.1:1.14	Sat Dec  7 07:34:17 2019
+++ src/usr.bin/mkubootimage/mkubootimage.1	Fri Feb  9 11:10:18 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.14 2019/12/07 12:34:17 wiz Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.15 2024/02/09 16:10:18 christos 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 December 4, 2019
+.Dd February 7, 2024
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -119,6 +119,9 @@ This is required.
 Defines the operating system type.
 The default OS name is
 .Qq netbsd .
+.It Fl t Ar epoch
+Use given epoch timestamp as image creation time.
+(This is only used for legacy U-Boot images.)
 .It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
 Defines the image type.
 This is required for

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.30 src/usr.bin/mkubootimage/mkubootimage.c:1.31
--- src/usr.bin/mkubootimage/mkubootimage.c:1.30	Sat Feb  8 08:27:00 2020
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Feb  9 11:10:18 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.30 2020/02/08 13:27:00 ryo Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.31 2024/02/09 16:10:18 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.30 2020/02/08 13:27:00 ryo Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.31 2024/02/09 16:10:18 christos Exp $");
 
 #include 
 #include 
@@ -51,6 +51,7 @@ __RCSID("$NetBSD: mkubootimage.c,v 1.30 
 
 #include "uboot.h"
 #include "arm64.h"
+#include "crc32.h"
 
 #ifndef __arraycount
 #define __arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
@@ -62,9 +63,6 @@ enum image_format {
 	FMT_ARM64,	/* Linux ARM64 image (booti) */
 };
 
-extern uint32_t crc32(const void *, size_t);
-extern uint32_t crc32v(const struct iovec *, int);
-
 static enum uboot_image_os image_os = IH_OS_NETBSD;
 static enum uboot_image_arch image_arch = IH_ARCH_UNKNOWN;
 static enum uboot_image_type image_type = IH_TYPE_UNKNOWN;
@@ -264,12 +262,12 @@ get_comp_name(enum uboot_image_comp comp
 __dead static void
 usage(void)
 {
-	fprintf(stderr, "usage: mkubootimage [-hu] -A "
-	" -a address\n");
-	fprintf(stderr, "\t-C  [-E address] [-e address]\n");
-	fprintf(stderr, "\t[-f ] [-m magic] -n image -O \n");
-	fprintf(stderr, "\t-T \n");
-	fprintf(stderr, "\tsource destination\n");
+	fprintf(stderr,
+"Usage: %s [-hu] -A  -a address\n"
+"\t-C  [-E address] [-e address] [-t timestamp]\n"
+"\t[-f ] [-m magic] -n image -O \n"
+"\t-T \n"
+"\tsource destination\n", getprogname());
 
 	exit(EXIT_FAILURE);
 }
@@ -298,7 +296,8 @@ dump_header_uimg(struct uboot_image_head
 }
 
 static int

CVS commit: src/usr.bin/mkubootimage

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:10:18 UTC 2024

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

Log Message:
PR/57914: Jan-Benedict Glaw: Set reproducible timestamp
Cleanup lint.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/crc32.c
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/crc32.h
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2020-02-08 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Feb  8 13:27:01 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
arm64_image_header->image_size must be included size of arm64_image_header.

with -u option, image_size should be binary (file) size (header included).
without -u option, image_size should be binary (file) size + header size.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2020-02-08 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Feb  8 13:27:01 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
arm64_image_header->image_size must be included size of arm64_image_header.

with -u option, image_size should be binary (file) size (header included).
without -u option, image_size should be binary (file) size + header size.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.29 src/usr.bin/mkubootimage/mkubootimage.c:1.30
--- src/usr.bin/mkubootimage/mkubootimage.c:1.29	Wed Jan  1 11:48:36 2020
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Feb  8 13:27:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.29 2020/01/01 11:48:36 martin Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.30 2020/02/08 13:27:00 ryo Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.29 2020/01/01 11:48:36 martin Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.30 2020/02/08 13:27:00 ryo Exp $");
 
 #include 
 #include 
@@ -389,7 +389,7 @@ generate_header_arm64(struct arm64_image
 #endif
 
 	const uint64_t dsize = update_image ?
-	   (uint64_t)st.st_size - sizeof(*hdr) : (uint64_t)st.st_size;
+	(uint64_t)st.st_size : (uint64_t)st.st_size + sizeof(*hdr);
 
 	memset(hdr, 0, sizeof(*hdr));
 	hdr->code0 = htole32(ARM64_CODE0);



CVS commit: src/usr.bin/mkubootimage

2020-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  1 11:48:36 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Avoid mixing signed/unsigned arguments to the ? operator.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.28 src/usr.bin/mkubootimage/mkubootimage.c:1.29
--- src/usr.bin/mkubootimage/mkubootimage.c:1.28	Wed Jan  1 10:35:10 2020
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Jan  1 11:48:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.28 2020/01/01 10:35:10 skrll Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.29 2020/01/01 11:48:36 martin Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.28 2020/01/01 10:35:10 skrll Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.29 2020/01/01 11:48:36 martin Exp $");
 
 #include 
 #include 
@@ -335,7 +335,7 @@ generate_header_uimg(struct uboot_image_
 		crc = crc32v(iov, 3);
 	} else {
 		dsize = update_image ?
-		st.st_size - sizeof(*hdr) : st.st_size;
+		(uint32_t)st.st_size - sizeof(*hdr) : (uint32_t)st.st_size;
 		crc = crc32(p, st.st_size);
 	}
 	munmap(p, st.st_size);
@@ -389,7 +389,7 @@ generate_header_arm64(struct arm64_image
 #endif
 
 	const uint64_t dsize = update_image ?
-	   st.st_size - sizeof(*hdr) : st.st_size;
+	   (uint64_t)st.st_size - sizeof(*hdr) : (uint64_t)st.st_size;
 
 	memset(hdr, 0, sizeof(*hdr));
 	hdr->code0 = htole32(ARM64_CODE0);



CVS commit: src/usr.bin/mkubootimage

2020-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  1 11:48:36 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Avoid mixing signed/unsigned arguments to the ? operator.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2020-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  1 10:35:10 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Adjust image size appropriately when using update_image

OK jmcneill


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2020-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  1 10:35:10 UTC 2020

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Adjust image size appropriately when using update_image

OK jmcneill


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.27 src/usr.bin/mkubootimage/mkubootimage.c:1.28
--- src/usr.bin/mkubootimage/mkubootimage.c:1.27	Sat Dec  7 12:34:17 2019
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Jan  1 10:35:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.28 2020/01/01 10:35:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.28 2020/01/01 10:35:10 skrll Exp $");
 
 #include 
 #include 
@@ -334,7 +334,8 @@ generate_header_uimg(struct uboot_image_
 		iov[2].iov_len = st.st_size;
 		crc = crc32v(iov, 3);
 	} else {
-		dsize = st.st_size;
+		dsize = update_image ?
+		st.st_size - sizeof(*hdr) : st.st_size;
 		crc = crc32(p, st.st_size);
 	}
 	munmap(p, st.st_size);
@@ -387,10 +388,13 @@ generate_header_arm64(struct arm64_image
 	flags |= ARM64_FLAGS_PHYS_PLACEMENT_ANY;
 #endif
 
+	const uint64_t dsize = update_image ?
+	   st.st_size - sizeof(*hdr) : st.st_size;
+
 	memset(hdr, 0, sizeof(*hdr));
 	hdr->code0 = htole32(ARM64_CODE0);
 	hdr->text_offset = htole64(image_entrypoint);
-	hdr->image_size = htole64(st.st_size + sizeof(*hdr));
+	hdr->image_size = htole64(dsize);
 	hdr->flags = htole32(flags);
 	hdr->magic = htole32(ARM64_MAGIC);
 



CVS commit: src/usr.bin/mkubootimage

2019-12-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  7 12:34:17 UTC 2019

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

Log Message:
Sync usage with man page, merge single letter options.

Limit program usage line length.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mkubootimage/mkubootimage.c

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.13 src/usr.bin/mkubootimage/mkubootimage.1:1.14
--- src/usr.bin/mkubootimage/mkubootimage.1:1.13	Wed Dec  4 11:21:34 2019
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Dec  7 12:34:17 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.13 2019/12/04 11:21:34 jmcneill Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.14 2019/12/07 12:34:17 wiz Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .Nd create U-Boot loader image
 .Sh SYNOPSIS
 .Nm
-.Op Fl h
+.Op Fl hu
 .Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 .Fl a Ar address
 .Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
@@ -45,8 +45,7 @@
 .Op Fl m Ar magic
 .Fl n Ar image
 .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 )
-.Op Fl u
+.Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
 .Ar source destination
 .\"
 .Sh DESCRIPTION
@@ -59,7 +58,7 @@ The arguments are as follows:
 .Bl -tag -width indent
 .It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 Defines the architecture.
-This is required for 
+This is required for
 .Qq uimg
 format images.
 .It Fl a Ar address
@@ -120,7 +119,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 kernel_noload 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 script Ns | Ns standalone )
 Defines the image type.
 This is required for
 .Qq uimg

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.26 src/usr.bin/mkubootimage/mkubootimage.c:1.27
--- src/usr.bin/mkubootimage/mkubootimage.c:1.26	Wed Dec  4 14:09:47 2019
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Dec  7 12:34:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $");
 
 #include 
 #include 
@@ -264,14 +264,12 @@ get_comp_name(enum uboot_image_comp comp
 __dead static void
 usage(void)
 {
-	fprintf(stderr, "usage: mkubootimage -A "
-	"");
-	fprintf(stderr, " -C ");
-	fprintf(stderr, " -O ");
-	fprintf(stderr, " -T ");
-	fprintf(stderr, " -a  [-e ] [-m ] -n ");
-	fprintf(stderr, " [-f ] [-u]");
-	fprintf(stderr, "  \n");
+	fprintf(stderr, "usage: mkubootimage [-hu] -A "
+	" -a address\n");
+	fprintf(stderr, "\t-C  [-E address] [-e address]\n");
+	fprintf(stderr, "\t[-f ] [-m magic] -n image -O \n");
+	fprintf(stderr, "\t-T \n");
+	fprintf(stderr, "\tsource destination\n");
 
 	exit(EXIT_FAILURE);
 }



CVS commit: src/usr.bin/mkubootimage

2019-12-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  7 12:34:17 UTC 2019

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

Log Message:
Sync usage with man page, merge single letter options.

Limit program usage line length.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2019-12-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  4 14:09:47 UTC 2019

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Fix signed/unsigned comparison


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.25 src/usr.bin/mkubootimage/mkubootimage.c:1.26
--- src/usr.bin/mkubootimage/mkubootimage.c:1.25	Wed Dec  4 11:21:34 2019
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Dec  4 14:09:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.25 2019/12/04 11:21:34 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.25 2019/12/04 11:21:34 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -433,7 +433,7 @@ write_image(void *hdr, size_t hdrlen, in
 	}
 
 	if (update_image) {
-		if (lseek(kernel_fd, hdrlen, SEEK_SET) != hdrlen) {
+		if (lseek(kernel_fd, hdrlen, SEEK_SET) != (off_t)hdrlen) {
 			perror("seek failed");
 			return errno;
 		}



CVS commit: src/usr.bin/mkubootimage

2019-12-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  4 14:09:47 UTC 2019

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Fix signed/unsigned comparison


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2019-12-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  4 11:21:34 UTC 2019

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

Log Message:
Add -u flag for updating headers in place.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/mkubootimage/mkubootimage.c

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.12 src/usr.bin/mkubootimage/mkubootimage.1:1.13
--- src/usr.bin/mkubootimage/mkubootimage.1:1.12	Sun Feb  4 15:44:51 2018
+++ src/usr.bin/mkubootimage/mkubootimage.1	Wed Dec  4 11:21:34 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.12 2018/02/04 15:44:51 jmcneill Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.13 2019/12/04 11:21:34 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 February 4, 2018
+.Dd December 4, 2019
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Fl n Ar image
 .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 )
+.Op Fl u
 .Ar source destination
 .\"
 .Sh DESCRIPTION
@@ -124,6 +125,8 @@ Defines the image type.
 This is required for
 .Qq uimg
 format images.
+.It Fl u
+Update the header in an existing file instead of creating a new one.
 .El
 .Pp
 The required

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.24 src/usr.bin/mkubootimage/mkubootimage.c:1.25
--- src/usr.bin/mkubootimage/mkubootimage.c:1.24	Sun Feb  4 17:33:34 2018
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Dec  4 11:21:34 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.24 2018/02/04 17:33:34 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.25 2019/12/04 11:21:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.24 2018/02/04 17:33:34 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.25 2019/12/04 11:21:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@ static uint32_t image_entrypoint = 0;
 static char *image_name;
 static uint32_t image_magic = IH_MAGIC;
 static enum image_format image_format = FMT_UIMG;
+static int update_image = 0;
 
 static const struct uboot_image_format {
 	enum image_format format;
@@ -269,7 +270,7 @@ usage(void)
 	fprintf(stderr, " -O ");
 	fprintf(stderr, " -T ");
 	fprintf(stderr, " -a  [-e ] [-m ] -n ");
-	fprintf(stderr, " [-f ]");
+	fprintf(stderr, " [-f ] [-u]");
 	fprintf(stderr, "  \n");
 
 	exit(EXIT_FAILURE);
@@ -431,6 +432,13 @@ write_image(void *hdr, size_t hdrlen, in
 		}
 	}
 
+	if (update_image) {
+		if (lseek(kernel_fd, hdrlen, SEEK_SET) != hdrlen) {
+			perror("seek failed");
+			return errno;
+		}
+	}
+
 	while ((rlen = read(kernel_fd, buf, sizeof(buf))) > 0) {
 		wlen = write(image_fd, buf, rlen);
 		if (wlen != rlen) {
@@ -453,7 +461,7 @@ main(int argc, char *argv[])
 	int ch;
 	unsigned long long num;
 
-	while ((ch = getopt(argc, argv, "A:C:E:O:T:a:e:f:hm:n:")) != -1) {
+	while ((ch = getopt(argc, argv, "A:C:E:O:T:a:e:f:hm:n:u")) != -1) {
 		switch (ch) {
 		case 'A':	/* arch */
 			image_arch = get_arch(optarg);
@@ -504,6 +512,9 @@ main(int argc, char *argv[])
 		case 'n':	/* name */
 			image_name = strdup(optarg);
 			break;
+		case 'u':	/* update image */
+			update_image = 1;
+			break;
 		case 'h':
 		default:
 			usage();



CVS commit: src/usr.bin/mkubootimage

2019-12-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  4 11:21:34 UTC 2019

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

Log Message:
Add -u flag for updating headers in place.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2018-02-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  4 17:33:34 UTC 2018

Modified Files:
src/usr.bin/mkubootimage: arm64.h mkubootimage.c

Log Message:
Fix tools build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/arm64.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mkubootimage/mkubootimage.c

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/arm64.h
diff -u src/usr.bin/mkubootimage/arm64.h:1.1 src/usr.bin/mkubootimage/arm64.h:1.2
--- src/usr.bin/mkubootimage/arm64.h:1.1	Sun Feb  4 15:44:51 2018
+++ src/usr.bin/mkubootimage/arm64.h	Sun Feb  4 17:33:34 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: arm64.h,v 1.1 2018/02/04 15:44:51 jmcneill Exp $ */
+/* $NetBSD: arm64.h,v 1.2 2018/02/04 17:33:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -48,15 +48,15 @@ struct arm64_image_header {
 };
 
 /* Kernel flags */
-#define	ARM64_FLAGS_ENDIAN_BE		__BIT(0)
-#define	ARM64_FLAGS_PAGE_SIZE		__BITS(2,1)
-#define	 ARM64_FLAGS_PAGE_SIZE_UNSPEC		0
-#define	 ARM64_FLAGS_PAGE_SIZE_4K		1
-#define	 ARM64_FLAGS_PAGE_SIZE_16K		2
-#define	 ARM64_FLAGS_PAGE_SIZE_64K		3
-#define	ARM64_FLAGS_PHYS_PLACEMENT	__BIT(3)
-#define	 ARM64_FLAGS_PHYS_PLACEMENT_DRAM_BASE	0
-#define	 ARM64_FLAGS_PHYS_PLACEMENT_ANY		1
+#define	ARM64_FLAGS_ENDIAN_BE		(1 << 0)
+#define	ARM64_FLAGS_PAGE_SIZE		(3 << 1)
+#define	 ARM64_FLAGS_PAGE_SIZE_UNSPEC		(0 << 1)
+#define	 ARM64_FLAGS_PAGE_SIZE_4K		(1 << 1)
+#define	 ARM64_FLAGS_PAGE_SIZE_16K		(2 << 1)
+#define	 ARM64_FLAGS_PAGE_SIZE_64K		(3 << 1)
+#define	ARM64_FLAGS_PHYS_PLACEMENT	(1 << 3)
+#define	 ARM64_FLAGS_PHYS_PLACEMENT_DRAM_BASE	(0 << 3)
+#define	 ARM64_FLAGS_PHYS_PLACEMENT_ANY		(1 << 3)
 
 /* Magic */
 #define	ARM64_MAGIC	0x644d5241

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.23 src/usr.bin/mkubootimage/mkubootimage.c:1.24
--- src/usr.bin/mkubootimage/mkubootimage.c:1.23	Sun Feb  4 15:44:51 2018
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sun Feb  4 17:33:34 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.23 2018/02/04 15:44:51 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.24 2018/02/04 17:33:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.23 2018/02/04 15:44:51 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.24 2018/02/04 17:33:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -244,7 +244,7 @@ get_comp(const char *name)
 			return uboot_comp[i].comp;
 	}
 
-	return IH_TYPE_UNKNOWN;
+	return IH_COMP_NONE;
 }
 
 static const char *
@@ -383,12 +383,9 @@ generate_header_arm64(struct arm64_image
 	}
 
 	flags = 0;
-	
-	flags |= __SHIFTIN(ARM64_FLAGS_PAGE_SIZE_4K,
-			   ARM64_FLAGS_PAGE_SIZE);
+	flags |= ARM64_FLAGS_PAGE_SIZE_4K;
 #if 0
-	flags |= __SHIFTIN(ARM64_FLAGS_PHYS_PLACEMENT_ANY,
-			   ARM64_FLAGS_PHYS_PLACEMENT);
+	flags |= ARM64_FLAGS_PHYS_PLACEMENT_ANY;
 #endif
 
 	memset(hdr, 0, sizeof(*hdr));



CVS commit: src/usr.bin/mkubootimage

2018-02-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  4 17:33:34 UTC 2018

Modified Files:
src/usr.bin/mkubootimage: arm64.h mkubootimage.c

Log Message:
Fix tools build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/arm64.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2018-02-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  4 15:44:51 UTC 2018

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

Log Message:
Add support for writing "AArch64 Linux kernel image" format images.

These images begin with a 64-byte header that includes a load offset,
image size, some flags, and a small (2 word) area at the start for
executable code.

These images are compatible with U-Boot's "booti" command, and can be
used to make U-Boot relocate our kernel to a 2MB aligned base address.
After relocation, U-Boot will jump to the code at the beginning of the
header, where we encode a relative branch forward instruction to branch
to the beginning of the kernel at offset +0x40.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/arm64.h
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mkubootimage/mkubootimage.c

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.11 src/usr.bin/mkubootimage/mkubootimage.1:1.12
--- src/usr.bin/mkubootimage/mkubootimage.1:1.11	Fri Sep 29 21:18:28 2017
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sun Feb  4 15:44:51 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.11 2017/09/29 21:18:28 jmcneill Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.12 2018/02/04 15:44:51 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 29, 2017
+.Dd February 4, 2018
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .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 f Po arm64 Ns | Ns uimg Pc
 .Op Fl m Ar magic
 .Fl n Ar image
 .Op Fl O Po freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd Pc
@@ -57,12 +58,16 @@ The arguments are as follows:
 .Bl -tag -width indent
 .It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 Defines the architecture.
-This is required.
+This is required for 
+.Qq uimg
+format images.
 .It Fl a Ar address
 Sets the image load address.
 This is an integer between 0 and
 .Dv UINT32_MAX .
-This is required for all image types except for script, ramdisk, and kernel_noload.
+This is required for all
+.Qq uimg
+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
@@ -93,10 +98,16 @@ or
 are not set, the entry point defaults to the
 image load address
 .Pq Fl a .
+.It Fl f No ( arm64 Ns | Ns uimg )
+Defines the output image format type.
+The default is
+.Qq uimg .
 .It Fl h
 Display the usage and exit.
 .It Fl m Ar magic
-Set the magic.
+Set the magic used for
+.Qq uimg
+format images.
 This is an integer between 0 and
 .Dv UINT32_MAX .
 The default is
@@ -110,7 +121,9 @@ The default OS name is
 .Qq netbsd .
 .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.
+This is required for
+.Qq uimg
+format images.
 .El
 .Pp
 The required
@@ -161,7 +174,7 @@ command first appeared in
 The
 .Nm
 utility was originally written by
-.An Jared D. McNeill .
+.An Jared McNeill .
 This manual page was written by
 .An Jeremy C. Reed .
 .\" .Sh CAVEATS

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.22 src/usr.bin/mkubootimage/mkubootimage.c:1.23
--- src/usr.bin/mkubootimage/mkubootimage.c:1.22	Sun Nov  5 11:07:32 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sun Feb  4 15:44:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.22 2017/11/05 11:07:32 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.23 2018/02/04 15:44:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,15 +30,17 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.22 2017/11/05 11:07:32 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.23 2018/02/04 15:44:51 jmcneill Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,11 +50,18 @@ __RCSID("$NetBSD: mkubootimage.c,v 1.22 
 #include 
 
 #include "uboot.h"
+#include "arm64.h"
 
 #ifndef __arraycount
 #define __arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
 #endif
 
+enum image_format {
+	FMT_UNKNOWN,
+	FMT_UIMG,	/* Legacy U-Boot image */
+	FMT_ARM64,	/* Linux ARM64 image (booti) */
+};
+
 extern uint32_t crc32(const void *, size_t);
 extern uint32_t crc32v(const 

CVS commit: src/usr.bin/mkubootimage

2018-02-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  4 15:44:51 UTC 2018

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

Log Message:
Add support for writing "AArch64 Linux kernel image" format images.

These images begin with a 64-byte header that includes a load offset,
image size, some flags, and a small (2 word) area at the start for
executable code.

These images are compatible with U-Boot's "booti" command, and can be
used to make U-Boot relocate our kernel to a 2MB aligned base address.
After relocation, U-Boot will jump to the code at the beginning of the
header, where we encode a relative branch forward instruction to branch
to the beginning of the kernel at offset +0x40.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/arm64.h
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2017-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov  5 11:07:32 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
add missing break after -m case


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.21 src/usr.bin/mkubootimage/mkubootimage.c:1.22
--- src/usr.bin/mkubootimage/mkubootimage.c:1.21	Fri Sep 29 21:18:28 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sun Nov  5 11:07:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.22 2017/11/05 11:07:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.22 2017/11/05 11:07:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -411,6 +411,7 @@ main(int argc, char *argv[])
 			(num == ULONG_MAX || num == 0)))
 errx(1, "illegal number -- %s", optarg);
 			image_magic = (uint32_t)num;
+			break;
 		case 'n':	/* name */
 			image_name = strdup(optarg);
 			break;



CVS commit: src/usr.bin/mkubootimage

2017-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov  5 11:07:32 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
add missing break after -m case


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2017-09-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep 29 21:18:28 UTC 2017

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

Log Message:
add sh arch


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.7 -r1.8 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.10 src/usr.bin/mkubootimage/mkubootimage.1:1.11
--- src/usr.bin/mkubootimage/mkubootimage.1:1.10	Sat Jul 15 12:10:31 2017
+++ src/usr.bin/mkubootimage/mkubootimage.1	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.10 2017/07/15 12:10:31 wiz Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.11 2017/09/29 21:18:28 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 July 15, 2017
+.Dd September 29, 2017
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .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 No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 .Fl a Ar address
 .Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
 .Op Fl E Ar address
@@ -55,7 +55,7 @@ utility is used to create an image for D
 .Pp
 The arguments are as follows:
 .Bl -tag -width indent
-.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc )
+.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 Defines the architecture.
 This is required.
 .It Fl a Ar address

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.20 src/usr.bin/mkubootimage/mkubootimage.c:1.21
--- src/usr.bin/mkubootimage/mkubootimage.c:1.20	Sat Jul 15 11:13:08 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -106,12 +106,13 @@ static const struct uboot_arch {
 	const char *name;
 } uboot_arch[] = {
 	{ IH_ARCH_ARM,		"arm" },
+	{ IH_ARCH_ARM64,	"arm64" },
 	{ IH_ARCH_I386,		"i386" },
 	{ IH_ARCH_MIPS,		"mips" },
 	{ IH_ARCH_MIPS64,	"mips64" },
 	{ IH_ARCH_PPC,		"powerpc" },
 	{ IH_ARCH_OPENRISC,	"or1k" },
-	{ IH_ARCH_ARM64,	"arm64" },
+	{ IH_ARCH_SH,		"sh" },
 };
 
 static enum uboot_image_arch
@@ -219,7 +220,7 @@ __dead static void
 usage(void)
 {
 	fprintf(stderr, "usage: mkubootimage -A "
-	"");
+	"");
 	fprintf(stderr, " -C ");
 	fprintf(stderr, " -O ");
 	fprintf(stderr, " -T ");

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.7 src/usr.bin/mkubootimage/uboot.h:1.8
--- src/usr.bin/mkubootimage/uboot.h:1.7	Sat Jul 15 11:13:08 2017
+++ src/usr.bin/mkubootimage/uboot.h	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.7 2017/07/15 11:13:08 jmcneill Exp $ */
+/* $NetBSD: uboot.h,v 1.8 2017/09/29 21:18:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -43,6 +43,7 @@ enum uboot_image_arch {
 	IH_ARCH_MIPS = 5,
 	IH_ARCH_MIPS64 = 6,
 	IH_ARCH_PPC = 7,
+	IH_ARCH_SH = 9,
 	IH_ARCH_OPENRISC = 21,
 	IH_ARCH_ARM64 = 22
 };



CVS commit: src/usr.bin/mkubootimage

2017-09-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep 29 21:18:28 UTC 2017

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

Log Message:
add sh arch


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.7 -r1.8 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.



CVS commit: src/usr.bin/mkubootimage

2017-07-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jul 15 12:10:31 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Remove unnecessary macros. Use standard headers.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mkubootimage/mkubootimage.1

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.9 src/usr.bin/mkubootimage/mkubootimage.1:1.10
--- src/usr.bin/mkubootimage/mkubootimage.1:1.9	Sat Jul 15 11:13:08 2017
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Jul 15 12:10:31 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.9 2017/07/15 11:13:08 jmcneill Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.10 2017/07/15 12:10:31 wiz Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -38,12 +38,12 @@
 .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
+.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
 .\"
@@ -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.



CVS commit: src/usr.bin/mkubootimage

2017-07-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jul 15 12:10:31 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Remove unnecessary macros. Use standard headers.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2017-07-15 Thread Jared D. McNeill
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.



CVS commit: src/usr.bin/mkubootimage

2017-07-15 Thread Jared D. McNeill
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 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__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 
 #include 
@@ -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)
 	"");
 	fprintf(stderr, " -C ");
 	fprintf(stderr, " -O ");
-	fprintf(stderr, " -T ");
+	fprintf(stderr, " -T ");
 	fprintf(stderr, " -a  [-e ] [-m ] -n ");
 	fprintf(stderr, "  \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 

CVS commit: src/usr.bin/mkubootimage

2017-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  5 01:09:17 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Load address is not required for "ramdisk" images.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2017-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  5 01:09:17 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Load address is not required for "ramdisk" images.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.18 src/usr.bin/mkubootimage/mkubootimage.c:1.19
--- src/usr.bin/mkubootimage/mkubootimage.c:1.18	Tue Sep 30 10:21:50 2014
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Jul  5 01:09:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.18 2014/09/30 10:21:50 msaitoh Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.19 2017/07/05 01:09:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.18 2014/09/30 10:21:50 msaitoh Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.19 2017/07/05 01:09:17 jmcneill Exp $");
 
 #include 
 #include 
@@ -429,7 +429,8 @@ main(int argc, char *argv[])
 
 	if (image_arch == IH_ARCH_UNKNOWN ||
 	image_type == IH_TYPE_UNKNOWN ||
-	(image_type != IH_TYPE_SCRIPT && image_loadaddr == 0) ||
+	(image_type != IH_TYPE_SCRIPT && image_type != IH_TYPE_RAMDISK &&
+	 image_loadaddr == 0) ||
 	image_name == NULL)
 		usage();
 



CVS commit: src/usr.bin/mkubootimage

2014-09-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Sep 30 10:21:50 UTC 2014

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

Log Message:
Support arm64, i386 and or1k.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mkubootimage/mkubootimage.1 \
src/usr.bin/mkubootimage/uboot.h
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mkubootimage/mkubootimage.c

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.5 src/usr.bin/mkubootimage/mkubootimage.1:1.6
--- src/usr.bin/mkubootimage/mkubootimage.1:1.5	Sat Dec 29 15:11:56 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue Sep 30 10:21:50 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.5 2012/12/29 15:11:56 jmcneill Exp $
+.\	$NetBSD: mkubootimage.1,v 1.6 2014/09/30 10:21:50 msaitoh Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl h
-.Fl A No ( arm Ns | Ns mips Ns | Ns mips64 Ns | Ns powerpc )
+.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 E Ar address
@@ -55,7 +55,7 @@ utility is used to create an image for D
 .Pp
 The arguments are as follows:
 .Bl -tag -width indent
-.It Fl A No ( arm Ns | Ns mips Ns | Ns mips64 Ns | Ns powerpc )
+.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc )
 Defines the architecture.
 This is required.
 .It Fl a Ar address
Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.5 src/usr.bin/mkubootimage/uboot.h:1.6
--- src/usr.bin/mkubootimage/uboot.h:1.5	Sat Dec 29 15:11:56 2012
+++ src/usr.bin/mkubootimage/uboot.h	Tue Sep 30 10:21:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.5 2012/12/29 15:11:56 jmcneill Exp $ */
+/* $NetBSD: uboot.h,v 1.6 2014/09/30 10:21:50 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -39,9 +39,12 @@ enum uboot_image_os {
 enum uboot_image_arch {
 	IH_ARCH_UNKNOWN = 0,
 	IH_ARCH_ARM = 2,
+	IH_ARCH_I386 = 3,
 	IH_ARCH_MIPS = 5,
 	IH_ARCH_MIPS64 = 6,
-	IH_ARCH_PPC = 7
+	IH_ARCH_PPC = 7,
+	IH_ARCH_OPENRISC = 21,
+	IH_ARCH_ARM64 = 22
 };
 
 enum uboot_image_type {

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.17 src/usr.bin/mkubootimage/mkubootimage.c:1.18
--- src/usr.bin/mkubootimage/mkubootimage.c:1.17	Sat Dec 29 15:11:56 2012
+++ src/usr.bin/mkubootimage/mkubootimage.c	Tue Sep 30 10:21:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.17 2012/12/29 15:11:56 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.18 2014/09/30 10:21:50 msaitoh 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.17 2012/12/29 15:11:56 jmcneill Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.18 2014/09/30 10:21:50 msaitoh Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -106,9 +106,12 @@ static const struct uboot_arch {
 	const char *name;
 } uboot_arch[] = {
 	{ IH_ARCH_ARM,		arm },
+	{ IH_ARCH_I386,		i386 },
 	{ IH_ARCH_MIPS,		mips },
 	{ IH_ARCH_MIPS64,	mips64 },
 	{ IH_ARCH_PPC,		powerpc },
+	{ IH_ARCH_OPENRISC,	or1k },
+	{ IH_ARCH_ARM64,	arm64 },
 };
 
 static enum uboot_image_arch
@@ -214,7 +217,8 @@ get_comp_name(enum uboot_image_comp comp
 __dead static void
 usage(void)
 {
-	fprintf(stderr, usage: mkubootimage -A arm|mips|mips64|powerpc);
+	fprintf(stderr, usage: mkubootimage -A 
+	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);



CVS commit: src/usr.bin/mkubootimage

2014-09-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Sep 30 10:23:16 UTC 2014

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/mkubootimage/mkubootimage.1

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.6 src/usr.bin/mkubootimage/mkubootimage.1:1.7
--- src/usr.bin/mkubootimage/mkubootimage.1:1.6	Tue Sep 30 10:21:50 2014
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue Sep 30 10:23:16 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.6 2014/09/30 10:21:50 msaitoh Exp $
+.\	$NetBSD: mkubootimage.1,v 1.7 2014/09/30 10:23:16 msaitoh 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 December 29, 2012
+.Dd September 30, 2014
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME



CVS commit: src/usr.bin/mkubootimage

2014-09-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Sep 30 10:30:35 UTC 2014

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Use An in AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mkubootimage/mkubootimage.1

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.7 src/usr.bin/mkubootimage/mkubootimage.1:1.8
--- src/usr.bin/mkubootimage/mkubootimage.1:1.7	Tue Sep 30 10:23:16 2014
+++ src/usr.bin/mkubootimage/mkubootimage.1	Tue Sep 30 10:30:35 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.7 2014/09/30 10:23:16 msaitoh Exp $
+.\	$NetBSD: mkubootimage.1,v 1.8 2014/09/30 10:30:35 wiz Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -157,10 +157,13 @@ command first appeared in
 .Nx 6.0 .
 .\
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
-utility was originally written by Jared D. McNeill.
-This manual page was written by Jeremy C. Reed.
+utility was originally written by
+.An Jared D. McNeill .
+This manual page was written by
+.An Jeremy C. Reed .
 .\ .Sh CAVEATS
 .\ .Sh BUGS
 .\ .Sh SECURITY CONSIDERATIONS



CVS commit: src/usr.bin/mkubootimage

2014-09-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Sep 30 10:21:50 UTC 2014

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

Log Message:
Support arm64, i386 and or1k.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mkubootimage/mkubootimage.1 \
src/usr.bin/mkubootimage/uboot.h
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2014-09-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Sep 30 10:30:35 UTC 2014

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Use An in AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2012-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 29 15:11:56 UTC 2012

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

Log Message:
add support for generating boot.scr scripts with -T script


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/crc32.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/mkubootimage.1 \
src/usr.bin/mkubootimage/uboot.h
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mkubootimage/mkubootimage.c

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/crc32.c
diff -u src/usr.bin/mkubootimage/crc32.c:1.2 src/usr.bin/mkubootimage/crc32.c:1.3
--- src/usr.bin/mkubootimage/crc32.c:1.2	Tue Jun 22 14:54:11 2010
+++ src/usr.bin/mkubootimage/crc32.c	Sat Dec 29 15:11:56 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crc32.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $ */
+/* $NetBSD: crc32.c,v 1.3 2012/12/29 15:11:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -33,9 +33,10 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: crc32.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $);
+__RCSID($NetBSD: crc32.c,v 1.3 2012/12/29 15:11:56 jmcneill Exp $);
 
 #include sys/types.h
+#include sys/uio.h
 #include stdint.h
 
 uint32_t	crc32(const void *, size_t);
@@ -87,16 +88,31 @@ static uint32_t crc32_tab[] = {
 };
 
 uint32_t
-crc32(const void *buf, size_t size)
+crc32v(const struct iovec *iov, int cnt)
 {
 	const uint8_t *p;
 	uint32_t crc;
+	int i, len;
 
-	p = buf;
 	crc = ~0U;
 
-	while (size--)
-		crc = crc32_tab[(crc ^ *p++)  0xFF] ^ (crc  8);
+	for (i = 0; i  cnt; i++) {
+		p = iov[i].iov_base;
+		len = iov[i].iov_len;
+		while (len--)
+			crc = crc32_tab[(crc ^ *p++)  0xFF] ^ (crc  8);
+	}
 
 	return crc ^ ~0U;
 }
+
+uint32_t
+crc32(const void *buf, size_t size)
+{
+	struct iovec iov[1];
+
+	iov[0].iov_base = __UNCONST(buf);
+	iov[0].iov_len = size;
+
+	return crc32v(iov, 1);
+}

Index: src/usr.bin/mkubootimage/mkubootimage.1
diff -u src/usr.bin/mkubootimage/mkubootimage.1:1.4 src/usr.bin/mkubootimage/mkubootimage.1:1.5
--- src/usr.bin/mkubootimage/mkubootimage.1:1.4	Sat Dec  1 08:16:25 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Dec 29 15:11:56 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.4 2012/12/01 08:16:25 wiz Exp $
+.\	$NetBSD: mkubootimage.1,v 1.5 2012/12/29 15:11:56 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 November 28, 2012
+.Dd December 29, 2012
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -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 )
+.It Fl T No ( fs Ns | Ns kernel Ns | Ns ramdisk Ns | Ns standalone Ns | Ns script )
 Defines the image type.
 This is required.
 .El
Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.4 src/usr.bin/mkubootimage/uboot.h:1.5
--- src/usr.bin/mkubootimage/uboot.h:1.4	Wed Aug  3 17:46:40 2011
+++ src/usr.bin/mkubootimage/uboot.h	Sat Dec 29 15:11:56 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.4 2011/08/03 17:46:40 matt Exp $ */
+/* $NetBSD: uboot.h,v 1.5 2012/12/29 15:11:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -49,6 +49,7 @@ enum uboot_image_type {
 	IH_TYPE_STANDALONE = 1,
 	IH_TYPE_KERNEL = 2,
 	IH_TYPE_RAMDISK = 3,
+	IH_TYPE_SCRIPT = 6,
 	IH_TYPE_FILESYSTEM = 7,
 };
 

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.16 src/usr.bin/mkubootimage/mkubootimage.c:1.17
--- src/usr.bin/mkubootimage/mkubootimage.c:1.16	Fri Feb 17 08:28:36 2012
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Dec 29 15:11:56 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.17 2012/12/29 15:11:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -30,11 +30,12 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.17 2012/12/29 15:11:56 jmcneill Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
 #include sys/endian.h
+#include sys/uio.h
 #include err.h
 #include errno.h
 #include fcntl.h
@@ -53,6 +54,7 @@ __RCSID($NetBSD: mkubootimage.c,v 1.16 
 #endif
 
 extern uint32_t crc32(const void *, size_t);
+extern uint32_t crc32v(const struct iovec *, int);
 
 static enum uboot_image_os image_os = IH_OS_NETBSD;
 static enum uboot_image_arch image_arch = IH_ARCH_UNKNOWN;
@@ -143,6 +145,7 @@ static const struct uboot_type {
 	{ IH_TYPE_KERNEL,	kernel },
 	{ IH_TYPE_RAMDISK,	ramdisk },
 	{ IH_TYPE_FILESYSTEM,	fs },
+	{ 

CVS commit: src/usr.bin/mkubootimage

2012-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 29 16:18:08 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: crc32.c

Log Message:
add missing prototype for crc32v


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/crc32.c

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/crc32.c
diff -u src/usr.bin/mkubootimage/crc32.c:1.3 src/usr.bin/mkubootimage/crc32.c:1.4
--- src/usr.bin/mkubootimage/crc32.c:1.3	Sat Dec 29 15:11:56 2012
+++ src/usr.bin/mkubootimage/crc32.c	Sat Dec 29 16:18:08 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crc32.c,v 1.3 2012/12/29 15:11:56 jmcneill Exp $ */
+/* $NetBSD: crc32.c,v 1.4 2012/12/29 16:18:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -33,13 +33,14 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: crc32.c,v 1.3 2012/12/29 15:11:56 jmcneill Exp $);
+__RCSID($NetBSD: crc32.c,v 1.4 2012/12/29 16:18:08 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/uio.h
 #include stdint.h
 
 uint32_t	crc32(const void *, size_t);
+uint32_t	crc32v(const struct iovec *, int);
 
 static uint32_t crc32_tab[] = {
 	0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,



CVS commit: src/usr.bin/mkubootimage

2012-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 29 15:11:56 UTC 2012

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

Log Message:
add support for generating boot.scr scripts with -T script


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/crc32.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/mkubootimage.1 \
src/usr.bin/mkubootimage/uboot.h
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2012-12-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 29 16:18:08 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: crc32.c

Log Message:
add missing prototype for crc32v


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/crc32.c

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



CVS commit: src/usr.bin/mkubootimage

2012-12-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  1 08:16:26 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
More markup.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/mkubootimage.1

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.3 src/usr.bin/mkubootimage/mkubootimage.1:1.4
--- src/usr.bin/mkubootimage/mkubootimage.1:1.3	Sat Dec  1 05:26:16 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Dec  1 08:16:25 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.3 2012/12/01 05:26:16 matt Exp $
+.\	$NetBSD: mkubootimage.1,v 1.4 2012/12/01 08:16:25 wiz Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -60,7 +60,8 @@ Defines the architecture.
 This is required.
 .It Fl a Ar address
 Sets the image load address.
-This is an integer between 0 and UINT32_MAX.
+This is an integer between 0 and
+.Dv UINT32_MAX .
 This is required.
 .It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none )
 Defines the compression.
@@ -68,7 +69,8 @@ The default is
 .Qq none .
 .It Fl E Ar address
 Define the entry point.
-This is an integer between 0 and UINT32_MAX.
+This is an integer between 0 and
+.Dv UINT32_MAX .
 This option is the same as
 .Fl e
 but it inverts the bytes to convert the 32 bit integer
@@ -82,7 +84,8 @@ image load address
 .Pq Fl a .
 .It Fl e Ar address
 Define the entry point.
-This is an integer between 0 and UINT32_MAX.
+This is an integer between 0 and
+.Dv UINT32_MAX .
 If
 .Fl E
 or
@@ -94,7 +97,8 @@ image load address
 Display the usage and exit.
 .It Fl m Ar magic
 Set the magic.
-This is an integer between 0 and UINT32_MAX.
+This is an integer between 0 and
+.Dv UINT32_MAX .
 The default is
 .Qq 0x27051956 .
 .It Fl n Ar image



CVS commit: src/usr.bin/mkubootimage

2012-12-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  1 08:16:26 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
More markup.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2012-11-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Nov 30 08:25:35 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Sort SYNOPSIS. Remove unnecessary Ns. Punctuation nit.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/mkubootimage.1

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.1 src/usr.bin/mkubootimage/mkubootimage.1:1.2
--- src/usr.bin/mkubootimage/mkubootimage.1:1.1	Thu Nov 29 23:23:22 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Fri Nov 30 08:25:35 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.1 2012/11/29 23:23:22 reed Exp $
+.\	$NetBSD: mkubootimage.1,v 1.2 2012/11/30 08:25:35 wiz Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -35,12 +35,12 @@
 .Nd create U-Boot loader image
 .Sh SYNOPSIS
 .Nm
+.Op Fl h
 .Fl A No ( arm Ns | Ns mips Ns | Ns mips64 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 E Ar address
 .Op Fl e Ar address
-.Op Fl h
 .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
@@ -62,7 +62,7 @@ This is required.
 Sets the image load address.
 This is an integer between 0 and ULONG_MAX.
 This is required.
-.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Ns )
+.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none )
 Defines the compression.
 The default is
 .Qq none .
@@ -96,7 +96,7 @@ Display the usage and exit.
 Set the magic.
 This is an integer between 0 and ULONG_MAX.
 The default is
-.Qq 0x27051956.
+.Qq 0x27051956 .
 .It Fl n Ar image
 Defines the image name.
 This is required.



CVS commit: src/usr.bin/mkubootimage

2012-11-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec  1 05:26:16 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Change ULONG_MAX to UINT32_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/mkubootimage.1

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.2 src/usr.bin/mkubootimage/mkubootimage.1:1.3
--- src/usr.bin/mkubootimage/mkubootimage.1:1.2	Fri Nov 30 08:25:35 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Sat Dec  1 05:26:16 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkubootimage.1,v 1.2 2012/11/30 08:25:35 wiz Exp $
+.\	$NetBSD: mkubootimage.1,v 1.3 2012/12/01 05:26:16 matt Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -60,7 +60,7 @@ Defines the architecture.
 This is required.
 .It Fl a Ar address
 Sets the image load address.
-This is an integer between 0 and ULONG_MAX.
+This is an integer between 0 and UINT32_MAX.
 This is required.
 .It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none )
 Defines the compression.
@@ -68,7 +68,7 @@ The default is
 .Qq none .
 .It Fl E Ar address
 Define the entry point.
-This is an integer between 0 and ULONG_MAX.
+This is an integer between 0 and UINT32_MAX.
 This option is the same as
 .Fl e
 but it inverts the bytes to convert the 32 bit integer
@@ -82,7 +82,7 @@ image load address
 .Pq Fl a .
 .It Fl e Ar address
 Define the entry point.
-This is an integer between 0 and ULONG_MAX.
+This is an integer between 0 and UINT32_MAX.
 If
 .Fl E
 or
@@ -94,7 +94,7 @@ image load address
 Display the usage and exit.
 .It Fl m Ar magic
 Set the magic.
-This is an integer between 0 and ULONG_MAX.
+This is an integer between 0 and UINT32_MAX.
 The default is
 .Qq 0x27051956 .
 .It Fl n Ar image



CVS commit: src/usr.bin/mkubootimage

2012-11-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Nov 30 08:25:35 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Sort SYNOPSIS. Remove unnecessary Ns. Punctuation nit.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2012-11-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec  1 05:26:16 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Change ULONG_MAX to UINT32_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/mkubootimage.1

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



Re: CVS commit: src/usr.bin/mkubootimage

2012-11-29 Thread Marc Balmer
Comments inline...


 Module Name:  src
 Committed By: reed
 Date: Thu Nov 29 23:23:23 UTC 2012
 
 Added Files:
   src/usr.bin/mkubootimage: mkubootimage.1
 
 Log Message:
 Add a manual for mkubootimage(1). It was missing.
 It had one review on netbsd-docs@.
 I didn't add the manual to the Makefile nor distrib set yet --
 waiting for more review or improvements first.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/mkubootimage.1
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 
 Added files:
 
 Index: src/usr.bin/mkubootimage/mkubootimage.1
 diff -u /dev/null src/usr.bin/mkubootimage/mkubootimage.1:1.1
 --- /dev/null Thu Nov 29 23:23:23 2012
 +++ src/usr.bin/mkubootimage/mkubootimage.1   Thu Nov 29 23:23:22 2012
 @@ -0,0 +1,162 @@
 +.\  $NetBSD: mkubootimage.1,v 1.1 2012/11/29 23:23:22 reed Exp $
 +.\
 +.\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 +.\ All rights reserved.
 +.\
 +.\ This code is derived from software contributed to The NetBSD Foundation
 +.\ by Jeremy C. Reed
 +.\
 +.\ 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
 +.\
 +.Dd November 28, 2012
 +.Dt MKUBOOTIMAGE 1
 +.Os
 +.Sh NAME
 +.Nm mkubootimage
 +.Nd create U-Boot loader image
 +.Sh SYNOPSIS
 +.Nm
 +.Fl A No ( arm Ns | Ns mips Ns | Ns mips64 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 E Ar address
 +.Op Fl e Ar address
 +.Op Fl h
 +.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 )
 +.Ar source destination
 +.\
 +.Sh DESCRIPTION
 +The
 +.Nm
 +utility is used to create an image for Das U-Boot, the
 +.Qq Universal Boot Loader .
 +.Pp
 +The arguments are as follows:
 +.Bl -tag -width indent
 +.It Fl A No ( arm Ns | Ns mips Ns | Ns mips64 Ns | Ns powerpc )
 +Defines the architecture.
 +This is required.
 +.It Fl a Ar address
 +Sets the image load address.
 +This is an integer between 0 and ULONG_MAX.

Maybe note where ULONG_MAX is defined or specify the value here

and ULONG_MAX as defined in //X.h

 +This is required.
 +.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Ns )
 +Defines the compression.
 +The default is
 +.Qq none .
 +.It Fl E Ar address
 +Define the entry point.
 +This is an integer between 0 and ULONG_MAX.
 +This option is the same as
 +.Fl e
 +but it inverts the bytes to convert the 32 bit integer
 +from little to big endian (or vice versa).
 +If
 +.Fl E
 +or
 +.Fl e
 +are not set, the entry point defaults to the
 +image load address
 +.Pq Fl a .
 +.It Fl e Ar address
 +Define the entry point.
 +This is an integer between 0 and ULONG_MAX.
 +If
 +.Fl E
 +or
 +.Fl e
 +are not set, the entry point defaults to the
 +image load address
 +.Pq Fl a .
 +.It Fl h
 +Display the usage and exit.
 +.It Fl m Ar magic
 +Set the magic.
 +This is an integer between 0 and ULONG_MAX.
 +The default is
 +.Qq 0x27051956.
 +.It Fl n Ar image
 +Defines the image name.
 +This is required.
 +.It Fl O No ( freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd )
 +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 )
 +Defines the image type.
 +This is required.
 +.El
 +.Pp
 +The required
 +.Ar source
 +argument is the filename of the kernel that is read.
 +The required
 +.Ar destination
 +argument is the filename of the image file that is created.
 +.\
 +.Sh RETURN VALUES
 +.Nm
 +returns 1 on failure to read the kernel,
 +generate a header, or 

CVS commit: src/usr.bin/mkubootimage

2012-11-29 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Thu Nov 29 23:23:23 UTC 2012

Added Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Add a manual for mkubootimage(1). It was missing.
It had one review on netbsd-docs@.
I didn't add the manual to the Makefile nor distrib set yet --
waiting for more review or improvements first.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/mkubootimage.1

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

Added files:

Index: src/usr.bin/mkubootimage/mkubootimage.1
diff -u /dev/null src/usr.bin/mkubootimage/mkubootimage.1:1.1
--- /dev/null	Thu Nov 29 23:23:23 2012
+++ src/usr.bin/mkubootimage/mkubootimage.1	Thu Nov 29 23:23:22 2012
@@ -0,0 +1,162 @@
+.\	$NetBSD: mkubootimage.1,v 1.1 2012/11/29 23:23:22 reed Exp $
+.\
+.\ Copyright (c) 2012 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Jeremy C. Reed
+.\
+.\ 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\
+.Dd November 28, 2012
+.Dt MKUBOOTIMAGE 1
+.Os
+.Sh NAME
+.Nm mkubootimage
+.Nd create U-Boot loader image
+.Sh SYNOPSIS
+.Nm
+.Fl A No ( arm Ns | Ns mips Ns | Ns mips64 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 E Ar address
+.Op Fl e Ar address
+.Op Fl h
+.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 )
+.Ar source destination
+.\
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to create an image for Das U-Boot, the
+.Qq Universal Boot Loader .
+.Pp
+The arguments are as follows:
+.Bl -tag -width indent
+.It Fl A No ( arm Ns | Ns mips Ns | Ns mips64 Ns | Ns powerpc )
+Defines the architecture.
+This is required.
+.It Fl a Ar address
+Sets the image load address.
+This is an integer between 0 and ULONG_MAX.
+This is required.
+.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Ns )
+Defines the compression.
+The default is
+.Qq none .
+.It Fl E Ar address
+Define the entry point.
+This is an integer between 0 and ULONG_MAX.
+This option is the same as
+.Fl e
+but it inverts the bytes to convert the 32 bit integer
+from little to big endian (or vice versa).
+If
+.Fl E
+or
+.Fl e
+are not set, the entry point defaults to the
+image load address
+.Pq Fl a .
+.It Fl e Ar address
+Define the entry point.
+This is an integer between 0 and ULONG_MAX.
+If
+.Fl E
+or
+.Fl e
+are not set, the entry point defaults to the
+image load address
+.Pq Fl a .
+.It Fl h
+Display the usage and exit.
+.It Fl m Ar magic
+Set the magic.
+This is an integer between 0 and ULONG_MAX.
+The default is
+.Qq 0x27051956.
+.It Fl n Ar image
+Defines the image name.
+This is required.
+.It Fl O No ( freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd )
+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 )
+Defines the image type.
+This is required.
+.El
+.Pp
+The required
+.Ar source
+argument is the filename of the kernel that is read.
+The required
+.Ar destination
+argument is the filename of the image file that is created.
+.\
+.Sh RETURN VALUES
+.Nm
+returns 1 on failure to read the kernel,
+generate a header, or create the image.
+.\
+.Sh EXAMPLES
+Before the image is written, the header is displayed to standard out;
+for example:
+.Bd -literal -offset 0
+ magic:   0x27051956
+ time:Tue Jun  7 15:58:41 2011
+ size:2482203
+ load addr:   0x0002
+ entry point: 

CVS commit: src/usr.bin/mkubootimage

2012-11-29 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Thu Nov 29 23:23:23 UTC 2012

Added Files:
src/usr.bin/mkubootimage: mkubootimage.1

Log Message:
Add a manual for mkubootimage(1). It was missing.
It had one review on netbsd-docs@.
I didn't add the manual to the Makefile nor distrib set yet --
waiting for more review or improvements first.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/mkubootimage.1

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



CVS commit: src/usr.bin/mkubootimage

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 08:11:29 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Let address/entry be 64bit if they are just sign-extended 32-bit values.
(change pulled up from matt-nb5-mips64).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.14 src/usr.bin/mkubootimage/mkubootimage.c:1.15
--- src/usr.bin/mkubootimage/mkubootimage.c:1.14	Sun Sep  4 20:35:07 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Feb 17 08:11:28 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.14 2011/09/04 20:35:07 joerg Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.15 2012/02/17 08:11:28 matt 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.14 2011/09/04 20:35:07 joerg Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.15 2012/02/17 08:11:28 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -322,7 +322,7 @@ main(int argc, char *argv[])
 	char *ep;
 	int kernel_fd, image_fd;
 	int ch;
-	unsigned long num;
+	unsigned long long num;
 
 	while ((ch = getopt(argc, argv, A:C:E:O:T:a:e:hm:n:)) != -1) {
 		switch (ch) {
@@ -340,18 +340,20 @@ main(int argc, char *argv[])
 			break;
 		case 'a':	/* addr */
 			errno = 0;
-			num = strtoul(optarg, ep, 0);
+			num = strtoull(optarg, ep, 0);
 			if (*ep != '\0' || (errno == ERANGE 
-			(num == ULONG_MAX || num == 0)))
+			(num == ULLONG_MAX || num == 0)) ||
+			(num != (int32_t)num  num != (uint32_t)num))
 errx(1, illegal number -- %s, optarg);
 			image_loadaddr = (uint32_t)num;
 			break;
 		case 'E':	/* ep (byte swapped) */
 		case 'e':	/* ep */
 			errno = 0;
-			num = strtoul(optarg, ep, 0);
+			num = strtoull(optarg, ep, 0);
 			if (*ep != '\0' || (errno == ERANGE 
-			(num == ULONG_MAX || num == 0)))
+			(num == ULLONG_MAX || num == 0)) ||
+			(num != (int32_t)num  num != (uint32_t)num))
 errx(1, illegal number -- %s, optarg);
 			image_entrypoint = (uint32_t)num;
 			if (ch == 'E')



CVS commit: src/usr.bin/mkubootimage

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 08:28:36 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Avoid signed/unsigned comparision.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.15 src/usr.bin/mkubootimage/mkubootimage.c:1.16
--- src/usr.bin/mkubootimage/mkubootimage.c:1.15	Fri Feb 17 08:11:28 2012
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Feb 17 08:28:36 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.15 2012/02/17 08:11:28 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt 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.15 2012/02/17 08:11:28 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.16 2012/02/17 08:28:36 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -343,7 +343,8 @@ main(int argc, char *argv[])
 			num = strtoull(optarg, ep, 0);
 			if (*ep != '\0' || (errno == ERANGE 
 			(num == ULLONG_MAX || num == 0)) ||
-			(num != (int32_t)num  num != (uint32_t)num))
+			((signed long long)num != (int32_t)num 
+			 num != (uint32_t)num))
 errx(1, illegal number -- %s, optarg);
 			image_loadaddr = (uint32_t)num;
 			break;
@@ -353,7 +354,8 @@ main(int argc, char *argv[])
 			num = strtoull(optarg, ep, 0);
 			if (*ep != '\0' || (errno == ERANGE 
 			(num == ULLONG_MAX || num == 0)) ||
-			(num != (int32_t)num  num != (uint32_t)num))
+			((signed long long)num != (int32_t)num 
+			 num != (uint32_t)num))
 errx(1, illegal number -- %s, optarg);
 			image_entrypoint = (uint32_t)num;
 			if (ch == 'E')



CVS commit: src/usr.bin/mkubootimage

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 08:11:29 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Let address/entry be 64bit if they are just sign-extended 32-bit values.
(change pulled up from matt-nb5-mips64).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2012-02-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 17 08:28:36 UTC 2012

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Avoid signed/unsigned comparision.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-09-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Sep  4 20:31:00 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.12 src/usr.bin/mkubootimage/mkubootimage.c:1.13
--- src/usr.bin/mkubootimage/mkubootimage.c:1.12	Sat Aug  6 11:12:05 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sun Sep  4 20:31:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.12 2011/08/06 11:12:05 wiz Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.13 2011/09/04 20:31:00 joerg 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.12 2011/08/06 11:12:05 wiz Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.13 2011/09/04 20:31:00 joerg Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -99,7 +99,7 @@
 	return Unknown;
 }
 
-struct uboot_arch {
+static const struct uboot_arch {
 	enum uboot_image_arch arch;
 	const char *name;
 } uboot_arch[] = {
@@ -135,7 +135,7 @@
 	return Unknown;
 }
 
-struct uboot_type {
+static struct uboot_type {
 	enum uboot_image_type type;
 	const char *name;
 } uboot_type[] = {
@@ -171,7 +171,7 @@
 	return Unknown;
 }
 
-struct uboot_comp {
+static struct uboot_comp {
 	enum uboot_image_comp comp;
 	const char *name;
 } uboot_comp[] = {
@@ -208,7 +208,7 @@
 	return Unknown;
 }
 
-static void
+__dead static void
 usage(void)
 {
 	fprintf(stderr, usage: mkubootimage -A arm|mips|mips64|powerpc);



CVS commit: src/usr.bin/mkubootimage

2011-09-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Sep  4 20:35:07 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Sprinkle one more static and a bunch of consts.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.13 src/usr.bin/mkubootimage/mkubootimage.c:1.14
--- src/usr.bin/mkubootimage/mkubootimage.c:1.13	Sun Sep  4 20:31:00 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sun Sep  4 20:35:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.13 2011/09/04 20:31:00 joerg Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.14 2011/09/04 20:35:07 joerg 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.13 2011/09/04 20:31:00 joerg Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.14 2011/09/04 20:35:07 joerg Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -63,7 +63,7 @@
 static char *image_name;
 static uint32_t image_magic = IH_MAGIC;
 
-struct uboot_os {
+static const struct uboot_os {
 	enum uboot_image_os os;
 	const char *name;
 } uboot_os[] = {
@@ -135,7 +135,7 @@
 	return Unknown;
 }
 
-static struct uboot_type {
+static const struct uboot_type {
 	enum uboot_image_type type;
 	const char *name;
 } uboot_type[] = {
@@ -171,7 +171,7 @@
 	return Unknown;
 }
 
-static struct uboot_comp {
+static const struct uboot_comp {
 	enum uboot_image_comp comp;
 	const char *name;
 } uboot_comp[] = {



CVS commit: src/usr.bin/mkubootimage

2011-09-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Sep  4 20:31:00 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-09-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Sep  4 20:35:07 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Sprinkle one more static and a bunch of consts.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-08-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug  6 11:12:05 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add lzma and lzo to usage. From Elie De Brauwer in PR 45219.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.11 src/usr.bin/mkubootimage/mkubootimage.c:1.12
--- src/usr.bin/mkubootimage/mkubootimage.c:1.11	Thu Aug  4 04:47:59 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Aug  6 11:12:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.11 2011/08/04 04:47:59 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.12 2011/08/06 11:12:05 wiz 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.11 2011/08/04 04:47:59 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.12 2011/08/06 11:12:05 wiz Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -212,7 +212,7 @@
 usage(void)
 {
 	fprintf(stderr, usage: mkubootimage -A arm|mips|mips64|powerpc);
-	fprintf(stderr,  -C none|gz|bz2);
+	fprintf(stderr,  -C none|bz2|gz|lzma|lzo);
 	fprintf(stderr,  -O openbsd|netbsd|freebsd|linux);
 	fprintf(stderr,  -T standalone|kernel|ramdisk|fs);
 	fprintf(stderr,  -a addr [-e ep] [-m magic] -n name);



CVS commit: src/usr.bin/mkubootimage

2011-08-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug  6 11:12:05 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add lzma and lzo to usage. From Elie De Brauwer in PR 45219.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  3 17:00:13 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add -E entrypoint for byteswapped entry-points.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.8 src/usr.bin/mkubootimage/mkubootimage.c:1.9
--- src/usr.bin/mkubootimage/mkubootimage.c:1.8	Mon Aug  1 06:16:35 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Aug  3 17:00:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.8 2011/08/01 06:16:35 riz Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.9 2011/08/03 17:00:13 matt Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -30,10 +30,11 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mkubootimage.c,v 1.8 2011/08/01 06:16:35 riz Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.9 2011/08/03 17:00:13 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
+#include sys/endian.h
 #include err.h
 #include errno.h
 #include fcntl.h
@@ -321,7 +322,7 @@
 	int ch;
 	unsigned long num;
 
-	while ((ch = getopt(argc, argv, A:C:O:T:a:e:hm:n:)) != -1) {
+	while ((ch = getopt(argc, argv, A:C:E:O:T:a:e:hm:n:)) != -1) {
 		switch (ch) {
 		case 'A':	/* arch */
 			image_arch = get_arch(optarg);
@@ -343,6 +344,7 @@
 errx(1, illegal number -- %s, optarg);
 			image_loadaddr = (uint32_t)num;
 			break;
+		case 'E':	/* ep (byte swapped) */
 		case 'e':	/* ep */
 			errno = 0;
 			num = strtoul(optarg, ep, 0);
@@ -350,6 +352,8 @@
 			(num == ULONG_MAX || num == 0)))
 errx(1, illegal number -- %s, optarg);
 			image_entrypoint = (uint32_t)num;
+			if (ch == 'E')
+image_entrypoint = bswap32(image_entrypoint);
 			break;
 		case 'm':	/* magic */
 			errno = 0;



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  3 17:46:40 UTC 2011

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

Log Message:
Add lzma and lzo compression types


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.3 -r1.4 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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.9 src/usr.bin/mkubootimage/mkubootimage.c:1.10
--- src/usr.bin/mkubootimage/mkubootimage.c:1.9	Wed Aug  3 17:00:13 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Aug  3 17:46:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.9 2011/08/03 17:00:13 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.10 2011/08/03 17:46:40 matt 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.9 2011/08/03 17:00:13 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.10 2011/08/03 17:46:40 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -178,6 +178,8 @@
 	{ IH_COMP_NONE,		none },
 	{ IH_COMP_GZIP,		gz },
 	{ IH_COMP_BZIP2,	bz2 },
+	{ IH_COMP_LZMA,		lzma },
+	{ IH_COMP_LZO,		lzo },
 };
 
 static enum uboot_image_comp

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.3 src/usr.bin/mkubootimage/uboot.h:1.4
--- src/usr.bin/mkubootimage/uboot.h:1.3	Sat Feb 26 20:03:09 2011
+++ src/usr.bin/mkubootimage/uboot.h	Wed Aug  3 17:46:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.3 2011/02/26 20:03:09 phx Exp $ */
+/* $NetBSD: uboot.h,v 1.4 2011/08/03 17:46:40 matt Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -56,6 +56,8 @@
 	IH_COMP_NONE = 0,
 	IH_COMP_GZIP = 1,
 	IH_COMP_BZIP2 = 2,
+	IH_COMP_LZMA = 3,
+	IH_COMP_LZO = 4,
 };
 
 #define IH_MAGIC	0x27051956



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  4 04:47:59 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add O_TRUNC to the open of the image file (in case the size decreases).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.10 src/usr.bin/mkubootimage/mkubootimage.c:1.11
--- src/usr.bin/mkubootimage/mkubootimage.c:1.10	Wed Aug  3 17:46:40 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Thu Aug  4 04:47:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.10 2011/08/03 17:46:40 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.11 2011/08/04 04:47:59 matt 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.10 2011/08/03 17:46:40 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.11 2011/08/04 04:47:59 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -396,7 +396,7 @@
 		perror(open kernel);
 		return EXIT_FAILURE;
 	}
-	image_fd = open(dest, O_WRONLY|O_CREAT, 0666);
+	image_fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0666);
 	if (image_fd == -1) {
 		perror(open image);
 		return EXIT_FAILURE;



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  3 17:00:13 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add -E entrypoint for byteswapped entry-points.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  3 17:46:40 UTC 2011

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

Log Message:
Add lzma and lzo compression types


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.3 -r1.4 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.



CVS commit: src/usr.bin/mkubootimage

2011-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  4 04:47:59 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add O_TRUNC to the open of the image file (in case the size decreases).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-08-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug  1 06:16:36 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add an -m flag to mkubootimage, for specifying an alternate magic
value.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.7 src/usr.bin/mkubootimage/mkubootimage.c:1.8
--- src/usr.bin/mkubootimage/mkubootimage.c:1.7	Wed Jun  8 05:54:38 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Mon Aug  1 06:16:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.7 2011/06/08 05:54:38 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.8 2011/08/01 06:16:35 riz 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.7 2011/06/08 05:54:38 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.8 2011/08/01 06:16:35 riz Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -60,6 +60,7 @@
 static uint32_t image_loadaddr = 0;
 static uint32_t image_entrypoint = 0;
 static char *image_name;
+static uint32_t image_magic = IH_MAGIC;
 
 struct uboot_os {
 	enum uboot_image_os os;
@@ -211,7 +212,7 @@
 	fprintf(stderr,  -C none|gz|bz2);
 	fprintf(stderr,  -O openbsd|netbsd|freebsd|linux);
 	fprintf(stderr,  -T standalone|kernel|ramdisk|fs);
-	fprintf(stderr,  -a addr [-e ep] -n name);
+	fprintf(stderr,  -a addr [-e ep] [-m magic] -n name);
 	fprintf(stderr,  srcfile dstfile\n);
 
 	exit(EXIT_FAILURE);
@@ -268,7 +269,7 @@
 	munmap(p, st.st_size);
 
 	memset(hdr, 0, sizeof(*hdr));
-	hdr-ih_magic = htonl(IH_MAGIC);
+	hdr-ih_magic = htonl(image_magic);
 	hdr-ih_time = htonl(st.st_mtime);
 	hdr-ih_size = htonl(st.st_size);
 	hdr-ih_load = htonl(image_loadaddr);
@@ -320,7 +321,7 @@
 	int ch;
 	unsigned long num;
 
-	while ((ch = getopt(argc, argv, A:C:O:T:a:e:hn:)) != -1) {
+	while ((ch = getopt(argc, argv, A:C:O:T:a:e:hm:n:)) != -1) {
 		switch (ch) {
 		case 'A':	/* arch */
 			image_arch = get_arch(optarg);
@@ -350,6 +351,13 @@
 errx(1, illegal number -- %s, optarg);
 			image_entrypoint = (uint32_t)num;
 			break;
+		case 'm':	/* magic */
+			errno = 0;
+			num = strtoul(optarg, ep, 0);
+			if (*ep != '\0' || (errno == ERANGE 
+			(num == ULONG_MAX || num == 0)))
+errx(1, illegal number -- %s, optarg);
+			image_magic = (uint32_t)num;
 		case 'n':	/* name */
 			image_name = strdup(optarg);
 			break;



CVS commit: src/usr.bin/mkubootimage

2011-08-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug  1 06:16:36 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Add an -m flag to mkubootimage, for specifying an alternate magic
value.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2011-06-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun  8 05:54:38 UTC 2011

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
When printing the header, convert values to names:
Use strlcpy to copy the name, not strncpy.

 magic:   0x27051956
 time:Tue Jun  7 15:58:41 2011
 size:2482203
 load addr:   0x0002
 entry point: 0x0002
 data crc:0x700fdf53
 os:  2 (netbsd)
 arch:7 (powerpc)
 type:2 (kernel)
 comp:1 (gz)
 name:NetBSD/evbppc 5.99.52 (INSTALL_
 header crc:  0x94ea96cf


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.6 src/usr.bin/mkubootimage/mkubootimage.c:1.7
--- src/usr.bin/mkubootimage/mkubootimage.c:1.6	Sat Feb 26 20:03:09 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Wed Jun  8 05:54:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.6 2011/02/26 20:03:09 phx Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.7 2011/06/08 05:54:38 matt 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.6 2011/02/26 20:03:09 phx Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.7 2011/06/08 05:54:38 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -84,6 +84,19 @@
 	return IH_OS_UNKNOWN;
 }
 
+static const char *
+get_os_name(enum uboot_image_os os)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(uboot_os); i++) {
+		if (uboot_os[i].os == os)
+			return uboot_os[i].name;
+	}
+
+	return Unknown;
+}
+
 struct uboot_arch {
 	enum uboot_image_arch arch;
 	const char *name;
@@ -107,6 +120,19 @@
 	return IH_ARCH_UNKNOWN;
 }
 
+static const char * 
+get_arch_name(enum uboot_image_arch arch)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(uboot_arch); i++) {
+		if (uboot_arch[i].arch == arch)
+			return uboot_arch[i].name;
+	}
+
+	return Unknown;
+}
+
 struct uboot_type {
 	enum uboot_image_type type;
 	const char *name;
@@ -130,6 +156,19 @@
 	return IH_TYPE_UNKNOWN;
 }
 
+static const char *
+get_type_name(enum uboot_image_type type)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(uboot_type); i++) {
+		if (uboot_type[i].type == type)
+			return uboot_type[i].name;
+	}
+
+	return Unknown;
+}
+
 struct uboot_comp {
 	enum uboot_image_comp comp;
 	const char *name;
@@ -152,6 +191,19 @@
 	return IH_TYPE_UNKNOWN;
 }
 
+static const char *
+get_comp_name(enum uboot_image_comp comp)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(uboot_comp); i++) {
+		if (uboot_comp[i].comp == comp)
+			return uboot_comp[i].name;
+	}
+
+	return Unknown;
+}
+
 static void
 usage(void)
 {
@@ -176,10 +228,14 @@
 	printf( load addr:   0x%08x\n, ntohl(hdr-ih_load));
 	printf( entry point: 0x%08x\n, ntohl(hdr-ih_ep));
 	printf( data crc:0x%08x\n, ntohl(hdr-ih_dcrc));
-	printf( os:  %d\n, hdr-ih_os);
-	printf( arch:%d\n, hdr-ih_arch);
-	printf( type:%d\n, hdr-ih_type);
-	printf( comp:%d\n, hdr-ih_comp);
+	printf( os:  %d (%s)\n, hdr-ih_os,
+	get_os_name(hdr-ih_os));
+	printf( arch:%d (%s)\n, hdr-ih_arch,
+	get_arch_name(hdr-ih_arch));
+	printf( type:%d (%s)\n, hdr-ih_type,
+	get_type_name(hdr-ih_type));
+	printf( comp:%d (%s)\n, hdr-ih_comp,
+	get_comp_name(hdr-ih_comp));
 	printf( name:%s\n, hdr-ih_name);
 	printf( header crc:  0x%08x\n, hdr-ih_hcrc);
 }
@@ -222,7 +278,7 @@
 	hdr-ih_arch = image_arch;
 	hdr-ih_type = image_type;
 	hdr-ih_comp = image_comp;
-	strncpy((char *)hdr-ih_name, image_name, sizeof(hdr-ih_name));
+	strlcpy((char *)hdr-ih_name, image_name, sizeof(hdr-ih_name));
 	crc = crc32((void *)hdr, sizeof(*hdr));
 	hdr-ih_hcrc = htonl(crc);
 



CVS commit: src/usr.bin/mkubootimage

2011-02-26 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Feb 26 20:03:09 UTC 2011

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

Log Message:
Add the -O option to set the OS type, which defaults to NetBSD when missing.
This is needed, because some vendors have stripped U-Boot so much that it
only accepts Linux kernel modules.
Also allow 'standalone' as module type.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.2 -r1.3 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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.5 src/usr.bin/mkubootimage/mkubootimage.c:1.6
--- src/usr.bin/mkubootimage/mkubootimage.c:1.5	Mon Jan 31 03:37:28 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Feb 26 20:03:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.5 2011/01/31 03:37:28 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.6 2011/02/26 20:03:09 phx 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.5 2011/01/31 03:37:28 matt Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.6 2011/02/26 20:03:09 phx Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -53,6 +53,7 @@
 
 extern uint32_t crc32(const void *, size_t);
 
+static enum uboot_image_os image_os = IH_OS_NETBSD;
 static enum uboot_image_arch image_arch = IH_ARCH_UNKNOWN;
 static enum uboot_image_type image_type = IH_TYPE_UNKNOWN;
 static enum uboot_image_comp image_comp = IH_COMP_NONE;
@@ -60,6 +61,29 @@
 static uint32_t image_entrypoint = 0;
 static char *image_name;
 
+struct uboot_os {
+	enum uboot_image_os os;
+	const char *name;
+} uboot_os[] = {
+	{ IH_OS_OPENBSD,	openbsd },
+	{ IH_OS_NETBSD,		netbsd },
+	{ IH_OS_FREEBSD,	freebsd },
+	{ IH_OS_LINUX,		linux },
+};
+
+static enum uboot_image_os
+get_os(const char *name)
+{
+	unsigned int i;
+
+	for (i = 0; i  __arraycount(uboot_os); i++) {
+		if (strcmp(uboot_os[i].name, name) == 0)
+			return uboot_os[i].os;
+	}
+
+	return IH_OS_UNKNOWN;
+}
+
 struct uboot_arch {
 	enum uboot_image_arch arch;
 	const char *name;
@@ -87,6 +111,7 @@
 	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 },
@@ -131,8 +156,9 @@
 usage(void)
 {
 	fprintf(stderr, usage: mkubootimage -A arm|mips|mips64|powerpc);
-	fprintf(stderr,  -T kernel|ramdisk|fs);
 	fprintf(stderr,  -C none|gz|bz2);
+	fprintf(stderr,  -O openbsd|netbsd|freebsd|linux);
+	fprintf(stderr,  -T standalone|kernel|ramdisk|fs);
 	fprintf(stderr,  -a addr [-e ep] -n name);
 	fprintf(stderr,  srcfile dstfile\n);
 
@@ -192,7 +218,7 @@
 	hdr-ih_load = htonl(image_loadaddr);
 	hdr-ih_ep = htonl(image_entrypoint);
 	hdr-ih_dcrc = htonl(crc);
-	hdr-ih_os = IH_OS_NETBSD;
+	hdr-ih_os = image_os;
 	hdr-ih_arch = image_arch;
 	hdr-ih_type = image_type;
 	hdr-ih_comp = image_comp;
@@ -238,7 +264,7 @@
 	int ch;
 	unsigned long num;
 
-	while ((ch = getopt(argc, argv, A:C:T:a:e:hn:)) != -1) {
+	while ((ch = getopt(argc, argv, A:C:O:T:a:e:hn:)) != -1) {
 		switch (ch) {
 		case 'A':	/* arch */
 			image_arch = get_arch(optarg);
@@ -246,6 +272,9 @@
 		case 'C':	/* comp */
 			image_comp = get_comp(optarg);
 			break;
+		case 'O':	/* os */
+			image_os = get_os(optarg);
+			break;
 		case 'T':	/* type */
 			image_type = get_type(optarg);
 			break;

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.2 src/usr.bin/mkubootimage/uboot.h:1.3
--- src/usr.bin/mkubootimage/uboot.h:1.2	Mon Jan 31 03:37:28 2011
+++ src/usr.bin/mkubootimage/uboot.h	Sat Feb 26 20:03:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.2 2011/01/31 03:37:28 matt Exp $ */
+/* $NetBSD: uboot.h,v 1.3 2011/02/26 20:03:09 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,13 @@
 #ifndef _HAVE_UBOOT_H
 #define _HAVE_UBOOT_H
 
-#define	IH_OS_NETBSD	2
+enum uboot_image_os {
+	IH_OS_UNKNOWN = 0,
+	IH_OS_OPENBSD = 1,
+	IH_OS_NETBSD = 2,
+	IH_OS_FREEBSD = 3,
+	IH_OS_LINUX = 5
+};
 
 enum uboot_image_arch {
 	IH_ARCH_UNKNOWN = 0,
@@ -40,6 +46,7 @@
 
 enum uboot_image_type {
 	IH_TYPE_UNKNOWN = 0,
+	IH_TYPE_STANDALONE = 1,
 	IH_TYPE_KERNEL = 2,
 	IH_TYPE_RAMDISK = 3,
 	IH_TYPE_FILESYSTEM = 7,



CVS commit: src/usr.bin/mkubootimage

2011-02-26 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Feb 26 20:03:09 UTC 2011

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

Log Message:
Add the -O option to set the OS type, which defaults to NetBSD when missing.
This is needed, because some vendors have stripped U-Boot so much that it
only accepts Linux kernel modules.
Also allow 'standalone' as module type.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.2 -r1.3 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.



CVS commit: src/usr.bin/mkubootimage

2011-01-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jan 31 03:37:29 UTC 2011

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

Log Message:
Add mips/mips64 support.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.1 -r1.2 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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.4 src/usr.bin/mkubootimage/mkubootimage.c:1.5
--- src/usr.bin/mkubootimage/mkubootimage.c:1.4	Sat Jul 10 07:48:25 2010
+++ src/usr.bin/mkubootimage/mkubootimage.c	Mon Jan 31 03:37:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.4 2010/07/10 07:48:25 kiyohara Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.5 2011/01/31 03:37:28 matt 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.4 2010/07/10 07:48:25 kiyohara Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.5 2011/01/31 03:37:28 matt Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -65,6 +65,8 @@
 	const char *name;
 } uboot_arch[] = {
 	{ IH_ARCH_ARM,		arm },
+	{ IH_ARCH_MIPS,		mips },
+	{ IH_ARCH_MIPS64,	mips64 },
 	{ IH_ARCH_PPC,		powerpc },
 };
 
@@ -128,7 +130,7 @@
 static void
 usage(void)
 {
-	fprintf(stderr, usage: mkubootimage -A arm|powerpc);
+	fprintf(stderr, usage: mkubootimage -A arm|mips|mips64|powerpc);
 	fprintf(stderr,  -T kernel|ramdisk|fs);
 	fprintf(stderr,  -C none|gz|bz2);
 	fprintf(stderr,  -a addr [-e ep] -n name);

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.1 src/usr.bin/mkubootimage/uboot.h:1.2
--- src/usr.bin/mkubootimage/uboot.h:1.1	Fri Jun 18 18:55:48 2010
+++ src/usr.bin/mkubootimage/uboot.h	Mon Jan 31 03:37:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.1 2010/06/18 18:55:48 jmcneill Exp $ */
+/* $NetBSD: uboot.h,v 1.2 2011/01/31 03:37:28 matt Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -33,6 +33,8 @@
 enum uboot_image_arch {
 	IH_ARCH_UNKNOWN = 0,
 	IH_ARCH_ARM = 2,
+	IH_ARCH_MIPS = 5,
+	IH_ARCH_MIPS64 = 6,
 	IH_ARCH_PPC = 7
 };
 



CVS commit: src/usr.bin/mkubootimage

2011-01-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jan 31 03:37:29 UTC 2011

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

Log Message:
Add mips/mips64 support.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.1 -r1.2 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.



CVS commit: src/usr.bin/mkubootimage

2010-07-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jul 10 07:48:25 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Change '-e' to optional.  Use load addr(-a), if '-e' not specify.
Just like u-boot's mkimage.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.3 src/usr.bin/mkubootimage/mkubootimage.c:1.4
--- src/usr.bin/mkubootimage/mkubootimage.c:1.3	Fri Jul  9 11:36:42 2010
+++ src/usr.bin/mkubootimage/mkubootimage.c	Sat Jul 10 07:48:25 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.3 2010/07/09 11:36:42 kiyohara Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.4 2010/07/10 07:48:25 kiyohara 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.3 2010/07/09 11:36:42 kiyohara Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.4 2010/07/10 07:48:25 kiyohara Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -131,7 +131,7 @@
 	fprintf(stderr, usage: mkubootimage -A arm|powerpc);
 	fprintf(stderr,  -T kernel|ramdisk|fs);
 	fprintf(stderr,  -C none|gz|bz2);
-	fprintf(stderr,  -a addr -e ep -n name);
+	fprintf(stderr,  -a addr [-e ep] -n name);
 	fprintf(stderr,  srcfile dstfile\n);
 
 	exit(EXIT_FAILURE);
@@ -278,10 +278,12 @@
 	if (argc != 2)
 		usage();
 
+	if (image_entrypoint == 0)
+		image_entrypoint = image_loadaddr;
+
 	if (image_arch == IH_ARCH_UNKNOWN ||
 	image_type == IH_TYPE_UNKNOWN ||
 	image_loadaddr == 0 ||
-	image_entrypoint == 0 ||
 	image_name == NULL)
 		usage();
 



CVS commit: src/usr.bin/mkubootimage

2010-07-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jul 10 07:48:25 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
Change '-e' to optional.  Use load addr(-a), if '-e' not specify.
Just like u-boot's mkimage.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2010-07-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri Jul  9 11:36:42 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
s/mkuboot/mkubootimage/ in usage().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/mkubootimage.c

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.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.2 src/usr.bin/mkubootimage/mkubootimage.c:1.3
--- src/usr.bin/mkubootimage/mkubootimage.c:1.2	Tue Jun 22 14:54:11 2010
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Jul  9 11:36:42 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.3 2010/07/09 11:36:42 kiyohara 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.2 2010/06/22 14:54:11 dogcow Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.3 2010/07/09 11:36:42 kiyohara Exp $);
 
 #include sys/mman.h
 #include sys/stat.h
@@ -128,7 +128,7 @@
 static void
 usage(void)
 {
-	fprintf(stderr, usage: mkuboot -A arm|powerpc);
+	fprintf(stderr, usage: mkubootimage -A arm|powerpc);
 	fprintf(stderr,  -T kernel|ramdisk|fs);
 	fprintf(stderr,  -C none|gz|bz2);
 	fprintf(stderr,  -a addr -e ep -n name);



CVS commit: src/usr.bin/mkubootimage

2010-07-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri Jul  9 11:36:42 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.c

Log Message:
s/mkuboot/mkubootimage/ in usage().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2010-06-22 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Jun 22 14:54:11 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: crc32.c mkubootimage.c

Log Message:
nbtool.h'ify; fixes cross-compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/crc32.c \
src/usr.bin/mkubootimage/mkubootimage.c

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/crc32.c
diff -u src/usr.bin/mkubootimage/crc32.c:1.1 src/usr.bin/mkubootimage/crc32.c:1.2
--- src/usr.bin/mkubootimage/crc32.c:1.1	Fri Jun 18 18:55:48 2010
+++ src/usr.bin/mkubootimage/crc32.c	Tue Jun 22 14:54:11 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: crc32.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $ */
+/* $NetBSD: crc32.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $ */
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -28,8 +28,12 @@
  * CRC32 code derived from work by Gary S. Brown.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: crc32.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $);
+__RCSID($NetBSD: crc32.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $);
 
 #include sys/types.h
 #include stdint.h
Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.1 src/usr.bin/mkubootimage/mkubootimage.c:1.2
--- src/usr.bin/mkubootimage/mkubootimage.c:1.1	Fri Jun 18 18:55:48 2010
+++ src/usr.bin/mkubootimage/mkubootimage.c	Tue Jun 22 14:54:11 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -25,8 +25,12 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: mkubootimage.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $);
+__RCSID($NetBSD: mkubootimage.c,v 1.2 2010/06/22 14:54:11 dogcow Exp $);
 
 #include sys/mman.h
 #include sys/stat.h



CVS commit: src/usr.bin/mkubootimage

2010-06-22 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Tue Jun 22 14:54:11 UTC 2010

Modified Files:
src/usr.bin/mkubootimage: crc32.c mkubootimage.c

Log Message:
nbtool.h'ify; fixes cross-compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/mkubootimage/crc32.c \
src/usr.bin/mkubootimage/mkubootimage.c

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



CVS commit: src/usr.bin/mkubootimage

2010-06-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 18 18:55:48 UTC 2010

Added Files:
src/usr.bin/mkubootimage: Makefile crc32.c mkubootimage.c uboot.h

Log Message:
add mkubootimage(1), a tool for creating u-boot compatible images


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/mkubootimage/Makefile \
src/usr.bin/mkubootimage/crc32.c src/usr.bin/mkubootimage/mkubootimage.c \
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.

Added files:

Index: src/usr.bin/mkubootimage/Makefile
diff -u /dev/null src/usr.bin/mkubootimage/Makefile:1.1
--- /dev/null	Fri Jun 18 18:55:48 2010
+++ src/usr.bin/mkubootimage/Makefile	Fri Jun 18 18:55:48 2010
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile,v 1.1 2010/06/18 18:55:48 jmcneill Exp $
+
+PROG=	mkubootimage
+SRCS=	mkubootimage.c crc32.c
+NOMAN=	# defined
+
+.include bsd.prog.mk
Index: src/usr.bin/mkubootimage/crc32.c
diff -u /dev/null src/usr.bin/mkubootimage/crc32.c:1.1
--- /dev/null	Fri Jun 18 18:55:48 2010
+++ src/usr.bin/mkubootimage/crc32.c	Fri Jun 18 18:55:48 2010
@@ -0,0 +1,98 @@
+/* $NetBSD: crc32.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2002 Marcel Moolenaar
+ * 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 ``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 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.
+ *
+ * CRC32 code derived from work by Gary S. Brown.
+ */
+
+#include sys/cdefs.h
+__RCSID($NetBSD: crc32.c,v 1.1 2010/06/18 18:55:48 jmcneill Exp $);
+
+#include sys/types.h
+#include stdint.h
+
+uint32_t	crc32(const void *, size_t);
+
+static uint32_t crc32_tab[] = {
+	0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+	0xe963a535, 0x9e6495a3,	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+	0xf3b97148, 0x84be41de,	0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,	0x14015c4f, 0x63066cd9,
+	0xfa0f3d63, 0x8d080df5,	0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,	0x35b5a8fa, 0x42b2986c,
+	0xdbbbc9d6, 0xacbcf940,	0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+	0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,	0x76dc4190, 0x01db7106,
+	0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+	0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+	0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+	0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+	0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+	0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+	0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+	0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+	0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+	0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+	0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+	0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+	0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3,