summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-02-11 18:34:32 +0000
committerOlivier Blin <oblin@mandriva.com>2008-02-11 18:34:32 +0000
commit114615143847c3f9fe57bf6f30f553a2ac34b11e (patch)
tree87c343a876ff226b6b13a823ad73e2327bccfee6 /mdk-stage1
parent2c7c203fd98a9e2b6d31b15e2d13cbf7ec0df605 (diff)
downloaddrakx-backup-do-not-use-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar
drakx-backup-do-not-use-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.gz
drakx-backup-do-not-use-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.bz2
drakx-backup-do-not-use-114615143847c3f9fe57bf6f30f553a2ac34b11e.tar.xz
drakx-backup-do-not-use-114615143847c3f9fe57bf6f30f553a2ac34b11e.zip
switch to modules from /lib/modules/`uname -r`, modules.dep containing full filename
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/modules.c16
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;