Source-Changes-HG archive

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

[src/trunk]: src Handle md(4)'s embedded root disk image and size symbol name...



details:   https://anonhg.NetBSD.org/src/rev/e341000dbc0c
branches:  trunk
changeset: 758509:e341000dbc0c
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Nov 06 16:03:23 2010 +0000

description:
Handle md(4)'s embedded root disk image and size symbol names other
than the default ones ("md_root_image" / "md_root_size").

(References to xmd(4) are deliberately removed.)

diffstat:

 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 |  13 ++++++++-
 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c |  22 ++++++++++-----
 usr.sbin/mdsetimage/mdsetimage.8                        |  13 ++++++++-
 usr.sbin/mdsetimage/mdsetimage.c                        |  23 +++++++++++-----
 4 files changed, 51 insertions(+), 20 deletions(-)

diffs (205 lines):

diff -r c0bf13129960 -r e341000dbc0c external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8   Sat Nov 06 15:48:00 2010 +0000
+++ b/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8   Sat Nov 06 16:03:23 2010 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mdsetimage.8,v 1.1 2009/08/18 20:22:20 skrll Exp $
+.\"    $NetBSD: mdsetimage.8,v 1.2 2010/11/06 16:03:23 uebayasi Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\"
 .\" <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
 .\"
-.Dd September 27, 2002
+.Dd November 4, 2010
 .Dt MDSETIMAGE 8
 .Os
 .Sh NAME
@@ -36,6 +36,8 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl svx
+.Op Fl I Ar image_symbol
+.Op Fl S Ar size_symbol
 .Op Fl b Ar bfdname
 .Ar kernel
 .Ar image
@@ -51,6 +53,13 @@
 will typically be used by the kernel
 as the root file system.
 .Pp
+The
+.Fl I
+and
+.Fl S
+flags specify the symbol names of image and size of memory disk
+drivers respectively.
+.Pp
 To recognize kernel executable format, the
 .Fl b
 flag specifies BFD name of kernel.
diff -r c0bf13129960 -r e341000dbc0c external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c   Sat Nov 06 15:48:00 2010 +0000
+++ b/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c   Sat Nov 06 16:03:23 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdsetimage.c,v 1.1 2009/08/18 20:22:20 skrll Exp $ */
+/* $NetBSD: mdsetimage.c,v 1.2 2010/11/06 16:03:23 uebayasi Exp $ */
 /* from: NetBSD: mdsetimage.c,v 1.15 2001/03/21 23:46:48 cgd Exp $ */
 
 /*
@@ -38,7 +38,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1996\
  Christopher G. Demetriou.  All rights reserved.");
-__RCSID("$NetBSD: mdsetimage.c,v 1.1 2009/08/18 20:22:20 skrll Exp $");
+__RCSID("$NetBSD: mdsetimage.c,v 1.2 2010/11/06 16:03:23 uebayasi Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -58,13 +58,9 @@
 struct symbols {
        char *name;
        size_t offset;
-} md_root_symbols[] = {
+};
 #define        X_MD_ROOT_IMAGE 0
-       { "_md_root_image", 0 },
 #define        X_MD_ROOT_SIZE  1
-       { "_md_root_size", 0 },
-       { NULL, 0 }
-};
 
 #define        CHUNKSIZE       (64 * 1024)
 
@@ -94,11 +90,21 @@
        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, "b:svx")) != -1)
+       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;
diff -r c0bf13129960 -r e341000dbc0c usr.sbin/mdsetimage/mdsetimage.8
--- a/usr.sbin/mdsetimage/mdsetimage.8  Sat Nov 06 15:48:00 2010 +0000
+++ b/usr.sbin/mdsetimage/mdsetimage.8  Sat Nov 06 16:03:23 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdsetimage.8,v 1.9 2002/01/19 03:35:05 wiz Exp $
+.\" $NetBSD: mdsetimage.8,v 1.10 2010/11/06 16:03:23 uebayasi Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\"
 .\" <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
 .\"
-.Dd October 3, 1996
+.Dd November 4, 2010
 .Dt MDSETIMAGE 8
 .Os
 .Sh NAME
@@ -35,6 +35,8 @@
 .Nd set kernel RAM disk image
 .Sh SYNOPSIS
 .Nm
+.Op Fl I Ar image_symbol
+.Op Fl S Ar size_symbol
 .Op Fl T Ar address
 .Op Fl v
 .Ar kernel
@@ -51,6 +53,13 @@
 will typically be used by the kernel
 as the root file system.
 .Pp
+The
+.Fl I
+and
+.Fl S
+flags specify the symbol names of image and size of memory disk
+drivers respectively.
+.Pp
 For a.out kernels only, the
 .Fl T
 flag specifies the starting address of kernel text.
diff -r c0bf13129960 -r e341000dbc0c usr.sbin/mdsetimage/mdsetimage.c
--- a/usr.sbin/mdsetimage/mdsetimage.c  Sat Nov 06 15:48:00 2010 +0000
+++ b/usr.sbin/mdsetimage/mdsetimage.c  Sat Nov 06 16:03:23 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $ */
+/* $NetBSD: mdsetimage.c,v 1.20 2010/11/06 16:03:23 uebayasi Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -36,7 +36,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $");
+__RCSID("$NetBSD: mdsetimage.c,v 1.20 2010/11/06 16:03:23 uebayasi Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -49,6 +49,7 @@
 #include <nlist.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "extern.h"
@@ -58,13 +59,8 @@
 static int     find_md_root __P((const char *, const char *, size_t,
                    const struct nlist *, size_t *, u_int32_t *));
 
-static struct nlist md_root_nlist[] = {
 #define        X_MD_ROOT_IMAGE         0
-       { "_md_root_image", 0, 0, 0, 0 },
 #define        X_MD_ROOT_SIZE          1
-       { "_md_root_size", 0, 0, 0, 0 },
-       { NULL, 0, 0, 0, 0 }
-};
 
 int    verbose;
 #ifdef NLIST_AOUT
@@ -88,14 +84,25 @@
        const char *kfile, *fsfile;
        char *mappedkfile;
        int ch, kfd, fsfd, rv;
+       struct nlist md_root_nlist[3];
+
+       (void)memset(md_root_nlist, 0, sizeof(md_root_nlist));
+       N_NAME(&md_root_nlist[X_MD_ROOT_IMAGE]) = "_md_root_image";
+       N_NAME(&md_root_nlist[X_MD_ROOT_SIZE]) = "_md_root_size";
 
        setprogname(argv[0]);
 
-       while ((ch = getopt(argc, argv, "T:v")) != -1)
+       while ((ch = getopt(argc, argv, "I:S:T:v")) != -1)
                switch (ch) {
                case 'v':
                        verbose = 1;
                        break;
+               case 'I':
+                       N_NAME(&md_root_nlist[X_MD_ROOT_IMAGE]) = optarg;
+                       break;
+               case 'S':
+                       N_NAME(&md_root_nlist[X_MD_ROOT_SIZE]) = optarg;
+                       break;
                case 'T':
 #ifdef NLIST_AOUT
                        T_flag_specified = 1;



Home | Main Index | Thread Index | Old Index