* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): New
function. * include/grub/emu/hostdisk.h (grub_util_biosdisk_is_floppy): New proto. * util/grub-setup.c (setup): Use grub_util_biosdisk_is_floppy.
This commit is contained in:
parent
2b94e3ff6e
commit
f00478b719
4 changed files with 36 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2010-09-15 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): New
|
||||||
|
function.
|
||||||
|
* include/grub/emu/hostdisk.h (grub_util_biosdisk_is_floppy): New proto.
|
||||||
|
* util/grub-setup.c (setup): Use grub_util_biosdisk_is_floppy.
|
||||||
|
|
||||||
2010-09-15 Yves Blusseau <blusseau@zetam.org>
|
2010-09-15 Yves Blusseau <blusseau@zetam.org>
|
||||||
|
|
||||||
Add function to get completions from usage.
|
Add function to get completions from usage.
|
||||||
|
|
|
@ -1575,3 +1575,29 @@ grub_util_biosdisk_get_osdev (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
return map[disk->id].device;
|
return map[disk->id].device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
grub_util_biosdisk_is_floppy (grub_disk_t disk)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = open (map[disk->id].device, O_RDONLY);
|
||||||
|
/* Shouldn't happen. */
|
||||||
|
if (fd == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Shouldn't happen either. */
|
||||||
|
if (fstat (fd, &st) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
if (major(st.st_rdev) == RAW_FLOPPY_MAJOR)
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (major(st.st_rdev) == FLOPPY_MAJOR)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -27,5 +27,6 @@ void grub_util_biosdisk_fini (void);
|
||||||
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
||||||
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
||||||
int grub_util_biosdisk_is_present (const char *name);
|
int grub_util_biosdisk_is_present (const char *name);
|
||||||
|
int grub_util_biosdisk_is_floppy (grub_disk_t disk);
|
||||||
|
|
||||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
||||||
|
|
|
@ -339,7 +339,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 (dest_dev->disk->id & 0x80)
|
if (!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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue