2008-07-30 Robert Millan <rmh@aybabtu.com>

* kern/ieee1275/init.c (grub_machine_set_prefix): If `grub_prefix'
        is non-empty, use it to set the `prefix' environment variable instead
        of the usual approach.
        * kern/i386/linuxbios/init.c (make_install_device): Remove function.
        (grub_machine_set_prefix): Use `grub_prefix' to set the `prefix'
        environment variable instead of dummy make_install_device().

        * kern/i386/ieee1275/startup.S: Include `<grub/machine/kernel.h>'.
        (start): Insert a data section, with `grub_prefix' variable.
        * kern/i386/linuxbios/startup.S: Likewise.

        * include/grub/powerpc/ieee1275/kernel.h [!ASM_FILE] (grub_prefix):
        New variable reference.
        * include/grub/i386/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_PREFIX):
        New macro.  Defines offset of `grub_prefix' within startup.S (relative
        to `start').
        (GRUB_KERNEL_MACHINE_DATA_END): New macro.  Defines the end of data
        section within startup.S (relative to `start').
        * include/grub/i386/coreboot/kernel.h: Likewise.

        * util/elf/grub-mkimage.c (add_segments): Receive `prefix' parameter.
        Overwrite grub_prefix with its contents, at the beginning of the
        first segment.
        (main): Understand -p|--prefix.
This commit is contained in:
robertmh 2008-07-30 10:42:11 +00:00
parent 14f41dd1ed
commit ae88bca301
9 changed files with 142 additions and 13 deletions

View file

@ -19,6 +19,7 @@
#define ASM_FILE 1
#include <grub/symbol.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/cpu/linux.h>
#include <multiboot.h>
@ -38,6 +39,24 @@
start:
_start:
jmp codestart
/*
* This is a special data area at a fixed offset from the beginning.
*/
. = EXT_C(start) + GRUB_KERNEL_MACHINE_PREFIX
VARIABLE(grub_prefix)
/* to be filled by grub-mkimage */
/*
* Leave some breathing room for the prefix.
*/
. = EXT_C(start) + GRUB_KERNEL_MACHINE_DATA_END
codestart:
movl %eax, EXT_C(grub_ieee1275_entry_fn)
jmp EXT_C(grub_main)

View file

@ -78,12 +78,6 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
{
}
static char *
make_install_device (void)
{
return NULL;
}
void
grub_machine_init (void)
{
@ -155,7 +149,7 @@ void
grub_machine_set_prefix (void)
{
/* Initialize the prefix. */
grub_env_set ("prefix", make_install_device ());
grub_env_set ("prefix", grub_prefix);
}
void

View file

@ -19,6 +19,7 @@
#define ASM_FILE 1
#include <grub/symbol.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/cpu/linux.h>
#include <multiboot.h>
@ -35,6 +36,24 @@
.file "startup.S"
.text
.globl start, _start
start:
_start:
jmp codestart
/*
* This is a special data area at a fixed offset from the beginning.
*/
. = EXT_C(start) + GRUB_KERNEL_MACHINE_PREFIX
VARIABLE(grub_prefix)
/* to be filled by grub-mkimage */
/*
* Leave some breathing room for the prefix.
*/
. = EXT_C(start) + GRUB_KERNEL_MACHINE_DATA_END
#if 0
/*
@ -49,8 +68,7 @@ multiboot_header:
.long -0x1BADB002
#endif
start:
_start:
codestart:
/* initialize the stack */
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp

View file

@ -84,6 +84,13 @@ grub_machine_set_prefix (void)
/* We already set prefix in grub_machine_init(). */
return;
if (grub_prefix[0])
{
grub_env_set ("prefix", grub_prefix);
/* Prefix is hardcoded in the core image. */
return;
}
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
sizeof (bootpath), 0))
{