Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/binutils/usr.sbin/mdsetimage remove dup



details:   https://anonhg.NetBSD.org/src/rev/ff42164a1946
branches:  trunk
changeset: 347894:ff42164a1946
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Sep 21 16:26:18 2016 +0000

description:
remove dup

diffstat:

 external/gpl3/binutils/usr.sbin/mdsetimage/Makefile     |    7 +-
 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 |   92 ----
 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c |  321 ----------------
 3 files changed, 5 insertions(+), 415 deletions(-)

diffs (truncated from 443 to 300 lines):

diff -r 467e3a6c471b -r ff42164a1946 external/gpl3/binutils/usr.sbin/mdsetimage/Makefile
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/Makefile       Wed Sep 21 16:25:41 2016 +0000
+++ b/external/gpl3/binutils/usr.sbin/mdsetimage/Makefile       Wed Sep 21 16:26:18 2016 +0000
@@ -1,6 +1,8 @@
-#      $NetBSD: Makefile,v 1.11 2016/01/26 19:37:49 christos Exp $
+#      $NetBSD: Makefile,v 1.12 2016/09/21 16:26:18 christos Exp $
 
-.include <bsd.own.mk>
+.include <bsd.init.mk>
+
+.PATH: ${NETBSDSRCDIR}/usr.sbin/mdsetimage
 
 .if (defined(HOSTPROG) && \
      (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN))) || \
@@ -8,6 +10,7 @@
 BFDSUBDIR=     lib
 
 PROG=          mdsetimage
+SRCS=          mdsetimage.c bin_bfd.c
 MAN=           mdsetimage.8
 
 CPPFLAGS+=     -I${DIST}/bfd -I${DIST}/binutils -I${DIST}/include
diff -r 467e3a6c471b -r ff42164a1946 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8   Wed Sep 21 16:25:41 2016 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-.\"    $NetBSD: mdsetimage.8,v 1.3 2010/11/07 11:50:23 wiz Exp $
-.\"
-.\" Copyright (c) 1996 Christopher G. Demetriou
-.\" 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.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\"    derived from this software without specific prior written permission.
-.\"
-.\" 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.
-.\"
-.\" <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
-.\"
-.Dd November 4, 2010
-.Dt MDSETIMAGE 8
-.Os
-.Sh NAME
-.Nm mdsetimage
-.Nd set kernel RAM disk image
-.Sh SYNOPSIS
-.Nm
-.Op Fl svx
-.Op Fl b Ar bfdname
-.Op Fl I Ar image_symbol
-.Op Fl S Ar size_symbol
-.Ar kernel
-.Ar image
-.Sh DESCRIPTION
-The
-.Nm
-command copies the disk image specified by
-.Ar image
-into the memory disk storage area in
-.Ar kernel .
-The file system present in
-.Ar image
-will typically be used by the kernel
-as the root file system.
-.Pp
-To recognize kernel executable format, the
-.Fl b
-flag specifies BFD name of kernel.
-.Pp
-The
-.Fl I
-and
-.Fl S
-flags specify the symbol names of image and size of memory disk
-drivers respectively.
-.Pp
-If the
-.Fl s
-flags is given,
-.Nm
-will write back the actual disk image size back into
-.Ar kernel .
-.Pp
-If the
-.Fl v
-flag is given,
-.Nm
-will print out status information as
-it is copying the image.
-.Pp
-If the
-.Fl x
-flag is given,
-.Nm
-will extract the disk image from
-.Ar kernel
-into the file
-.Ar image .
-This is the opposite of the default behavior.
-.Sh SEE ALSO
-.Xr md 4 ,
-.Xr mdconfig 8
diff -r 467e3a6c471b -r ff42164a1946 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c   Wed Sep 21 16:25:41 2016 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-/* $NetBSD: mdsetimage.c,v 1.4 2016/09/21 01:33:42 christos Exp $ */
-/* from: NetBSD: mdsetimage.c,v 1.15 2001/03/21 23:46:48 cgd Exp $ */
-
-/*
- * Copyright (c) 1996, 2002 Christopher G. Demetriou
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- * 
- * 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.
- * 
- * <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if !defined(lint)
-__COPYRIGHT("@(#) Copyright (c) 1996\
- Christopher G. Demetriou.  All rights reserved.");
-__RCSID("$NetBSD: mdsetimage.c,v 1.4 2016/09/21 01:33:42 christos Exp $");
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <err.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <bfd.h>
-
-struct symbols {
-       char *name;
-       size_t offset;
-};
-#define        X_MD_ROOT_IMAGE 0
-#define        X_MD_ROOT_SIZE  1
-
-#define        CHUNKSIZE       (64 * 1024)
-
-int            main(int, char *[]);
-static void    usage(void) __attribute__((noreturn));
-static int     find_md_root(bfd *, struct symbols symbols[]);
-
-int    verbose;
-int    extract;
-int    setsize;
-
-static const char *progname;
-#undef setprogname
-#define        setprogname(x)  (void)(progname = (x))
-#undef getprogname
-#define        getprogname()   (progname)
-
-int
-main(int argc, char *argv[])
-{
-       int ch, kfd, fsfd, rv;
-       struct stat ksb, fssb;
-       size_t md_root_offset, md_root_size_offset;
-       u_int32_t md_root_size;
-       const char *kfile, *fsfile;
-       char *mappedkfile;
-       char *bfdname = NULL;
-       bfd *abfd;
-       ssize_t left_to_copy;
-       struct symbols md_root_symbols[3] = { { 0 } };
-
-       md_root_symbols[X_MD_ROOT_IMAGE].name = "_md_root_image";
-       md_root_symbols[X_MD_ROOT_SIZE].name = "_md_root_size";
-
-       setprogname(argv[0]);
-
-       while ((ch = getopt(argc, argv, "I:S:b:svx")) != -1)
-               switch (ch) {
-               case 'I':
-                       md_root_symbols[X_MD_ROOT_IMAGE].name = optarg;
-                       break;
-               case 'S':
-                       md_root_symbols[X_MD_ROOT_SIZE].name = optarg;
-                       break;
-               case 'b':
-                       bfdname = optarg;
-                       break;
-               case 's':
-                       setsize = 1;
-                       break;
-               case 'v':
-                       verbose = 1;
-                       break;
-               case 'x':
-                       extract = 1;
-                       break;
-               case '?':
-               default:
-                       usage();
-       }
-       argc -= optind;
-       argv += optind;
-
-       if (argc != 2)
-               usage();
-       kfile = argv[0];
-       fsfile = argv[1];
-
-       if (extract) {
-               if ((kfd = open(kfile, O_RDONLY, 0))  == -1)
-                       err(1, "open %s", kfile);
-       } else {
-               if ((kfd = open(kfile, O_RDWR, 0))  == -1)
-                       err(1, "open %s", kfile);
-       }
-
-       bfd_init();
-       if ((abfd = bfd_fdopenr(kfile, bfdname, kfd)) == NULL) {
-               bfd_perror("open");
-               exit(1);
-       }
-       if (!bfd_check_format(abfd, bfd_object)) {
-               bfd_perror("check format");
-               exit(1);
-       }
-
-       if (find_md_root(abfd, md_root_symbols) != 0)
-               errx(1, "could not find symbols in %s", kfile);
-       if (verbose)
-               fprintf(stderr, "got symbols from %s\n", kfile);
-
-       if (fstat(kfd, &ksb) == -1)
-               err(1, "fstat %s", kfile);
-       if (ksb.st_size != (size_t)ksb.st_size)
-               errx(1, "%s too big to map", kfile);
-
-       if ((mappedkfile = mmap(NULL, ksb.st_size, PROT_READ,
-           MAP_FILE | MAP_PRIVATE, kfd, 0)) == (caddr_t)-1)
-               err(1, "mmap %s", kfile);
-       if (verbose)
-               fprintf(stderr, "mapped %s\n", kfile);
-
-       md_root_offset = md_root_symbols[X_MD_ROOT_IMAGE].offset;
-       md_root_size_offset = md_root_symbols[X_MD_ROOT_SIZE].offset;
-       md_root_size = bfd_get_32(abfd, &mappedkfile[md_root_size_offset]);
-
-       if (verbose)
-               fprintf(stderr, "root @ %#zx/%u\n",
-                   md_root_offset, md_root_size);
-
-       munmap(mappedkfile, ksb.st_size);
-
-       if (extract) {
-               if ((fsfd = open(fsfile, O_WRONLY|O_CREAT, 0777)) == -1)
-                       err(1, "open %s", fsfile);



Home | Main Index | Thread Index | Old Index