Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src xmd(4), mdsetimage(8): handle memory disk symbol name...
details: https://anonhg.NetBSD.org/src/rev/41eed7b50e50
branches: uebayasi-xip
changeset: 751830:41eed7b50e50
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Nov 04 07:29:59 2010 +0000
description:
xmd(4), mdsetimage(8): handle memory disk symbol names other than
the md(4)'s historical ones.
diffstat:
external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 | 14 ++++++++-
external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c | 22 ++++++++++-----
sys/dev/xmd.c | 12 ++++----
usr.sbin/mdsetimage/mdsetimage.8 | 14 ++++++++-
usr.sbin/mdsetimage/mdsetimage.c | 23 +++++++++++-----
5 files changed, 59 insertions(+), 26 deletions(-)
diffs (258 lines):
diff -r 23c64889db84 -r 41eed7b50e50 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 Tue Nov 02 14:05:27 2010 +0000
+++ b/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.8 Thu Nov 04 07:29:59 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.1.2.1 2010/11/04 07:29:59 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.
@@ -80,4 +89,5 @@
This is the opposite of the default behavior.
.Sh SEE ALSO
.Xr md 4 ,
+.Xr xmd 4 ,
.Xr mdconfig 8
diff -r 23c64889db84 -r 41eed7b50e50 external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c
--- a/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c Tue Nov 02 14:05:27 2010 +0000
+++ b/external/gpl3/binutils/usr.sbin/mdsetimage/mdsetimage.c Thu Nov 04 07:29:59 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.1.2.1 2010/11/04 07:30:00 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.1.2.1 2010/11/04 07:30:00 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 23c64889db84 -r 41eed7b50e50 sys/dev/xmd.c
--- a/sys/dev/xmd.c Tue Nov 02 14:05:27 2010 +0000
+++ b/sys/dev/xmd.c Thu Nov 04 07:29:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $ */
+/* $NetBSD: xmd.c,v 1.1.2.6 2010/11/04 07:30:00 uebayasi Exp $ */
/*-
* Copyright (c) 2010 Tsubai Masanari. All rights reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmd.c,v 1.1.2.6 2010/11/04 07:30:00 uebayasi Exp $");
#include "opt_xip.h"
#include "opt_xmd.h"
@@ -86,9 +86,9 @@
CFATTACH_DECL3_NEW(xmd, sizeof(struct xmd_softc),
NULL, xmd_attach, xmd_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
-const char md_root_image[XMD_ROOT_SIZE << DEV_BSHIFT] __aligned(PAGE_SIZE) =
+const char xmd_root_image[XMD_ROOT_SIZE << DEV_BSHIFT] __aligned(PAGE_SIZE) =
"|This is the root ramdisk!\n";
-const size_t md_root_size = XMD_ROOT_SIZE << DEV_BSHIFT;
+const size_t xmd_root_size = XMD_ROOT_SIZE << DEV_BSHIFT;
void
xmdattach(int n)
@@ -120,8 +120,8 @@
{
struct xmd_softc *sc = device_private(self);
- sc->sc_addr = (vaddr_t)md_root_image;
- sc->sc_size = (size_t)md_root_size;
+ sc->sc_addr = (vaddr_t)xmd_root_image;
+ sc->sc_size = (size_t)xmd_root_size;
sc->sc_phys = pmap_physload_device(sc->sc_addr, sc->sc_size, PROT_READ, 0);
diff -r 23c64889db84 -r 41eed7b50e50 usr.sbin/mdsetimage/mdsetimage.8
--- a/usr.sbin/mdsetimage/mdsetimage.8 Tue Nov 02 14:05:27 2010 +0000
+++ b/usr.sbin/mdsetimage/mdsetimage.8 Thu Nov 04 07:29:59 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.9.48.1 2010/11/04 07:30:00 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.
@@ -64,4 +73,5 @@
it is copying the image.
.Sh SEE ALSO
.Xr md 4 ,
+.Xr xmd 4 ,
.Xr mdconfig 8
diff -r 23c64889db84 -r 41eed7b50e50 usr.sbin/mdsetimage/mdsetimage.c
--- a/usr.sbin/mdsetimage/mdsetimage.c Tue Nov 02 14:05:27 2010 +0000
+++ b/usr.sbin/mdsetimage/mdsetimage.c Thu Nov 04 07:29:59 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.19.2.1 2010/11/04 07:30:00 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.19.2.1 2010/11/04 07:30:00 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