Module Name: src Committed By: uebayasi Date: Sat Nov 6 16:03:24 UTC 2010
Modified Files: src/external/gpl3/binutils/usr.sbin/mdsetimage: mdsetimage.8 mdsetimage.c src/usr.sbin/mdsetimage: mdsetimage.8 mdsetimage.c Log Message: 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.) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 \ src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/mdsetimage/mdsetimage.8 cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/mdsetimage/mdsetimage.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 diff -u src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8:1.1 src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8:1.2 --- src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8:1.1 Tue Aug 18 20:22:20 2009 +++ src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 Sat Nov 6 16:03:23 2010 @@ -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. Index: src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c diff -u src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c:1.1 src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c:1.2 --- src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c:1.1 Tue Aug 18 20:22:20 2009 +++ src/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c Sat Nov 6 16:03:23 2010 @@ -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; Index: src/usr.sbin/mdsetimage/mdsetimage.8 diff -u src/usr.sbin/mdsetimage/mdsetimage.8:1.9 src/usr.sbin/mdsetimage/mdsetimage.8:1.10 --- src/usr.sbin/mdsetimage/mdsetimage.8:1.9 Sat Jan 19 03:35:05 2002 +++ src/usr.sbin/mdsetimage/mdsetimage.8 Sat Nov 6 16:03:23 2010 @@ -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. Index: src/usr.sbin/mdsetimage/mdsetimage.c diff -u src/usr.sbin/mdsetimage/mdsetimage.c:1.19 src/usr.sbin/mdsetimage/mdsetimage.c:1.20 --- src/usr.sbin/mdsetimage/mdsetimage.c:1.19 Thu Jul 30 15:16:38 2009 +++ src/usr.sbin/mdsetimage/mdsetimage.c Sat Nov 6 16:03:23 2010 @@ -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;