insmod: invalid module format with 2.6.27 kernel
Denys Vlasenko
vda.linux at googlemail.com
Sun Apr 12 23:30:41 UTC 2009
On Sunday 12 April 2009 22:04, Dallas Clement wrote:
> Hello All,
>
> I have been using busybox version 1.13.3 just fine with the linux kernel
> version 2.6.21.1. I recently upgraded my kernel to 2.6.27 and am now
> getting an error when I try to insert a kernel module. For example:
Can you provide strace log of "insmod /path/to/ext2.ko"?
> ext2: no symbol version for struct_module
>
> insmod: cannot insert '/lib/modules/2.6.27/ext2.ko': invalid module format
The message comes from modutils/insmod.c:
int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int insmod_main(int argc UNUSED_PARAM, char **argv)
{
...
rc = bb_init_module(filename, parse_cmdline_module_options(argv));
if (rc)
bb_error_msg("cannot insert '%s': %s", filename, moderror(rc));
"invalid module format" corresponds to errno == ENOEXEC.
And bb_init_module() is doing this:
int FAST_FUNC bb_init_module(const char *filename, const char *options)
{
size_t len = MAXINT(ssize_t);
char *image;
int rc = ENOENT;
#if ENABLE_FEATURE_2_4_MODULES
if (get_linux_version_code() < KERNEL_VERSION(2,6,0))
return bb_init_module_24(filename, options);
#endif
/* Use the 2.6 way */
image = xmalloc_open_zipped_read_close(filename, &len);
if (image) {
if (init_module(image, len, options) != 0)
rc = errno;
else
rc = 0;
free(image);
}
return rc;
}
As far as I see, it is rather straightforward and correct.
you may add this line
xwrite(xopen3("/tmp/dump", O_WRONLY, 0644), image, len);
directly after "image = xmalloc_open_zipped_read_close(...)"
to obtain the dump of read module and check that it is not
damaged by automatic compression detection:
/tmp/dump file should be exactly identical to your ext2.ko file.
--
vda
More information about the busybox
mailing list