hi, I make a 32 bits LFS system with the SVN-20120623 book.
kmod-9 testsuite fail , but i found the solution in that thread : http://www.spinics.net/lists/linux-modules/msg00795.html with this path, the kmod-9 testsuite is ok : --- kmod-9.orig/testsuite/init_module.c +++ kmod-9/testsuite/init_module.c @@ -142,12 +142,17 @@ static int create_sysfs_files(const char char buf[PATH_MAX]; const char *sysfsmod = "/sys/module/"; int len = strlen(sysfsmod); + int err = 0; memcpy(buf, sysfsmod, len); strcpy(buf + len, modname); len += strlen(modname); - assert(mkdir_p(buf, 0755) >= 0); + // this fails on 32bit systems, we can't use assert + // assert(mkdir_p(buf, 0755) >= 0); + err = mkdir_p(buf, 0755); + printf("err: %d\n", err); + assert(err >= 0); strcpy(buf + len, "/initstate"); return write_one_line_file(buf, "live\n", strlen("live\n")); --- a/testsuite/init_module.c +++ b/testsuite/init_module.c @@ -16,6 +16,7 @@ */ #include <assert.h> +#include <elf.h> #include <errno.h> #include <dirent.h> #include <fcntl.h> @@ -206,6 +207,12 @@ static inline bool module_is_inkernel(const char *modname) return ret; } +static uint8_t elf_identify(void *mem) +{ + uint8_t *p = mem; + return p[EI_CLASS]; +} + TS_EXPORT long init_module(void *mem, unsigned long len, const char *args); /* @@ -225,6 +232,8 @@ long init_module(void *mem, unsigned long len,const char *args) const void *buf; uint64_t bufsize; int err; + uint8_t class; + off_t offset; init_retcodes(); @@ -236,14 +245,18 @@ long init_module(void *mem, unsigned long len,const char *args) &bufsize); kmod_elf_unref(elf); - /* - * We couldn't find the module's name inside the ELF file. Just exit - * as if it was successful - */ + /* We couldn't parse the ELF file. Just exit as if it was successful */ if (err < 0) return 0; - modname = (char *)buf + offsetof(struct module, name); + /* We need to open both 32 and 64 bits module - hack! */ + class = elf_identify(mem); + if (class == ELFCLASS64) + offset = MODULE_NAME_OFFSET_64; + else + offset = MODULE_NAME_OFFSET_32; + + modname = (char *)buf + offset; mod = find_module(modules, modname); if (mod != NULL) { errno = mod->errcode; --- a/testsuite/stripped-module.h +++ b/testsuite/stripped-module.h @@ -13,6 +13,7 @@ struct list_head { }; #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) + struct module { enum module_state state; @@ -24,4 +25,8 @@ struct module char name[MODULE_NAME_LEN]; }; +/* padding */ +#define MODULE_NAME_OFFSET_64 4 + 4 + 2 * 8 +#define MODULE_NAME_OFFSET_32 4 + 2 * 4 + #endif Best Regards Denis -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page