From: Vladimir 'phcoder' Serbinenko Date: Sat, 16 Oct 2010 22:35:14 +0000 (+0200) Subject: * util/grub-setup.c (setup): New parameter allow_floppy. X-Git-Tag: 1.99~379 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdf2ec9c8ceef98d8e4aca6c176f56514f4103ee;p=thirdparty%2Fgrub.git * 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. --- diff --git a/ChangeLog b/ChangeLog index b5c091ee1..4e0d4a81e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-10-17 Vladimir Serbinenko + + * 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 * util/grub-install.in: Handle partitionless disks. diff --git a/util/grub-install.in b/util/grub-install.in index 21ac20f8d..8b0f5ebe1 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -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 diff --git a/util/grub-setup.c b/util/grub-setup.c index ab0098468..8ab33590b 100644 --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -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 ();