summaryrefslogtreecommitdiffstats
path: root/usr.sbin/asf
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2003-09-25 07:56:48 +0000
committersimokawa <simokawa@FreeBSD.org>2003-09-25 07:56:48 +0000
commit4034ea2214b5da76341e669437db089ec2c10727 (patch)
treeb0121c5cc69a273460937b512032b346073f9bac /usr.sbin/asf
parentc0197faefe86e09d714f07d049afe6da9c4b6e2e (diff)
downloadFreeBSD-src-4034ea2214b5da76341e669437db089ec2c10727.zip
FreeBSD-src-4034ea2214b5da76341e669437db089ec2c10727.tar.gz
Add -s option to strip subdirectory from module path.
e.g. moudle-path/firewire/firewire.ko -> module-path/firewire.ko Reviewed by: grog
Diffstat (limited to 'usr.sbin/asf')
-rw-r--r--usr.sbin/asf/asf.84
-rw-r--r--usr.sbin/asf/asf.c15
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/asf/asf.8 b/usr.sbin/asf/asf.8
index bf46cc3..4b2208f 100644
--- a/usr.sbin/asf/asf.8
+++ b/usr.sbin/asf/asf.8
@@ -31,7 +31,7 @@
.Nd add symbol files
.Sh SYNOPSIS
.Nm
-.Op Fl akx
+.Op Fl aksx
.Op Ar modules-path Op Ar outfile
.Sh DESCRIPTION
By default,
@@ -75,6 +75,8 @@ append to the file rather than overwriting it.
Instead of reading from standard input, start a
.Xr kldstat 8
and read the information from it.
+.It Fl s
+Don't prepend subdirectory of moudle path.
.It Fl x
Normally
.Nm
diff --git a/usr.sbin/asf/asf.c b/usr.sbin/asf/asf.c
index bec094f..755b50b 100644
--- a/usr.sbin/asf/asf.c
+++ b/usr.sbin/asf/asf.c
@@ -100,6 +100,7 @@ usage(const char *myname)
"\t-a\tappend to outfile)\n"
"\t-k\ttake input from kldstat(8)\n"
"\t-x\tdon't append \".debug\" to module name\n",
+ "\t-s\tdon't prepend subdir for module path\n",
myname);
}
@@ -118,6 +119,7 @@ main(int argc, char *argv[])
char cwd[MAXPATHLEN]; /* current directory */
const char *debugname = ".debug"; /* some file names end in this */
char *token[MAXTOKEN];
+ int nosubdir = 0;
getcwd(cwd, MAXPATHLEN); /* find where we are */
kldstat = stdin;
@@ -132,6 +134,8 @@ main(int argc, char *argv[])
filemode = "a";
else if (strcmp(argv[i], "-x") == 0) /* no .debug extension */
debugname = ""; /* nothing */
+ else if (strcmp(argv[i], "-s") == 0) /* no subdir */
+ nosubdir = 1; /* nothing */
else {
fprintf(stderr,
"Invalid option: %s, aborting\n",
@@ -174,12 +178,13 @@ main(int argc, char *argv[])
tokens = tokenize(buf, token, MAXTOKEN);
base = strtoll(token[2], NULL, 16);
strcpy(basetoken, token[4]);
- basetoken[strlen(basetoken) - 3] = '\0'; /* cut off the .ko */
+ basetoken[strlen(basetoken) - 3] = '/';
+ basetoken[strlen(basetoken) - 2] = '\0'; /* cut off the .ko */
snprintf(ocbuf,
MAXLINE,
- "/usr/bin/objdump --section-headers %s/%s/%s%s",
+ "/usr/bin/objdump --section-headers %s/%s%s%s",
modules_path,
- basetoken,
+ nosubdir ? "" : basetoken,
token[4],
debugname);
if (!(objcopy = popen(ocbuf, "r"))) {
@@ -206,10 +211,10 @@ main(int argc, char *argv[])
}
if (textaddr) { /* we must have a text address */
fprintf(out,
- "add-symbol-file %s/%s/%s/%s%s 0x%llx",
+ "add-symbol-file %s/%s/%s%s%s 0x%llx",
cwd,
modules_path,
- basetoken,
+ nosubdir ? "" : basetoken,
token[4],
debugname,
textaddr);
OpenPOWER on IntegriCloud