]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-setup.c (setup): New parameter allow_floppy.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 16 Oct 2010 22:35:14 +0000 (00:35 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 16 Oct 2010 22:35:14 +0000 (00:35 +0200)
(arguments): New member allow_floppy.
(argp_parser): Handle --allow-floppy.
(main): Pass allow_floppy.
* util/grub-install.in: New option --allow-floppy passed though to
grub-setup.

ChangeLog
util/grub-install.in
util/grub-setup.c

index b5c091ee185b6a62f3cd557062af0f5a04bdb3a7..4e0d4a81e5bbb586107e8a6fb8d874159b355ffd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub-setup.c (setup): New parameter allow_floppy.
+       (arguments): New member allow_floppy.
+       (argp_parser): Handle --allow-floppy.
+       (main): Pass allow_floppy.
+       * util/grub-install.in: New option --allow-floppy passed though to
+       grub-setup.
+
 2010-10-17  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub-install.in: Handle partitionless disks.
index 21ac20f8d44da7830fb6393e6653953fe4e507a6..8b0f5ebe12685e11508e3c02f71a23cd6ff20935 100644 (file)
@@ -107,6 +107,8 @@ Install GRUB on your drive.
   --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
   --grub-probe=FILE       use FILE as grub-probe
   --no-floppy             do not probe any floppy drive
+  --allow-floppy          Make the drive also bootable as floppy 
+                          (default for fdX devices). May break on some BIOSes.
   --recheck               probe a device map even if it already exists
   --force                 install even if problems are detected
 EOF
@@ -148,6 +150,8 @@ argument () {
   echo $1
 }
 
+allow_floppy=""
+
 # Check the arguments.
 while test $# -gt 0
 do
@@ -221,6 +225,9 @@ do
     --removable)
        removable=yes ;;
 
+    --allow-floppy)
+       allow_floppy="--allow-floppy" ;;
+
     --disk-module)
        if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
            disk_module=`argument $option "$@"`; shift;
@@ -576,7 +583,7 @@ fi
 # Perform the platform-dependent install
 if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
     # Now perform the installation.
-    $grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} \
+    $grub_setup ${allow_floppy} ${setup_verbose} ${setup_force} --directory=${grubdir} \
        --device-map=${device_map} ${install_device} || exit 1
 elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
     if [ x"$update_nvram" = xyes ]; then
index ab0098468b5ea93e9488b6dcc37384f595d132d0..8ab33590b01b79bb3e53501a79e54319776b8efd 100644 (file)
@@ -177,7 +177,7 @@ static void
 setup (const char *dir,
        const char *boot_file, const char *core_file,
        const char *root, const char *dest, int must_embed, int force,
-       int fs_probe)
+       int fs_probe, int allow_floppy)
 {
   char *boot_path, *core_path, *core_path_dev, *core_path_dev_full;
   char *boot_img, *core_img;
@@ -313,7 +313,7 @@ setup (const char *dir,
     /* If DEST_DRIVE is a hard disk, enable the workaround, which is
        for buggy BIOSes which don't pass boot drive correctly. Instead,
        they pass 0x00 or 0x01 even when booted from 0x80.  */
-    if (!grub_util_biosdisk_is_floppy (dest_dev->disk))
+    if (!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk))
       /* Replace the jmp (2 bytes) with double nop's.  */
       *boot_drive_check = 0x9090;
   }
@@ -678,6 +678,9 @@ static struct argp_option options[] = {
    N_("Do not probe for filesystems in DEVICE"), 0},
   {"verbose",     'v', 0,      0,
    N_("Print verbose messages."), 0},
+  {"allow-floppy", 'a', 0,      0,
+   N_("Make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes."), 0},
+
   { 0, 0, 0, 0, 0, 0 }
 };
 
@@ -712,6 +715,7 @@ struct arguments
   char *root_dev;
   int  force;
   int  fs_probe;
+  int allow_floppy;
   char *device;
 };
 
@@ -737,6 +741,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
 
   switch (key)
     {
+      case 'a':
+        arguments->allow_floppy = 1;
+        break;
+
       case 'b':
         if (arguments->boot_file)
           free (arguments->boot_file);
@@ -950,7 +958,8 @@ main (int argc, char *argv[])
                  arguments.boot_file ? : DEFAULT_BOOT_FILE,
                  arguments.core_file ? : DEFAULT_CORE_FILE,
                  root_dev, grub_util_get_grub_dev (devicelist[i]), 1,
-                 arguments.force, arguments.fs_probe);
+                 arguments.force, arguments.fs_probe,
+                arguments.allow_floppy);
         }
     }
   else
@@ -959,7 +968,8 @@ main (int argc, char *argv[])
     setup (arguments.dir ? : DEFAULT_DIRECTORY,
            arguments.boot_file ? : DEFAULT_BOOT_FILE,
            arguments.core_file ? : DEFAULT_CORE_FILE,
-           root_dev, dest_dev, must_embed, arguments.force, arguments.fs_probe);
+           root_dev, dest_dev, must_embed, arguments.force,
+          arguments.fs_probe, arguments.allow_floppy);
 
   /* Free resources.  */
   grub_fini_all ();