summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-11 22:48:37 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-11 22:48:37 +0000
commita362aa0eaba743533a647efe1be718faa3fcac88 (patch)
treefa1059e9cde2c2fdaabd07d9fbb41b9e8d107266
parentb12399dd1e6beaa950e8d53b11e3a41648693c29 (diff)
downloaddrakx-a362aa0eaba743533a647efe1be718faa3fcac88.tar
drakx-a362aa0eaba743533a647efe1be718faa3fcac88.tar.gz
drakx-a362aa0eaba743533a647efe1be718faa3fcac88.tar.bz2
drakx-a362aa0eaba743533a647efe1be718faa3fcac88.tar.xz
drakx-a362aa0eaba743533a647efe1be718faa3fcac88.zip
polish generic blank.img situation (no modules and/or modules.dep available)
-rw-r--r--mdk-stage1/modules.c42
-rw-r--r--mdk-stage1/modules.h3
-rw-r--r--mdk-stage1/stage1.c3
3 files changed, 25 insertions, 23 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index ddb5c6a4c..ee99374da 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -32,20 +32,9 @@ static struct module_deps_elem * modules_deps = NULL;
static char * archive_name = "/modules/modules.mar";
static struct mar_stream s = { 0, NULL, NULL };
+static int disable_modules = 0;
-static int ensure_archive_opened(void)
-{
- /* don't consume too much memory */
- if (s.first_element == NULL) {
- if (mar_open_file(archive_name, &s) != 0) {
- log_message("open marfile failed");
- return -1;
- }
- }
- return 0;
-}
-
/* unarchive and insmod given module
* WARNING: module must not contain the trailing ".o"
*/
@@ -55,9 +44,6 @@ static int insmod_archived_file(const char * mod_name, char * options)
char final_name[50] = "/tmp/";
int i, rc;
- if (ensure_archive_opened() == -1)
- return -1;
-
strncpy(module_name, mod_name, sizeof(module_name));
strcat(module_name, ".o");
i = mar_extract_file(&s, module_name, "/tmp/");
@@ -80,7 +66,7 @@ static int insmod_archived_file(const char * mod_name, char * options)
-int load_modules_dependencies(void)
+static int load_modules_dependencies(void)
{
char * deps_file = "/modules/modules.dep";
char * buf, * ptr, * start, * end;
@@ -167,6 +153,15 @@ int load_modules_dependencies(void)
}
+void init_modules_insmoding(void)
+{
+ if (load_modules_dependencies() || mar_open_file(archive_name, &s)) {
+ log_message("warning, error initing modules stuff, modules loading disabled");
+ disable_modules = 1;
+ }
+}
+
+
static void add_modules_conf(char * str)
{
static char data[500] = "";
@@ -225,10 +220,19 @@ int my_insmod(const char * mod_name, enum driver_type type, char * options)
#endif
#ifndef DISABLE_NETWORK
char ** net_devices = NULL; /* fucking compiler */
+#endif
+
+ log_message("have to insmod %s", mod_name);
+
+ if (disable_modules) {
+ log_message("\tdisabled");
+ return 0;
+ }
+
+#ifndef DISABLE_NETWORK
if (type == NETWORK_DEVICES)
net_devices = get_net_devices();
#endif
- log_message("have to insmod %s", mod_name);
if (IS_TESTING)
return 0;
@@ -312,8 +316,8 @@ enum return_type ask_insmod(enum driver_type type)
else
return RETURN_ERROR;
- if (ensure_archive_opened() == -1)
- return -1;
+ if (disable_modules)
+ return RETURN_BACK;
snprintf(msg, sizeof(msg), "Which driver should I try to gain %s access?", mytype);
diff --git a/mdk-stage1/modules.h b/mdk-stage1/modules.h
index db90d832d..74ecc8a57 100644
--- a/mdk-stage1/modules.h
+++ b/mdk-stage1/modules.h
@@ -18,9 +18,8 @@
#include "stage1.h"
#include "probing.h"
-int load_modules_dependencies(void);
+void init_modules_insmoding(void);
int my_insmod(const char * mod_name, enum driver_type type, char * options);
-
enum return_type ask_insmod(enum driver_type);
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 818e8458c..6da2b5ad6 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -191,8 +191,7 @@ int main(int argc, char **argv, char **env)
process_cmdline();
handle_env(env);
spawn_shell();
- if (load_modules_dependencies())
- log_message("warning, could not open and parse modules dependencies");
+ init_modules_insmoding();
init_frontend();
ret = method_select_and_prepare();