2009-08-10 Robert Millan <rmh.grub@aybabtu.com>

* include/grub/i386/bsd.h (KERNEL_TYPE_NONE, KERNEL_TYPE_FREEBSD)
        (KERNEL_TYPE_OPENBSD, KERNEL_TYPE_NETBSD): Convert to ...
        (bsd_kernel_types): ... this enum.

        * loader/i386/bsd.c (grub_cmd_freebsd_loadenv, grub_cmd_freebsd_module)
        (grub_cmd_freebsd_module_elf): Abort with "You need to load the
        kernel first." when `kernel_type' is set to KERNEL_TYPE_NONE.

        (grub_bsd_load_aout, grub_bsd_load, grub_cmd_freebsd_loadenv)
        (grub_cmd_freebsd_module, grub_cmd_freebsd_module_elf)
        (GRUB_MOD_INIT (bsd)): Fix capitalization in a few error
        messages.
This commit is contained in:
robertmh 2009-08-10 15:42:39 +00:00
parent f5d35e7a4b
commit 81623db677
3 changed files with 53 additions and 23 deletions

View file

@ -1,3 +1,18 @@
2009-08-10 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/bsd.h (KERNEL_TYPE_NONE, KERNEL_TYPE_FREEBSD)
(KERNEL_TYPE_OPENBSD, KERNEL_TYPE_NETBSD): Convert to ...
(bsd_kernel_types): ... this enum.
* loader/i386/bsd.c (grub_cmd_freebsd_loadenv, grub_cmd_freebsd_module)
(grub_cmd_freebsd_module_elf): Abort with "You need to load the
kernel first." when `kernel_type' is set to KERNEL_TYPE_NONE.
(grub_bsd_load_aout, grub_bsd_load, grub_cmd_freebsd_loadenv)
(grub_cmd_freebsd_module, grub_cmd_freebsd_module_elf)
(GRUB_MOD_INIT (bsd)): Fix capitalization in a few error
messages.
2009-08-08 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-dumpdevtree: Moved from here ...

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,10 +21,13 @@
#include <grub/types.h>
#define KERNEL_TYPE_NONE 0
#define KERNEL_TYPE_FREEBSD 1
#define KERNEL_TYPE_OPENBSD 2
#define KERNEL_TYPE_NETBSD 3
enum bsd_kernel_types
{
KERNEL_TYPE_NONE,
KERNEL_TYPE_FREEBSD,
KERNEL_TYPE_OPENBSD,
KERNEL_TYPE_NETBSD,
};
#define GRUB_BSD_TEMP_BUFFER 0x68000

View file

@ -47,7 +47,7 @@
#define MOD_BUF_ALLOC_UNIT 4096
static int kernel_type;
static int kernel_type = KERNEL_TYPE_NONE;
static grub_dl_t my_mod;
static grub_addr_t entry, entry_hi, kern_start, kern_end;
static grub_uint32_t bootflags;
@ -614,10 +614,10 @@ grub_bsd_load_aout (grub_file_t file)
return grub_errno;
if (grub_file_read (file, &ah, sizeof (ah)) != sizeof (ah))
return grub_error (GRUB_ERR_READ_ERROR, "cannot read the a.out header");
return grub_error (GRUB_ERR_READ_ERROR, "Cannot read the a.out header");
if (grub_aout_get_type (&ah) != AOUT_TYPE_AOUT32)
return grub_error (GRUB_ERR_BAD_OS, "invalid a.out header");
return grub_error (GRUB_ERR_BAD_OS, "Invalid a.out header");
entry = ah.aout32.a_entry & 0xFFFFFF;
@ -635,7 +635,7 @@ grub_bsd_load_aout (grub_file_t file)
}
if (load_addr < 0x100000)
return grub_error (GRUB_ERR_BAD_OS, "load address below 1M");
return grub_error (GRUB_ERR_BAD_OS, "Load address below 1M");
kern_start = load_addr;
kern_end = load_addr + ah.aout32.a_text + ah.aout32.a_data;
@ -738,7 +738,7 @@ grub_bsd_load_elf (grub_elf_t elf)
return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
}
else
return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
return grub_error (GRUB_ERR_BAD_OS, "Invalid elf");
}
static grub_err_t
@ -753,7 +753,7 @@ grub_bsd_load (int argc, char *argv[])
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
goto fail;
}
@ -914,13 +914,17 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
char *buf = 0, *curr, *next;
int len;
if (kernel_type == KERNEL_TYPE_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"You need to load the kernel first.");
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only freebsd support environment");
"Only FreeBSD support environment");
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "no filename");
grub_error (GRUB_ERR_BAD_ARGUMENT, "No filename");
goto fail;
}
@ -1004,13 +1008,17 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
char **modargv;
char *type;
if (kernel_type == KERNEL_TYPE_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"You need to load the kernel first.");
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only freebsd support module");
"Only FreeBSD support module");
if (!is_elf_kernel)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only elf kernel support module");
"Only ELF kernel support module");
/* List the current modules if no parameter. */
if (!argc)
@ -1066,13 +1074,17 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
grub_file_t file = 0;
grub_err_t err;
if (kernel_type == KERNEL_TYPE_NONE)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"You need to load the kernel first.");
if (kernel_type != KERNEL_TYPE_FREEBSD)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only freebsd support module");
"Only FreeBSD support module");
if (! is_elf_kernel)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"only elf kernel support module");
"Only ELF kernel support module");
/* List the current modules if no parameter. */
if (! argc)
@ -1108,22 +1120,22 @@ GRUB_MOD_INIT (bsd)
{
cmd_freebsd =
grub_register_command ("freebsd", grub_cmd_freebsd,
0, "load freebsd kernel");
0, "load kernel of FreeBSD");
cmd_openbsd =
grub_register_command ("openbsd", grub_cmd_openbsd,
0, "load openbsd kernel");
0, "load kernel of OpenBSD");
cmd_netbsd =
grub_register_command ("netbsd", grub_cmd_netbsd,
0, "load netbsd kernel");
0, "load kernel of NetBSD");
cmd_freebsd_loadenv =
grub_register_command ("freebsd_loadenv", grub_cmd_freebsd_loadenv,
0, "load freebsd env");
0, "load FreeBSD env");
cmd_freebsd_module =
grub_register_command ("freebsd_module", grub_cmd_freebsd_module,
0, "load freebsd module");
0, "load FreeBSD kernel module");
cmd_freebsd_module_elf =
grub_register_command ("freebsd_module_elf", grub_cmd_freebsd_module_elf,
0, "load freebsd ELF module");
0, "load FreeBSD kernel module (ELF)");
my_mod = mod;
}