diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-02-11 18:34:32 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-02-11 18:34:32 +0000 |
commit | 114615143847c3f9fe57bf6f30f553a2ac34b11e (patch) | |
tree | 87c343a876ff226b6b13a823ad73e2327bccfee6 | |
parent | 2c7c203fd98a9e2b6d31b15e2d13cbf7ec0df605 (diff) | |
download | drakx-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar drakx-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.gz drakx-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.bz2 drakx-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.xz drakx-114615143847c3f9fe57bf6f30f553a2ac34b11e.zip |
switch to modules from /lib/modules/`uname -r`, modules.dep containing full filename
-rw-r--r-- | mdk-stage1/modules.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index db0498397..2b55e5b75 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -30,6 +30,7 @@ #include <string.h> #include <stdio.h> #include <errno.h> +#include <sys/utsname.h> #include "log.h" #include "utils.h" #include "frontend.h" @@ -109,7 +110,14 @@ static char *filename2modname(char * filename) { static void find_modules_directory(void) { - strcpy(modules_directory, "/modules"); + struct utsname kernel_uname; + char * prefix = "/lib/modules"; + char * release; + if (uname(&kernel_uname)) { + fatal_error("uname failed"); + } + release = kernel_uname.release; + sprintf(modules_directory , "%s/%s", prefix, release); } static int load_modules_dependencies(void) @@ -306,8 +314,7 @@ static enum insmod_return insmod_with_deps(const char * mod_name, char * options log_message("needs %s", filename); { - char *file = asprintf_("%s/%s%s", modules_directory, filename, kernel_module_extension()); - return insmod_local_file(file, options); + return insmod_local_file((char *) filename, options); } } @@ -402,7 +409,8 @@ enum return_type ask_insmod(enum driver_type type) { enum return_type results; char * choice; - char ** dlist = list_directory(modules_directory); + char * modules_dir = asprintf_("%s/kernel", modules_directory); + char ** dlist = list_directory(modules_dir); char ** modules = alloca(sizeof(char *) * (string_array_length(dlist) + 1)); char ** descrs = alloca(sizeof(char *) * (string_array_length(dlist) + 1)); char ** p_dlist = dlist; |