Don't use disk subsystem in freebsd_boot.

* grub-core/loader/i386/bsd.c (freebsd_bootdev): New variable.
	(freebsd_biosdev): Likewise.
	(grub_freebsd_boot): Use freebsd_bootdev and freebsd_biosdev.
	(grub_cmd_freebsd): Set freebsd_bootdev and freebsd_biosdev.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-27 07:06:41 +01:00
parent 0b2db94300
commit 25dd47804d
2 changed files with 19 additions and 7 deletions

View file

@ -1,3 +1,12 @@
2010-12-27 Vladimir Serbinenko <phcoder@gmail.com>
Don't use disk subsystem in freebsd_boot.
* grub-core/loader/i386/bsd.c (freebsd_bootdev): New variable.
(freebsd_biosdev): Likewise.
(grub_freebsd_boot): Use freebsd_bootdev and freebsd_biosdev.
(grub_cmd_freebsd): Set freebsd_bootdev and freebsd_biosdev.
2010-12-26 Vladimir Serbinenko <phcoder@gmail.com> 2010-12-26 Vladimir Serbinenko <phcoder@gmail.com>
Handling of files of unknown size is currently limited. They can't be Handling of files of unknown size is currently limited. They can't be

View file

@ -521,6 +521,8 @@ grub_netbsd_list_modules (void)
/* This function would be here but it's under different license. */ /* This function would be here but it's under different license. */
#include "bsd_pagetable.c" #include "bsd_pagetable.c"
static grub_uint32_t freebsd_bootdev, freebsd_biosdev;
static grub_err_t static grub_err_t
grub_freebsd_boot (void) grub_freebsd_boot (void)
{ {
@ -528,7 +530,6 @@ grub_freebsd_boot (void)
grub_uint8_t *p, *p0; grub_uint8_t *p, *p0;
grub_addr_t p_target; grub_addr_t p_target;
grub_size_t p_size = 0; grub_size_t p_size = 0;
grub_uint32_t bootdev, biosdev, unit, slice, part;
grub_err_t err; grub_err_t err;
grub_size_t tag_buf_len = 0; grub_size_t tag_buf_len = 0;
@ -564,11 +565,7 @@ grub_freebsd_boot (void)
bi.version = FREEBSD_BOOTINFO_VERSION; bi.version = FREEBSD_BOOTINFO_VERSION;
bi.length = sizeof (bi); bi.length = sizeof (bi);
grub_bsd_get_device (&biosdev, &unit, &slice, &part); bi.boot_device = freebsd_biosdev;
bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
bi.boot_device = biosdev;
p_size = 0; p_size = 0;
grub_env_iterate (iterate_env_count); grub_env_iterate (iterate_env_count);
@ -741,7 +738,7 @@ grub_freebsd_boot (void)
state.ebp = stack_target; state.ebp = stack_target;
stack[0] = entry; /* "Return" address. */ stack[0] = entry; /* "Return" address. */
stack[1] = bootflags | FREEBSD_RB_BOOTINFO; stack[1] = bootflags | FREEBSD_RB_BOOTINFO;
stack[2] = bootdev; stack[2] = freebsd_bootdev;
stack[3] = 0; stack[3] = 0;
stack[4] = 0; stack[4] = 0;
stack[5] = 0; stack[5] = 0;
@ -1371,6 +1368,8 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE) if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
{ {
grub_uint32_t unit, slice, part;
kern_end = ALIGN_PAGE (kern_end); kern_end = ALIGN_PAGE (kern_end);
if (is_elf_kernel) if (is_elf_kernel)
{ {
@ -1414,6 +1413,10 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (err) if (err)
return err; return err;
} }
grub_bsd_get_device (&freebsd_biosdev, &unit, &slice, &part);
freebsd_bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) +
(unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT));
grub_loader_set (grub_freebsd_boot, grub_bsd_unload, 0); grub_loader_set (grub_freebsd_boot, grub_bsd_unload, 0);
} }