diff options
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/modules.c | 3 | ||||
-rw-r--r-- | mdk-stage1/stage1.c | 2 | ||||
-rw-r--r-- | mdk-stage1/tools.c | 22 |
3 files changed, 22 insertions, 5 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index 719e98ca1..201302603 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -104,7 +104,6 @@ static enum return_type ensure_additional_modules_available(void) retry: stg1_info_message("Please insert the Additional Drivers floppy.");; - my_insmod("floppy", ANY_DRIVER_TYPE, NULL, 0); while (my_mount(floppy_device(), floppy_mount_location, "ext2", 0) == -1) { enum return_type results = ask_yes_no(errno == ENXIO ? @@ -537,8 +536,6 @@ void update_modules(void) stg1_info_message("Please insert the Update Modules floppy.");; - my_insmod("floppy", ANY_DRIVER_TYPE, NULL, 0); - if (my_mount(floppy_device(), floppy_mount_location, "ext2", 0) == -1) { enum return_type results = ask_yes_no("I can't find a Linux ext2 floppy in first floppy drive.\n" "Retry?"); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index c5452ce90..fe933684c 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -230,8 +230,6 @@ static void expert_third_party_modules(void) if (results != RETURN_OK) return; - my_insmod("floppy", ANY_DRIVER_TYPE, NULL, 0); - if (my_mount(floppy_device(), floppy_mount_location, "ext2", 0) == -1) { stg1_error_message("I can't find a Linux ext2 floppy in first floppy drive."); return expert_third_party_modules(); diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index e3a0fa479..dbbd45772 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -35,6 +35,8 @@ #include <sys/poll.h> #include <errno.h> #include <sys/utsname.h> +#include <sys/ioctl.h> +#include <linux/fd.h> #include "stage1.h" #include "log.h" #include "mount.h" @@ -480,6 +482,26 @@ int kernel_version(void) char * floppy_device(void) { char ** names, ** models; + my_insmod("floppy", ANY_DRIVER_TYPE, NULL, 0); + int fd = open("/dev/fd0", O_RDONLY|O_NONBLOCK); + if (fd != -1) { + char drivtyp[17]; + if (!ioctl(fd, FDGETDRVTYP, (void *)drivtyp)) { + struct floppy_drive_struct ds; + log_message("/dev/fd0 type: %s", drivtyp); + if (!ioctl(fd, FDPOLLDRVSTAT, &ds)) { + log_message("\ttrack: %d", ds.track); + if (ds.track >= 0) { + close(fd); + return "/dev/fd0"; + } + } + } else { + log_perror("can't FDGETDRVTYP /dev/fd0"); + } + close(fd); + } + log_message("seems that you don't have a regular floppy drive"); my_insmod("sd_mod", ANY_DRIVER_TYPE, NULL, 0); get_medias(FLOPPY, &names, &models, BUS_ANY); if (names && *names) |