From 25dd47804dc8f314ad2061c0d0a50e5827f1de51 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 27 Dec 2010 07:06:41 +0100 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ grub-core/loader/i386/bsd.c | 17 ++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c701a342..0e4a725a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-12-27 Vladimir Serbinenko + + 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 Handling of files of unknown size is currently limited. They can't be diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 91cae418c..84cf1a17f 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -521,6 +521,8 @@ grub_netbsd_list_modules (void) /* This function would be here but it's under different license. */ #include "bsd_pagetable.c" +static grub_uint32_t freebsd_bootdev, freebsd_biosdev; + static grub_err_t grub_freebsd_boot (void) { @@ -528,7 +530,6 @@ grub_freebsd_boot (void) grub_uint8_t *p, *p0; grub_addr_t p_target; grub_size_t p_size = 0; - grub_uint32_t bootdev, biosdev, unit, slice, part; grub_err_t err; grub_size_t tag_buf_len = 0; @@ -564,11 +565,7 @@ grub_freebsd_boot (void) bi.version = FREEBSD_BOOTINFO_VERSION; bi.length = sizeof (bi); - grub_bsd_get_device (&biosdev, &unit, &slice, &part); - bootdev = (FREEBSD_B_DEVMAGIC + ((slice + 1) << FREEBSD_B_SLICESHIFT) + - (unit << FREEBSD_B_UNITSHIFT) + (part << FREEBSD_B_PARTSHIFT)); - - bi.boot_device = biosdev; + bi.boot_device = freebsd_biosdev; p_size = 0; grub_env_iterate (iterate_env_count); @@ -741,7 +738,7 @@ grub_freebsd_boot (void) state.ebp = stack_target; stack[0] = entry; /* "Return" address. */ stack[1] = bootflags | FREEBSD_RB_BOOTINFO; - stack[2] = bootdev; + stack[2] = freebsd_bootdev; stack[3] = 0; stack[4] = 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) { + grub_uint32_t unit, slice, part; + kern_end = ALIGN_PAGE (kern_end); if (is_elf_kernel) { @@ -1414,6 +1413,10 @@ grub_cmd_freebsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) if (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); }