depmod
Bernhard Fischer
rep.dot.nop at gmail.com
Wed May 28 03:49:20 PDT 2008
On Mon, May 26, 2008 at 06:25:52PM +0000, Vladimir Dronnikov wrote:
[Vladimir, please do not break the threading in the ML archives, TIA]
> Hello, Bernhard!
>
> Attached is slightly modified depmod.c.
> Sorry, I can not provide diff. I marked changed points with DVV with
> comments.
>
> Suggested: malloc+sprintf+strstr -> triple strcmp. Will it be better?
> Fixed: endless loop in dependencies verifying code.
> Fixed: if a user specifies -b <dir> then why on earth we append
> /lib/modules/?!
> I use /usr/lib/modules/*.ko. How can I use depmod in that case?
> Add a "ln -s . 2.6.25.2" to that directory?
>
> Still: generated modprobe.conf is unusable...
len = strlen(deps) + (ptr != NULL);
+ // DVV TODO: strstr is evil. We can check the last 3 bytes on '.ko', the 'len' bytes and '/' separately.
+ // DVV TODO: slightly larger mb, but no malloc/sprintf needed!
Why is strstr evil again?
And why is it a good idea to increase the size needlessly?
We cannot check for '.ko' at the end for several reasons:
- The module can be an '.o'
- Regardless of 2.4 vs. 2.6 modules, it can potentially be compressed
via compress, gzip, bzip2, lzma (but this is probably a non-issue
since it will be decompressed already if we get here; we'll have to
adjust the extension beforehand in this case).
The basedir is documented as
-b basedir --basedir basedir
If your modules are not currently in the (normal) directory
/lib/modules/version, but in a staging area, you can specify
a basedir which is prepended to the directory name. This
basedir is stripped from the resulting modules.dep file, so
it is ready to be moved into the normal location.
you'd have to say
depmod -b /my/whatever 3.6.9
or, for only plip:
depmod -n -b /my/whatever 3.6.9 \
/my/whatever/lib/modules/3.6.9/kernel/drivers/net/plip.ko
Note that my copy of module-init-tools seems to get -n wrong:
plip depends on parport and we correctly print this, even with -n but
module-init-tools (3.3-pre4-2) does not.
I've improved it a little bit (see rev 22099). If it still endless-loops
(which indicated a thinko of mine that is fixed now) then please put a
tarball of your modules somewhere up and mail me the URL, please.
If it works now, then i'm interrested in the failures you see with modprobe;
--- modutils/modprobe.c (revision 22091)
+++ modutils/modprobe.c (working copy)
@@ -562,7 +559,7 @@ static int already_loaded(const char *na
fd = open("/proc/modules", O_RDONLY);
if (fd < 0)
- return -1;
+ bb_info_msg("%s -1", name), return -1;
while (reads(fd, line_buffer, sizeof(line_buffer))) {
char *p;
@@ -592,6 +589,7 @@ static int already_loaded(const char *na
}
done:
close(fd);
+ bb_info_msg("%s %d", name, ret);
return ret;
}
Please send me this output and/or a "bt f" from gdb for a binary
compiled with
$ make clean ; make EXTRA_CFLAGS="-O0 -g3 -ggdb3"
TIA for your help
More information about the busybox
mailing list