merge mainline into newreloc

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-18 22:38:25 +01:00
commit 96bdd17579
15 changed files with 897 additions and 222 deletions

View file

@ -1,3 +1,54 @@
2010-01-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i386/bsd.h: Fix include pathes.
2010-01-18 Vladimir Serbinenko <phcoder@gmail.com>
Add missing *BSD copyright headers.
* include/grub/aout.h: Add BSD licence.
* include/grub/i386/bsd.h: Parts under different licences moved to ...
* include/grub/i386/freebsd_linker.h: ... here,
* include/grub/i386/freebsd_reboot.h: ... here,
* include/grub/i386/netbsd_bootinfo.h: ... here,
* include/grub/i386/netbsd_reboot.h: ... here,
* include/grub/i386/openbsd_bootarg.h: ... here,
* include/grub/i386/openbsd_reboot.h: ... and here. Added appropriate
licence to each file.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* acinclude.m4: Remove `nop' assembly instruction; it's not
implemented by all architectures.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/efi/linux.c (grub_cmd_linux): Stop pretending we're
ELILO. This is no longer necessary.
2010-01-18 BVK Chaitanya <bvk.groups@gmail.com>
Added new tool, grub-scrit-check to verify grub.cfg syntax.
* util/grub-script-check.c: grub-script-check tool.
* conf/common.rmk: Make rules for grub-script-check.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
Fix annoying UI bug in rescue mode. Thanks to Tristan Gingold for
spotting it back in 2008. Shame on me for forgetting he did.
* kern/rescue_reader.c (grub_rescue_run): Skip zero-length lines.
2010-01-18 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_TEXT): ... this. Update all users.
(GRUB_VIDEO_TYPE_VLFB): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_VESA): ... this. Update all users.
(GRUB_VIDEO_TYPE_EFI): Rename to ...
(GRUB_VIDEO_LINUX_TYPE_SIMPLE): ... this. Update all users.
2010-01-17 Robert Millan <rmh.grub@aybabtu.com> 2010-01-17 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/test.h: Add license header. * include/grub/test.h: Add license header.

View file

@ -18,7 +18,7 @@ AC_DEFUN(grub_PROG_TARGET_CC,
[AC_MSG_CHECKING([whether target compiler is working]) [AC_MSG_CHECKING([whether target compiler is working])
AC_CACHE_VAL(grub_cv_prog_target_cc, AC_CACHE_VAL(grub_cv_prog_target_cc,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
asm (".globl start; start: nop"); asm (".globl start; start:");
int main (void); int main (void);
]], [[]])], ]], [[]])],
[grub_cv_prog_target_cc=yes], [grub_cv_prog_target_cc=yes],

View file

@ -88,11 +88,32 @@ endif
bin_UTILITIES += grub-mkrelpath bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
# For grub-script-check.
bin_UTILITIES += grub-script-check
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
grub_script_check_SOURCES = gnulib/progname.c util/grub-script-check.c util/misc.c \
script/main.c script/script.c script/function.c script/lexer.c \
kern/handler.c kern/err.c kern/parser.c kern/list.c \
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c
# For the parser. # For the parser.
grub_script.tab.c grub_script.tab.h: script/parser.y grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
# For grub-script-check.
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_script_check_init.lst
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_script_check_init.h
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_script_check_init.c
# For grub-probe. # For grub-probe.
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@

View file

@ -16,6 +16,38 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)exec.h 8.1 (Berkeley) 6/11/93
* $FreeBSD$
*/
#ifndef GRUB_AOUT_HEADER #ifndef GRUB_AOUT_HEADER
#define GRUB_AOUT_HEADER 1 #define GRUB_AOUT_HEADER 1

View file

@ -22,6 +22,13 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/relocator.h> #include <grub/relocator.h>
#include <grub/i386/freebsd_reboot.h>
#include <grub/i386/netbsd_reboot.h>
#include <grub/i386/openbsd_reboot.h>
#include <grub/i386/freebsd_linker.h>
#include <grub/i386/netbsd_bootinfo.h>
#include <grub/i386/openbsd_bootarg.h>
enum bsd_kernel_types enum bsd_kernel_types
{ {
KERNEL_TYPE_NONE, KERNEL_TYPE_NONE,
@ -32,62 +39,15 @@ enum bsd_kernel_types
#define GRUB_BSD_TEMP_BUFFER 0x80000 #define GRUB_BSD_TEMP_BUFFER 0x80000
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */ #define FREEBSD_B_DEVMAGIC OPENBSD_B_DEVMAGIC
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */ #define FREEBSD_B_SLICESHIFT OPENBSD_B_CTRLSHIFT
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */ #define FREEBSD_B_UNITSHIFT OPENBSD_B_UNITSHIFT
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */ #define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */ #define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#define FREEBSD_B_DEVMAGIC 0xa0000000
#define FREEBSD_B_SLICESHIFT 20
#define FREEBSD_B_UNITSHIFT 16
#define FREEBSD_B_PARTSHIFT 8
#define FREEBSD_B_TYPESHIFT 0
#define FREEBSD_BOOTINFO_VERSION 1 #define FREEBSD_BOOTINFO_VERSION 1
#define FREEBSD_N_BIOS_GEOM 8 #define FREEBSD_N_BIOS_GEOM 8
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#define FREEBSD_MODTYPE_KERNEL "elf kernel" #define FREEBSD_MODTYPE_KERNEL "elf kernel"
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel" #define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
#define FREEBSD_MODTYPE_ELF_MODULE "elf module" #define FREEBSD_MODTYPE_ELF_MODULE "elf module"
@ -120,44 +80,6 @@ struct freebsd_tag_header
grub_uint32_t len; grub_uint32_t len;
}; };
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bios_mmap struct grub_openbsd_bios_mmap
{ {
grub_uint64_t addr; grub_uint64_t addr;
@ -169,124 +91,7 @@ struct grub_openbsd_bios_mmap
grub_uint32_t type; grub_uint32_t type;
}; };
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
grub_addr_t bi_data[0];
};
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_CONSOLE 6
#define NETBSD_BTINFO_SYMTAB 8
#define NETBSD_BTINFO_MEMMAP 9
#define NETBSD_BTINFO_MODULES 11
#define NETBSD_BTINFO_FRAMEBUF 12
struct grub_netbsd_btinfo_common
{
grub_uint32_t len;
grub_uint32_t type;
};
#define GRUB_NETBSD_MAX_BOOTPATH_LEN 80
struct grub_netbsd_btinfo_bootdisk
{
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
struct grub_netbsd_btinfo_symtab
{
grub_uint32_t nsyms;
grub_uint32_t ssyms;
grub_uint32_t esyms;
};
struct grub_netbsd_btinfo_serial
{
char devname[16];
grub_uint32_t addr;
grub_uint32_t speed;
};
struct grub_netbsd_btinfo_modules
{
grub_uint32_t num;
grub_uint32_t last_addr;
struct grub_netbsd_btinfo_module
{
char name[80];
#define GRUB_NETBSD_MODULE_RAW 0
#define GRUB_NETBSD_MODULE_ELF 1
grub_uint32_t type;
grub_uint32_t size;
grub_uint32_t addr;
} mods[0];
};
struct grub_netbsd_btinfo_framebuf
{
grub_uint64_t fbaddr;
grub_uint32_t flags;
grub_uint32_t width;
grub_uint32_t height;
grub_uint16_t pitch;
grub_uint8_t bpp;
grub_uint8_t red_mask_size;
grub_uint8_t green_mask_size;
grub_uint8_t blue_mask_size;
grub_uint8_t red_field_pos;
grub_uint8_t green_field_pos;
grub_uint8_t blue_field_pos;
grub_uint8_t reserved[16];
};
#define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16
grub_err_t grub_freebsd_load_elfmodule32 (struct grub_relocator *relocator, grub_err_t grub_freebsd_load_elfmodule32 (struct grub_relocator *relocator,
grub_file_t file, int argc, grub_file_t file, int argc,

View file

@ -0,0 +1,74 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: stable/8/sys/sys/linker.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_LINKER_CPU_HEADER
#define GRUB_FREEBSD_LINKER_CPU_HEADER 1
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#endif

View file

@ -0,0 +1,77 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
* $FreeBSD: stable/8/sys/sys/reboot.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_REBOOT_CPU_HEADER
#define GRUB_FREEBSD_REBOOT_CPU_HEADER 1
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#endif

View file

@ -79,9 +79,9 @@ struct grub_e820_mmap
grub_uint32_t type; grub_uint32_t type;
} __attribute__((packed)); } __attribute__((packed));
#define GRUB_VIDEO_LINUX_TYPE_EGA_TEXT 0x01 #define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
#define GRUB_VIDEO_LINUX_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */ #define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE_LFB 0x70 /* Linear framebuffer without any additional functions. */ #define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
/* For the Linux/i386 boot protocol version 2.03. */ /* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header struct linux_kernel_header

View file

@ -0,0 +1,138 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: bootinfo.h,v 1.16 2009/08/24 02:15:46 jmcneill Exp $ */
/*
* Copyright (c) 1997
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRUB_NETBSD_BOOTINFO_CPU_HEADER
#define GRUB_NETBSD_BOOTINFO_CPU_HEADER 1
#include <grub/types.h>
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_CONSOLE 6
#define NETBSD_BTINFO_SYMTAB 8
#define NETBSD_BTINFO_MEMMAP 9
#define NETBSD_BTINFO_MODULES 11
#define NETBSD_BTINFO_FRAMEBUF 12
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
grub_addr_t bi_data[0];
};
struct grub_netbsd_btinfo_common
{
grub_uint32_t len;
grub_uint32_t type;
};
#define GRUB_NETBSD_MAX_BOOTPATH_LEN 80
struct grub_netbsd_btinfo_bootdisk
{
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
struct grub_netbsd_btinfo_symtab
{
grub_uint32_t nsyms;
grub_uint32_t ssyms;
grub_uint32_t esyms;
};
struct grub_netbsd_btinfo_serial
{
char devname[16];
grub_uint32_t addr;
grub_uint32_t speed;
};
struct grub_netbsd_btinfo_modules
{
grub_uint32_t num;
grub_uint32_t last_addr;
struct grub_netbsd_btinfo_module
{
char name[80];
#define GRUB_NETBSD_MODULE_RAW 0
#define GRUB_NETBSD_MODULE_ELF 1
grub_uint32_t type;
grub_uint32_t size;
grub_uint32_t addr;
} mods[0];
};
struct grub_netbsd_btinfo_framebuf
{
grub_uint64_t fbaddr;
grub_uint32_t flags;
grub_uint32_t width;
grub_uint32_t height;
grub_uint16_t pitch;
grub_uint8_t bpp;
grub_uint8_t red_mask_size;
grub_uint8_t green_mask_size;
grub_uint8_t blue_mask_size;
grub_uint8_t red_field_pos;
grub_uint8_t green_field_pos;
grub_uint8_t blue_field_pos;
grub_uint8_t reserved[16];
};
#define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16
#endif

View file

@ -0,0 +1,81 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: reboot.h,v 1.25 2007/12/25 18:33:48 perry Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
*/
#ifndef GRUB_NETBSD_REBOOT_CPU_HEADER
#define GRUB_NETBSD_REBOOT_CPU_HEADER 1
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
#endif

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: bootarg.h,v 1.11 2003/06/02 20:20:54 mickey Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GRUB_OPENBSD_BOOTARG_CPU_HEADER
#define GRUB_OPENBSD_BOOTARG_CPU_HEADER 1
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#endif

View file

@ -0,0 +1,79 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: reboot.h,v 1.13 2004/03/10 23:02:53 tom Exp $ */
/* $NetBSD: reboot.h,v 1.9 1996/04/22 01:23:25 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.2 (Berkeley) 7/10/94
*/
#ifndef GRUB_OPENBSD_REBOOT_CPU_HEADER
#define GRUB_OPENBSD_REBOOT_CPU_HEADER 1
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#endif

View file

@ -1,7 +1,7 @@
/* rescue_reader.c - rescue mode reader */ /* rescue_reader.c - rescue mode reader */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -83,7 +83,7 @@ grub_rescue_run (void)
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_rescue_read_line (&line, 0); grub_rescue_read_line (&line, 0);
if (! line) if (! line || line[0] == '\0')
continue; continue;
grub_parser_get_current ()->parse_line (line, grub_rescue_read_line); grub_parser_get_current ()->parse_line (line, grub_rescue_read_line);

View file

@ -471,11 +471,11 @@ grub_linux_setup_video (struct linux_kernel_params *params)
switch (grub_video_get_driver_id ()) switch (grub_video_get_driver_id ())
{ {
case GRUB_VIDEO_DRIVER_VBE: case GRUB_VIDEO_DRIVER_VBE:
params->have_vga = GRUB_VIDEO_LINUX_TYPE_VLFB; params->have_vga = GRUB_VIDEO_LINUX_TYPE_VESA;
break; break;
default: default:
params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE_LFB; params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE;
break; break;
} }
@ -636,7 +636,7 @@ grub_linux_boot (void)
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
#if HAS_VGA_TEXT #if HAS_VGA_TEXT
params->have_vga = GRUB_VIDEO_LINUX_TYPE_EGA_TEXT; params->have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT;
params->video_mode = 0x3; params->video_mode = 0x3;
#else #else
params->have_vga = 0; params->have_vga = 0;
@ -648,7 +648,7 @@ grub_linux_boot (void)
/* Initialize these last, because terminal position could be affected by printfs above. */ /* Initialize these last, because terminal position could be affected by printfs above. */
#ifndef GRUB_MACHINE_IEEE1275 #ifndef GRUB_MACHINE_IEEE1275
if (params->have_vga == GRUB_VIDEO_LINUX_TYPE_EGA_TEXT) if (params->have_vga == GRUB_VIDEO_LINUX_TYPE_TEXT)
#endif #endif
{ {
grub_term_output_t term; grub_term_output_t term;
@ -826,12 +826,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail; goto fail;
} }
#ifdef GRUB_MACHINE_EFI
/* XXX Linux assumes that only elilo can boot Linux on EFI!!! */
params->type_of_loader = (LINUX_LOADER_ID_ELILO << 4);
#else
params->type_of_loader = (LINUX_LOADER_ID_GRUB << 4); params->type_of_loader = (LINUX_LOADER_ID_GRUB << 4);
#endif
/* These two are used (instead of cmd_line_ptr) by older versions of Linux, /* These two are used (instead of cmd_line_ptr) by older versions of Linux,
and otherwise ignored. */ and otherwise ignored. */

250
util/grub-script-check.c Normal file
View file

@ -0,0 +1,250 @@
/* grub-script-check.c - check grub script file for syntax errors */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <grub/types.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/util/misc.h>
#include <grub/i18n.h>
#include <grub/parser.h>
#include <grub/script_sh.h>
#include <grub_script_check_init.h>
#define _GNU_SOURCE 1
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include "progname.h"
void
grub_putchar (int c)
{
putchar (c);
}
int
grub_getkey (void)
{
return -1;
}
void
grub_refresh (void)
{
fflush (stdout);
}
char *
grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused)))
{
return 0;
}
grub_err_t
grub_script_execute_cmdline (struct grub_script_cmd *cmd __attribute__ ((unused)))
{
return 0;
}
grub_err_t
grub_script_execute_cmdblock (struct grub_script_cmd *cmd __attribute__ ((unused)))
{
return 0;
}
grub_err_t
grub_script_execute_cmdif (struct grub_script_cmd *cmd __attribute__ ((unused)))
{
return 0;
}
grub_err_t
grub_script_execute_menuentry (struct grub_script_cmd *cmd)
{
struct grub_script_cmd_menuentry *menu;
menu = (struct grub_script_cmd_menuentry *)cmd;
if (menu->sourcecode)
{
grub_free (menu->sourcecode);
menu->sourcecode = 0;
}
return 0;
}
grub_err_t
grub_script_execute (struct grub_script *script)
{
if (script == 0 || script->cmd == 0)
return 0;
return script->cmd->exec (script->cmd);
}
static struct option options[] =
{
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
static void
usage (int status)
{
if (status)
fprintf (stderr,
"Try ``%s --help'' for more information.\n", program_name);
else
printf ("\
Usage: %s [PATH]\n\
\n\
Checks GRUB script configuration file for syntax errors.\n\
\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print script being processed\n\
\n\
Report bugs to <%s>.\n\
", program_name,
PACKAGE_BUGREPORT);
exit (status);
}
int
main (int argc, char *argv[])
{
char *argument;
char *input;
FILE *file = 0;
int verbose = 0;
struct grub_script *script;
auto grub_err_t get_config_line (char **line, int cont);
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
{
char *cmdline = 0;
size_t len = 0;
ssize_t read;
read = getline(&cmdline, &len, (file ?: stdin));
if (read == -1)
{
*line = 0;
grub_errno = GRUB_ERR_READ_ERROR;
if (cmdline)
free (cmdline);
return grub_errno;
}
if (verbose)
grub_printf("%s", cmdline);
*line = grub_strdup (cmdline);
free (cmdline);
return 0;
}
set_program_name (argv[0]);
grub_util_init_nls ();
/* Check for options. */
while (1)
{
int c = getopt_long (argc, argv, "hvV", options, 0);
if (c == -1)
break;
else
switch (c)
{
case 'h':
usage (0);
break;
case 'V':
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'v':
verbose = 1;
break;
default:
usage (1);
break;
}
}
/* Obtain ARGUMENT. */
if (optind >= argc)
{
file = 0; /* read from stdin */
}
else if (optind + 1 != argc)
{
fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind + 1]);
usage (1);
}
else
{
argument = argv[optind];
file = fopen (argument, "r");
if (! file)
{
fprintf (stderr, "%s: %s: %s\n", program_name, argument, strerror(errno));
usage (1);
}
}
/* Initialize all modules. */
grub_init_all ();
do
{
input = 0;
get_config_line(&input, 0);
if (! input)
break;
script = grub_script_parse (input, get_config_line);
if (script)
{
grub_script_execute (script);
grub_script_free (script);
}
grub_free (input);
} while (script != 0);
/* Free resources. */
grub_fini_all ();
if (file) fclose (file);
return (script == 0);
}