* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-10-17 00:35:14 +02:00
parent 861dfd4cb2
commit fdf2ec9c8c
3 changed files with 31 additions and 5 deletions

View file

@ -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> 2010-10-17 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Handle partitionless disks. * util/grub-install.in: Handle partitionless disks.

View file

@ -107,6 +107,8 @@ Install GRUB on your drive.
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
--grub-probe=FILE use FILE as grub-probe --grub-probe=FILE use FILE as grub-probe
--no-floppy do not probe any floppy drive --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 --recheck probe a device map even if it already exists
--force install even if problems are detected --force install even if problems are detected
EOF EOF
@ -148,6 +150,8 @@ argument () {
echo $1 echo $1
} }
allow_floppy=""
# Check the arguments. # Check the arguments.
while test $# -gt 0 while test $# -gt 0
do do
@ -221,6 +225,9 @@ do
--removable) --removable)
removable=yes ;; removable=yes ;;
--allow-floppy)
allow_floppy="--allow-floppy" ;;
--disk-module) --disk-module)
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
disk_module=`argument $option "$@"`; shift; disk_module=`argument $option "$@"`; shift;
@ -576,7 +583,7 @@ fi
# Perform the platform-dependent install # Perform the platform-dependent install
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
# Now perform the installation. # 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 --device-map=${device_map} ${install_device} || exit 1
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
if [ x"$update_nvram" = xyes ]; then if [ x"$update_nvram" = xyes ]; then

View file

@ -177,7 +177,7 @@ static void
setup (const char *dir, setup (const char *dir,
const char *boot_file, const char *core_file, const char *boot_file, const char *core_file,
const char *root, const char *dest, int must_embed, int force, 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_path, *core_path, *core_path_dev, *core_path_dev_full;
char *boot_img, *core_img; 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 /* If DEST_DRIVE is a hard disk, enable the workaround, which is
for buggy BIOSes which don't pass boot drive correctly. Instead, for buggy BIOSes which don't pass boot drive correctly. Instead,
they pass 0x00 or 0x01 even when booted from 0x80. */ 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. */ /* Replace the jmp (2 bytes) with double nop's. */
*boot_drive_check = 0x9090; *boot_drive_check = 0x9090;
} }
@ -678,6 +678,9 @@ static struct argp_option options[] = {
N_("Do not probe for filesystems in DEVICE"), 0}, N_("Do not probe for filesystems in DEVICE"), 0},
{"verbose", 'v', 0, 0, {"verbose", 'v', 0, 0,
N_("Print verbose messages."), 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 } { 0, 0, 0, 0, 0, 0 }
}; };
@ -712,6 +715,7 @@ struct arguments
char *root_dev; char *root_dev;
int force; int force;
int fs_probe; int fs_probe;
int allow_floppy;
char *device; char *device;
}; };
@ -737,6 +741,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
switch (key) switch (key)
{ {
case 'a':
arguments->allow_floppy = 1;
break;
case 'b': case 'b':
if (arguments->boot_file) if (arguments->boot_file)
free (arguments->boot_file); free (arguments->boot_file);
@ -950,7 +958,8 @@ main (int argc, char *argv[])
arguments.boot_file ? : DEFAULT_BOOT_FILE, arguments.boot_file ? : DEFAULT_BOOT_FILE,
arguments.core_file ? : DEFAULT_CORE_FILE, arguments.core_file ? : DEFAULT_CORE_FILE,
root_dev, grub_util_get_grub_dev (devicelist[i]), 1, root_dev, grub_util_get_grub_dev (devicelist[i]), 1,
arguments.force, arguments.fs_probe); arguments.force, arguments.fs_probe,
arguments.allow_floppy);
} }
} }
else else
@ -959,7 +968,8 @@ main (int argc, char *argv[])
setup (arguments.dir ? : DEFAULT_DIRECTORY, setup (arguments.dir ? : DEFAULT_DIRECTORY,
arguments.boot_file ? : DEFAULT_BOOT_FILE, arguments.boot_file ? : DEFAULT_BOOT_FILE,
arguments.core_file ? : DEFAULT_CORE_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. */ /* Free resources. */
grub_fini_all (); grub_fini_all ();