aboutsummaryrefslogtreecommitdiff
path: root/modutils/depmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'modutils/depmod.c')
-rw-r--r--modutils/depmod.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/modutils/depmod.c b/modutils/depmod.c
index aa228ec85..a41b3e440 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -51,7 +51,11 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA
51 51
52 info->dnext = info->dprev = info; 52 info->dnext = info->dprev = info;
53 info->name = xstrdup(fname + 2); /* skip "./" */ 53 info->name = xstrdup(fname + 2); /* skip "./" */
54 info->modname = xstrdup(filename2modname(fname, modname)); 54 info->modname = xstrdup(
55 filename2modname(
56 bb_get_last_path_component_nostrip(fname),
57 modname
58 ));
55 for (ptr = image; ptr < image + len - 10; ptr++) { 59 for (ptr = image; ptr < image + len - 10; ptr++) {
56 if (strncmp(ptr, "depends=", 8) == 0) { 60 if (strncmp(ptr, "depends=", 8) == 0) {
57 char *u; 61 char *u;
@@ -242,17 +246,18 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
242 if (!(option_mask32 & OPT_n)) 246 if (!(option_mask32 & OPT_n))
243 xfreopen_write("modules.alias", stdout); 247 xfreopen_write("modules.alias", stdout);
244 for (m = modules; m != NULL; m = m->next) { 248 for (m = modules; m != NULL; m = m->next) {
249 char modname[MODULE_NAME_LEN];
245 const char *fname = bb_basename(m->name); 250 const char *fname = bb_basename(m->name);
246 int fnlen = strchrnul(fname, '.') - fname; 251 filename2modname(fname, modname);
247 while (m->aliases) { 252 while (m->aliases) {
248 /* Last word can well be m->modname instead, 253 /* Last word can well be m->modname instead,
249 * but depmod from module-init-tools 3.4 254 * but depmod from module-init-tools 3.4
250 * uses module basename, i.e., no s/-/_/g. 255 * uses module basename, i.e., no s/-/_/g.
251 * (pathname and .ko.* are still stripped) 256 * (pathname and .ko.* are still stripped)
252 * Mimicking that... */ 257 * Mimicking that... */
253 printf("alias %s %.*s\n", 258 printf("alias %s %s\n",
254 (char*)llist_pop(&m->aliases), 259 (char*)llist_pop(&m->aliases),
255 fnlen, fname); 260 modname);
256 } 261 }
257 } 262 }
258#endif 263#endif
@@ -260,12 +265,13 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
260 if (!(option_mask32 & OPT_n)) 265 if (!(option_mask32 & OPT_n))
261 xfreopen_write("modules.symbols", stdout); 266 xfreopen_write("modules.symbols", stdout);
262 for (m = modules; m != NULL; m = m->next) { 267 for (m = modules; m != NULL; m = m->next) {
268 char modname[MODULE_NAME_LEN];
263 const char *fname = bb_basename(m->name); 269 const char *fname = bb_basename(m->name);
264 int fnlen = strchrnul(fname, '.') - fname; 270 filename2modname(fname, modname);
265 while (m->symbols) { 271 while (m->symbols) {
266 printf("alias symbol:%s %.*s\n", 272 printf("alias symbol:%s %s\n",
267 (char*)llist_pop(&m->symbols), 273 (char*)llist_pop(&m->symbols),
268 fnlen, fname); 274 modname);
269 } 275 }
270 } 276 }
271#endif 277#endif