Sat Dec 7 12:34:17 2019 UTC ()
Sync usage with man page, merge single letter options.

Limit program usage line length.


(wiz)
diff -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.1
diff -r1.26 -r1.27 src/usr.bin/mkubootimage/mkubootimage.c

cvs diff -r1.13 -r1.14 src/usr.bin/mkubootimage/mkubootimage.1 (expand / switch to unified diff)

--- src/usr.bin/mkubootimage/mkubootimage.1 2019/12/04 11:21:34 1.13
+++ src/usr.bin/mkubootimage/mkubootimage.1 2019/12/07 12:34:17 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: mkubootimage.1,v 1.13 2019/12/04 11:21:34 jmcneill Exp $ 1.\" $NetBSD: mkubootimage.1,v 1.14 2019/12/07 12:34:17 wiz Exp $
2.\" 2.\"
3.\" Copyright (c) 2012 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2012 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jeremy C. Reed 7.\" by Jeremy C. Reed
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -25,51 +25,50 @@ @@ -25,51 +25,50 @@
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd December 4, 2019 30.Dd December 4, 2019
31.Dt MKUBOOTIMAGE 1 31.Dt MKUBOOTIMAGE 1
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm mkubootimage 34.Nm mkubootimage
35.Nd create U-Boot loader image 35.Nd create U-Boot loader image
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.Nm 37.Nm
38.Op Fl h 38.Op Fl hu
39.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 ) 39.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 )
40.Fl a Ar address 40.Fl a Ar address
41.Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc 41.Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
42.Op Fl E Ar address 42.Op Fl E Ar address
43.Op Fl e Ar address 43.Op Fl e Ar address
44.Op Fl f Po arm64 Ns | Ns uimg Pc 44.Op Fl f Po arm64 Ns | Ns uimg Pc
45.Op Fl m Ar magic 45.Op Fl m Ar magic
46.Fl n Ar image 46.Fl n Ar image
47.Op Fl O Po freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd Pc 47.Op Fl O Po freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd Pc
48.Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns standalone ) 48.Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
49.Op Fl u 
50.Ar source destination 49.Ar source destination
51.\" 50.\"
52.Sh DESCRIPTION 51.Sh DESCRIPTION
53The 52The
54.Nm 53.Nm
55utility is used to create an image for Das U-Boot, the 54utility is used to create an image for Das U-Boot, the
56.Qq Universal Boot Loader . 55.Qq Universal Boot Loader .
57.Pp 56.Pp
58The arguments are as follows: 57The arguments are as follows:
59.Bl -tag -width indent 58.Bl -tag -width indent
60.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 ) 59.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 )
61Defines the architecture. 60Defines the architecture.
62This is required for  61This is required for
63.Qq uimg 62.Qq uimg
64format images. 63format images.
65.It Fl a Ar address 64.It Fl a Ar address
66Sets the image load address. 65Sets the image load address.
67This is an integer between 0 and 66This is an integer between 0 and
68.Dv UINT32_MAX . 67.Dv UINT32_MAX .
69This is required for all 68This is required for all
70.Qq uimg 69.Qq uimg
71image types except for script, ramdisk, and kernel_noload. 70image types except for script, ramdisk, and kernel_noload.
72.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none ) 71.It Fl C No ( bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none )
73Defines the compression. 72Defines the compression.
74The default is 73The default is
75.Qq none . 74.Qq none .
@@ -110,27 +109,27 @@ Set the magic used for @@ -110,27 +109,27 @@ Set the magic used for
110.Qq uimg 109.Qq uimg
111format images. 110format images.
112This is an integer between 0 and 111This is an integer between 0 and
113.Dv UINT32_MAX . 112.Dv UINT32_MAX .
114The default is 113The default is
115.Qq 0x27051956 . 114.Qq 0x27051956 .
116.It Fl n Ar image 115.It Fl n Ar image
117Defines the image name. 116Defines the image name.
118This is required. 117This is required.
119.It Fl O No ( freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd ) 118.It Fl O No ( freebsd Ns | Ns linux Ns | Ns netbsd Ns | Ns openbsd )
120Defines the operating system type. 119Defines the operating system type.
121The default OS name is 120The default OS name is
122.Qq netbsd . 121.Qq netbsd .
123.It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns standalone Ns | Ns script ) 122.It Fl T No ( fs Ns | Ns kernel Ns | Ns kernel_noload Ns | Ns ramdisk Ns | Ns script Ns | Ns standalone )
124Defines the image type. 123Defines the image type.
125This is required for 124This is required for
126.Qq uimg 125.Qq uimg
127format images. 126format images.
128.It Fl u 127.It Fl u
129Update the header in an existing file instead of creating a new one. 128Update the header in an existing file instead of creating a new one.
130.El 129.El
131.Pp 130.Pp
132The required 131The required
133.Ar source 132.Ar source
134argument is the filename of the kernel that is read. 133argument is the filename of the kernel that is read.
135The required 134The required
136.Ar destination 135.Ar destination

cvs diff -r1.26 -r1.27 src/usr.bin/mkubootimage/mkubootimage.c (expand / switch to unified diff)

--- src/usr.bin/mkubootimage/mkubootimage.c 2019/12/04 14:09:47 1.26
+++ src/usr.bin/mkubootimage/mkubootimage.c 2019/12/07 12:34:17 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $ */ 1/* $NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the author may not be used to endorse or promote products 12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission. 13 * derived from this software without specific prior written permission.
14 * 14 *
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#if HAVE_NBTOOL_CONFIG_H 28#if HAVE_NBTOOL_CONFIG_H
29#include "nbtool_config.h" 29#include "nbtool_config.h"
30#endif 30#endif
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__RCSID("$NetBSD: mkubootimage.c,v 1.26 2019/12/04 14:09:47 jmcneill Exp $"); 33__RCSID("$NetBSD: mkubootimage.c,v 1.27 2019/12/07 12:34:17 wiz Exp $");
34 34
35#include <sys/mman.h> 35#include <sys/mman.h>
36#include <sys/stat.h> 36#include <sys/stat.h>
37#include <sys/endian.h> 37#include <sys/endian.h>
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/uio.h> 39#include <sys/uio.h>
40#include <err.h> 40#include <err.h>
41#include <errno.h> 41#include <errno.h>
42#include <fcntl.h> 42#include <fcntl.h>
43#include <inttypes.h> 43#include <inttypes.h>
44#include <limits.h> 44#include <limits.h>
45#include <stdint.h> 45#include <stdint.h>
46#include <stdio.h> 46#include <stdio.h>
@@ -254,34 +254,32 @@ get_comp_name(enum uboot_image_comp comp @@ -254,34 +254,32 @@ get_comp_name(enum uboot_image_comp comp
254 unsigned int i; 254 unsigned int i;
255 255
256 for (i = 0; i < __arraycount(uboot_comp); i++) { 256 for (i = 0; i < __arraycount(uboot_comp); i++) {
257 if (uboot_comp[i].comp == comp) 257 if (uboot_comp[i].comp == comp)
258 return uboot_comp[i].name; 258 return uboot_comp[i].name;
259 } 259 }
260 260
261 return "Unknown"; 261 return "Unknown";
262} 262}
263 263
264__dead static void 264__dead static void
265usage(void) 265usage(void)
266{ 266{
267 fprintf(stderr, "usage: mkubootimage -A " 267 fprintf(stderr, "usage: mkubootimage [-hu] -A "
268 "<arm|arm64|i386|mips|mips64|or1k|powerpc|sh>"); 268 "<arm|arm64|i386|mips|mips64|or1k|powerpc|sh> -a address\n");
269 fprintf(stderr, " -C <none|bz2|gz|lzma|lzo>"); 269 fprintf(stderr, "\t-C <bz2|gz|lzma|lzo|none> [-E address] [-e address]\n");
270 fprintf(stderr, " -O <openbsd|netbsd|freebsd|linux>"); 270 fprintf(stderr, "\t[-f <arm64|uimg>] [-m magic] -n image -O <freebsd|linux|netbsd|openbsd>\n");
271 fprintf(stderr, " -T <standalone|kernel|kernel_noload|ramdisk|fs|script>"); 271 fprintf(stderr, "\t-T <fs|kernel|kernel_noload|ramdisk|script|standalone>\n");
272 fprintf(stderr, " -a <addr> [-e <ep>] [-m <magic>] -n <name>"); 272 fprintf(stderr, "\tsource destination\n");
273 fprintf(stderr, " [-f <uimg|arm64>] [-u]"); 
274 fprintf(stderr, " <srcfile> <dstfile>\n"); 
275 273
276 exit(EXIT_FAILURE); 274 exit(EXIT_FAILURE);
277} 275}
278 276
279static void 277static void
280dump_header_uimg(struct uboot_image_header *hdr) 278dump_header_uimg(struct uboot_image_header *hdr)
281{ 279{
282 time_t tm = ntohl(hdr->ih_time); 280 time_t tm = ntohl(hdr->ih_time);
283 281
284 printf(" magic: 0x%08x\n", ntohl(hdr->ih_magic)); 282 printf(" magic: 0x%08x\n", ntohl(hdr->ih_magic));
285 printf(" time: %s", ctime(&tm)); 283 printf(" time: %s", ctime(&tm));
286 printf(" size: %u\n", ntohl(hdr->ih_size)); 284 printf(" size: %u\n", ntohl(hdr->ih_size));
287 printf(" load addr: 0x%08x\n", ntohl(hdr->ih_load)); 285 printf(" load addr: 0x%08x\n", ntohl(hdr->ih_load));