summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/doc/UPDATEMODULES71
-rw-r--r--mdk-stage1/modules.c66
-rw-r--r--mdk-stage1/modules.h1
-rw-r--r--mdk-stage1/stage1.c7
-rw-r--r--mdk-stage1/stage1.h4
-rw-r--r--mdk-stage1/tools.c2
6 files changed, 151 insertions, 0 deletions
diff --git a/mdk-stage1/doc/UPDATEMODULES b/mdk-stage1/doc/UPDATEMODULES
new file mode 100644
index 000000000..a20266e8f
--- /dev/null
+++ b/mdk-stage1/doc/UPDATEMODULES
@@ -0,0 +1,71 @@
+This is the documentation for the "Update Modules" (Update Drivers)
+feature.
+
+This feature aims to propose new modules or replacement modules for the
+install. This is useful when there is a firmware update for a given
+driver, an additional driver needed for something, etc.
+
+
+You must use a floppy disk with e2fs filesystem (NOT vfat/windows
+formatted). Use "mke2fs /dev/fd0" on your own box to format a floppy with
+e2fs filesystem.
+
+This disk may contain a number of kernel modules on the root (e.g. not in
+a subdirectory); some of them may replace existing modules, some of them
+may be added. This disk must contain a special file, named "to_load", on
+the root (not in a subdirectory). This file will contain a series of
+module names, with optional module options; the program will try to load
+all these modules one after another, using file on the floppy if present,
+else using file within standard module repository ("marfile" on the boot
+floppy). It can contain comments, these are strictly defined by the
+presence of a hash (#) character on row 0 of any line. Beware, on the
+first line of the line, a comment is mandatory (there is a bug somewhere).
+
+
+Here's a typical scenario:
+
+
+1. Boot the floppy (or cdrom) with the option "updatemodules"
+
+ (you may do that by pressing F1 then entering "linux updatemodules")
+
+
+2. At the very beginning of the User Interface, you are asked to insert
+ the Update Modules disk. Insert the Update Modules disk and press
+ Enter.
+
+--=----=----=----=----=----=----=----=----=--
+Our example disk contains:
+
+[root@obiwan mnt]# ll floppy/
+total 77
+drwxr-xr-x 2 root root 12288 Jul 26 12:02 lost+found/
+-rw-r--r-- 1 root root 9051 Jul 26 12:43 msdos.o
+-rw-r--r-- 1 root root 13660 Jul 26 12:04 ppa.o
+-rw-r--r-- 1 root root 54 Jul 26 12:46 to_load
+-rw-r--r-- 1 root root 32108 Jul 26 12:04 uhci.o
+-rw-r--r-- 1 root root 6572 Jul 26 12:04 wacom.o
+[root@obiwan mnt]# cat floppy/to_load
+# Update Drivers description file
+3c59x
+# fat is a dep for msdos
+fat
+# updated msdos (handling of 9+4 filenames)
+msdos
+ppa
+[root@obiwan mnt]#
+--=----=----=----=----=----=----=----=----=--
+
+
+3. The program reads the special file "to_load" and processes the files.
+
+ a- 3c59x loaded from the marfile on the boot floppy
+ b- fat loaded from the marfile on the boot floppy
+ c- msdos loaded from the update modules floppy
+ d- ppa loaded from the update modules floppy
+
+
+
+Beware, the dependencies are not handled automatically in the case of load
+from the update modules floppy, that's why on our example we need to load
+"fat" from the standard modules before "msdos" from the update floppy.
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 31d20bbaa..fac10ba47 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/mount.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
@@ -30,6 +31,7 @@
#include "log.h"
#include "mar/mar-extract-only.h"
#include "frontend.h"
+#include "mount.h"
#include "modules_descr.h"
#include "modules.h"
@@ -375,3 +377,67 @@ enum return_type ask_insmod(enum driver_type type)
} else
return results;
}
+
+
+void update_modules(void)
+{
+ FILE * f;
+ char ** disk_contents;
+ char final_name[500];
+ char floppy_mount_location[] = "/tmp/floppy";
+
+ stg1_info_message("Please insert the Update Modules disk.");;
+
+ my_insmod("floppy", ANY_DRIVER_TYPE, NULL);
+
+ if (my_mount("/dev/fd0", floppy_mount_location, "ext2") == -1) {
+ stg1_error_message("I can't find a Linux ext2 floppy in first floppy drive.");
+ return update_modules();
+ }
+
+ disk_contents = list_directory(floppy_mount_location);
+
+ if (!(f = fopen("/tmp/floppy/to_load", "rb"))) {
+ stg1_error_message("I can't find \"to_load\" file.");
+ umount(floppy_mount_location);
+ return update_modules();
+ }
+ while (1) {
+ char module[500];
+ char * options;
+ char ** entry = disk_contents;
+
+ if (!fgets(module, sizeof(module), f)) break;
+ if (module[0] == '#' || strlen(module) == 0)
+ continue;
+
+ while (module[strlen(module)-1] == '\n')
+ module[strlen(module)-1] = '\0';
+ options = strchr(module, ' ');
+ if (options) {
+ options[0] = '\0';
+ options++;
+ }
+
+ log_message("updatemodules: (%s) (%s)", module, options);
+ while (entry && *entry) {
+ if (!strncmp(*entry, module, strlen(module)) && (*entry)[strlen(module)] == '.') {
+ sprintf(final_name, "%s/%s", floppy_mount_location, *entry);
+ if (insmod_call(final_name, options)) {
+ log_message("\t%s (floppy): failed", *entry);
+ stg1_error_message("Insmod %s (floppy) failed.", *entry);
+ }
+ break;
+ }
+ entry++;
+ }
+ if (!entry || !*entry) {
+ enum insmod_return ret = my_insmod(module, ANY_DRIVER_TYPE, options);
+ if (ret != INSMOD_OK) {
+ log_message("\t%s (marfile): failed", module);
+ stg1_error_message("Insmod %s (marfile) failed.", module);
+ }
+ }
+ }
+ fclose(f);
+}
diff --git a/mdk-stage1/modules.h b/mdk-stage1/modules.h
index 9ed992033..bbbac2ef5 100644
--- a/mdk-stage1/modules.h
+++ b/mdk-stage1/modules.h
@@ -23,6 +23,7 @@ enum insmod_return { INSMOD_OK, INSMOD_FAILED, INSMOD_FAILED_FILE_NOT_FOUND };
void init_modules_insmoding(void);
enum insmod_return my_insmod(const char * mod_name, enum driver_type type, char * options);
enum return_type ask_insmod(enum driver_type);
+void update_modules(void);
struct module_deps_elem {
char * name;
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 432fc7194..85520e6a8 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -379,8 +379,15 @@ int main(int argc, char **argv, char **env)
if (IS_EXPERT)
expert_third_party_modules();
+ if (IS_UPDATEMODULES)
+ update_modules();
+
handle_pcmcia(&pcmcia_adapter);
+ if (IS_CHANGEDISK)
+ stg1_info_message("You are starting the installation with an alternate booting method. "
+ "Please change your disk, and insert the Installation disk.");
+
ret = method_select_and_prepare();
finish_frontend();
diff --git a/mdk-stage1/stage1.h b/mdk-stage1/stage1.h
index a9ca99b32..431e10600 100644
--- a/mdk-stage1/stage1.h
+++ b/mdk-stage1/stage1.h
@@ -37,6 +37,8 @@ extern char * interactive_fifo;
#define MODE_AUTOMATIC (1 << 4)
#define MODE_SPECIAL_STAGE2 (1 << 8)
#define MODE_RAMDISK (1 << 9)
+#define MODE_CHANGEDISK (1 << 10)
+#define MODE_UPDATEMODULES (1 << 11)
#define IS_TESTING (get_param(MODE_TESTING))
#define IS_EXPERT (get_param(MODE_EXPERT))
@@ -44,6 +46,8 @@ extern char * interactive_fifo;
#define IS_AUTOMATIC (get_param(MODE_AUTOMATIC))
#define IS_SPECIAL_STAGE2 (get_param(MODE_SPECIAL_STAGE2))
#define IS_RAMDISK (get_param(MODE_RAMDISK))
+#define IS_CHANGEDISK (get_param(MODE_CHANGEDISK))
+#define IS_UPDATEMODULES (get_param(MODE_UPDATEMODULES))
void fatal_error(char *msg) __attribute__ ((noreturn));
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index 05ec58f92..a60c53404 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -87,6 +87,8 @@ void process_cmdline(void)
params[param_number].value = value;
param_number++;
if (!strcmp(name, "expert")) set_param(MODE_EXPERT);
+ if (!strcmp(name, "changedisk")) set_param(MODE_CHANGEDISK);
+ if (!strcmp(name, "updatemodules")) set_param(MODE_UPDATEMODULES);
if (!strcmp(name, "rescue")) set_param(MODE_RESCUE);
if (!strcmp(name, "special_stage2")) set_param(MODE_SPECIAL_STAGE2);
if (!strcmp(name, "automatic")) {