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.)
This commit is contained in:
parent
40a5185389
commit
4cca618331
|
@ -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 @@ The file system present in
|
|||
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.
|
||||
|
|
|
@ -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 @@ __RCSID("$NetBSD: mdsetimage.c,v 1.1 2009/08/18 20:22:20 skrll Exp $");
|
|||
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 X_MD_ROOT_IMAGE 0
|
||||
#define X_MD_ROOT_SIZE 1
|
||||
|
||||
#define CHUNKSIZE (64 * 1024)
|
||||
|
||||
|
@ -94,11 +90,21 @@ main(int argc, char *argv[])
|
|||
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;
|
||||
|
|
|
@ -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 @@ The file system present in
|
|||
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.
|
||||
|
|
|
@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1996\
|
|||
#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 @@ __RCSID("$NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $");
|
|||
#include <nlist.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
@ -58,13 +59,8 @@ static void usage __P((void)) __dead;
|
|||
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 @@ main(argc, argv)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue