Merge mainline into gfxmenu
This commit is contained in:
commit
1f534b6908
279 changed files with 9437 additions and 3021 deletions
|
@ -1,9 +0,0 @@
|
|||
2009-11-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Optimise glyph lookup by Basic Multilingual Plane lookup array.
|
||||
|
||||
* font/font.c (struct grub_font): New member 'bmp_idx'.
|
||||
(font_init): Initialise 'bmp_idx'.
|
||||
(load_font_index): Fill 'bmp_idx'.
|
||||
(find_glyph): Make inline. Use bmp_idx for BMP characters.
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
2009-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
2009-10-25 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* normal/menu.c (grub_menu_execute_entry): Save selected entry title
|
||||
in `chosen' environment variable.
|
||||
* normal/menu_text.c (get_entry_number): Check if the variable
|
||||
matches the title of a menu entry.
|
||||
(run_menu): Pass menu to get_entry_number.
|
||||
|
||||
* util/grub-reboot.in: New file.
|
||||
* util/grub-set-default.in: New file.
|
||||
* conf/common.rmk (grub-reboot): New utility.
|
||||
(grub-set-default): New utility.
|
||||
|
||||
* util/grub-mkconfig_lib.in (save_default_entry): New function.
|
||||
* util/grub.d/00_header.in: If GRUB_DEFAULT is `saved', set
|
||||
default to `${saved_entry}'. If `${prev_saved_entry}' is non-empty,
|
||||
move it to `saved_entry' for the next boot. Load environment on
|
||||
initialisation.
|
||||
* util/grub.d/10_kfreebsd.in: Call save_default_entry.
|
||||
* util/grub.d/10_hurd.in: Likewise.
|
||||
* util/grub.d/10_linux.in (linux_entry): Likewise.
|
||||
* util/grub.d/10_windows.in: Likewise.
|
||||
* util/grub.d/30_os-prober.in: Likewise.
|
||||
|
||||
* util/grub-install.in: Create environment block.
|
||||
* util/i386/efi/grub-install.in: Likewise.
|
||||
* util/ieee1275/grub-install.in: Likewise.
|
||||
* util/sparc64/ieee1275/grub-install.in: Likewise.
|
|
@ -1,10 +0,0 @@
|
|||
2009-11-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Use flag-based instead of hook-based video mode selection and "auto"
|
||||
keyword.
|
||||
|
||||
* include/grub/video.h (grub_video_adapter): Changed 'setup' member.
|
||||
(grub_video_set_mode): Changed prototype. All users updated.
|
||||
(grub_video_check_mode_flag): New inline function.
|
||||
* video/video.c (parse_modespec): New function.
|
||||
(grub_video_set_mode): Parse flags and keywords.
|
31
Makefile.in
31
Makefile.in
|
@ -169,6 +169,8 @@ ifeq ($(platform), emu)
|
|||
include $(srcdir)/conf/any-emu.mk
|
||||
else
|
||||
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
|
||||
# For tests.
|
||||
include $(srcdir)/conf/tests.mk
|
||||
# For external modules.
|
||||
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
||||
endif
|
||||
|
@ -236,7 +238,7 @@ else
|
|||
|
||||
ifeq ($(enable_grub_mkfont),yes)
|
||||
|
||||
pkgdata_DATA += unicode.pf2 ascii.pf2
|
||||
pkgdata_DATA += unicode.pf2 ascii.pf2 ascii.h
|
||||
|
||||
# Arrows and lines are needed to draw the menu, so we always include them
|
||||
UNICODE_ARROWS=0x2190-0x2193
|
||||
|
@ -247,6 +249,14 @@ unicode.pf2: $(FONT_SOURCE) grub-mkfont
|
|||
|
||||
ascii.pf2: $(FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
||||
|
||||
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
|
||||
|
||||
ascii.h: ascii.bitmaps grub-bin2h
|
||||
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
|
||||
|
||||
TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -463,7 +473,24 @@ distcheck: dist
|
|||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
|
||||
check:
|
||||
check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS)
|
||||
@list="$(UNIT_TESTS)"; \
|
||||
set -e; \
|
||||
for file in $$list; do \
|
||||
$(builddir)/$$file; \
|
||||
done
|
||||
@list="$(FUNCTIONAL_TESTS)"; \
|
||||
set -e; \
|
||||
for file in $$list; do \
|
||||
mod=`basename $$file .mod`; \
|
||||
echo "insmod functional_test; insmod $$mod; functional_test" \
|
||||
| $(builddir)/grub-shell; \
|
||||
done
|
||||
@list="$(SCRIPTED_TESTS)"; \
|
||||
set -e; \
|
||||
for file in $$list; do \
|
||||
$(builddir)/$$file; \
|
||||
done
|
||||
|
||||
.SUFFIX:
|
||||
.SUFFIX: .c .o .S .d
|
||||
|
|
34
acinclude.m4
34
acinclude.m4
|
@ -14,11 +14,11 @@ $2
|
|||
|
||||
|
||||
dnl Check whether target compiler is working
|
||||
AC_DEFUN(grub_PROG_TARGET_CC,
|
||||
AC_DEFUN([grub_PROG_TARGET_CC],
|
||||
[AC_MSG_CHECKING([whether target compiler is working])
|
||||
AC_CACHE_VAL(grub_cv_prog_target_cc,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start: nop");
|
||||
asm (".globl start; start:");
|
||||
int main (void);
|
||||
]], [[]])],
|
||||
[grub_cv_prog_target_cc=yes],
|
||||
|
@ -36,7 +36,7 @@ dnl grub_ASM_USCORE checks if C symbols get an underscore after
|
|||
dnl compiling to assembler.
|
||||
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
|
||||
dnl Erich Boleyn and modified by Yoshinori K. Okuji.
|
||||
AC_DEFUN(grub_ASM_USCORE,
|
||||
AC_DEFUN([grub_ASM_USCORE],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
||||
AC_CACHE_VAL(grub_cv_asm_uscore,
|
||||
|
@ -75,7 +75,7 @@ AC_MSG_RESULT([$grub_cv_asm_uscore])
|
|||
|
||||
dnl Some versions of `objcopy -O binary' vary their output depending
|
||||
dnl on the link address.
|
||||
AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE,
|
||||
AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
|
||||
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
||||
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
||||
[cat > conftest.c <<\EOF
|
||||
|
@ -119,7 +119,7 @@ fi
|
|||
|
||||
dnl Supply --build-id=none to ld if building modules.
|
||||
dnl This suppresses warnings from ld on some systems
|
||||
AC_DEFUN(grub_PROG_LD_BUILD_ID_NONE,
|
||||
AC_DEFUN([grub_PROG_LD_BUILD_ID_NONE],
|
||||
[AC_MSG_CHECKING([whether linker accepts --build-id=none])
|
||||
AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
|
||||
[save_LDFLAGS="$LDFLAGS"
|
||||
|
@ -150,7 +150,7 @@ dnl
|
|||
dnl We only support the newer versions, because the old versions cause
|
||||
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
||||
dnl asm files.
|
||||
AC_DEFUN(grub_I386_ASM_ADDR32,
|
||||
AC_DEFUN([grub_I386_ASM_ADDR32],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
|
||||
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
||||
|
@ -178,7 +178,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
|||
|
||||
dnl check if our compiler is apple cc
|
||||
dnl because it requires numerous workarounds
|
||||
AC_DEFUN(grub_apple_cc,
|
||||
AC_DEFUN([grub_apple_cc],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([whether our compiler is apple cc])
|
||||
AC_CACHE_VAL(grub_cv_apple_cc,
|
||||
|
@ -193,7 +193,7 @@ AC_MSG_RESULT([$grub_cv_apple_cc])])
|
|||
|
||||
dnl check if our target compiler is apple cc
|
||||
dnl because it requires numerous workarounds
|
||||
AC_DEFUN(grub_apple_target_cc,
|
||||
AC_DEFUN([grub_apple_target_cc],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
||||
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
||||
|
@ -210,7 +210,7 @@ AC_MSG_RESULT([$grub_cv_apple_target_cc])])
|
|||
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
||||
dnl appear in the same lines as the instructions they modify, while
|
||||
dnl earlier versions requires that they appear in separate lines.
|
||||
AC_DEFUN(grub_I386_ASM_PREFIX_REQUIREMENT,
|
||||
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(dnl
|
||||
[whether addr32 must be in the same line as the instruction])
|
||||
|
@ -246,7 +246,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
|||
|
||||
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
||||
dnl not prefixed with `*', while later versions warn if not prefixed.
|
||||
AC_DEFUN(grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK,
|
||||
AC_DEFUN([grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(dnl
|
||||
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
||||
|
@ -276,7 +276,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])])
|
|||
|
||||
dnl Check what symbol is defined as a bss start symbol.
|
||||
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
||||
AC_DEFUN(grub_CHECK_BSS_START_SYMBOL,
|
||||
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
||||
|
@ -320,7 +320,7 @@ fi
|
|||
|
||||
dnl Check what symbol is defined as an end symbol.
|
||||
dnl Written by Yoshinori K. Okuji.
|
||||
AC_DEFUN(grub_CHECK_END_SYMBOL,
|
||||
AC_DEFUN([grub_CHECK_END_SYMBOL],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([if end is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
||||
|
@ -352,7 +352,7 @@ fi
|
|||
])
|
||||
|
||||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
||||
AC_DEFUN(grub_CHECK_ENABLE_EXECUTE_STACK,[
|
||||
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
||||
AC_LANG_CONFTEST([[
|
||||
void f (int (*p) (void));
|
||||
|
@ -379,7 +379,7 @@ rm -f conftest*
|
|||
|
||||
|
||||
dnl Check if the C compiler supports `-fstack-protector'.
|
||||
AC_DEFUN(grub_CHECK_STACK_PROTECTOR,[
|
||||
AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
||||
[# Smashing stack protector.
|
||||
ssp_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||
|
@ -398,7 +398,7 @@ else
|
|||
])
|
||||
|
||||
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin).
|
||||
AC_DEFUN(grub_CHECK_STACK_ARG_PROBE,[
|
||||
AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
||||
[# Smashing stack arg probe.
|
||||
sap_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
||||
|
@ -414,7 +414,7 @@ else
|
|||
])
|
||||
|
||||
dnl Check if ln can handle directories properly (mingw).
|
||||
AC_DEFUN(grub_CHECK_LINK_DIR,[
|
||||
AC_DEFUN([grub_CHECK_LINK_DIR],[
|
||||
AC_MSG_CHECKING([whether ln can handle directories properly])
|
||||
[mkdir testdir 2>/dev/null
|
||||
case $srcdir in
|
||||
|
@ -432,7 +432,7 @@ rm -rf testdir]
|
|||
])
|
||||
|
||||
dnl Check if the C compiler supports `-fPIE'.
|
||||
AC_DEFUN(grub_CHECK_PIE,[
|
||||
AC_DEFUN([grub_CHECK_PIE],[
|
||||
[# Position independent executable.
|
||||
pie_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000,2005,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
|
||||
|
@ -16,6 +16,8 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/boot.h>
|
||||
|
||||
.file "pxeboot.S"
|
||||
.text
|
||||
|
||||
|
@ -28,7 +30,7 @@ _start:
|
|||
start:
|
||||
|
||||
/* Use drive number 0x7F for PXE */
|
||||
movb $0x7F, %dl
|
||||
movb $GRUB_BOOT_MACHINE_PXE_DL, %dl
|
||||
|
||||
/* Jump to the real world */
|
||||
ljmp $0, $0x8200
|
||||
|
|
90
bus/bonito.c
Normal file
90
bus/bonito.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* bonito.c - PCI bonito interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE,
|
||||
GRUB_MACHINE_PCI_WIN_SIZE};
|
||||
/* Usage counters. */
|
||||
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR,
|
||||
GRUB_MACHINE_PCI_WIN3_ADDR};
|
||||
|
||||
static inline void
|
||||
write_bases (void)
|
||||
{
|
||||
int i;
|
||||
grub_uint32_t reg = 0;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
||||
& GRUB_MACHINE_PCI_WIN_MASK)
|
||||
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
||||
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
|
||||
}
|
||||
|
||||
volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base, grub_size_t size)
|
||||
{
|
||||
int i;
|
||||
grub_addr_t newbase;
|
||||
|
||||
/* First try already used registers. */
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
if (usage_win[i] && base_win[i] <= base
|
||||
&& base_win[i] + sizes_win[i] > base + size)
|
||||
{
|
||||
usage_win[i]++;
|
||||
return (void *)
|
||||
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
||||
}
|
||||
/* Map new register. */
|
||||
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
if (!usage_win[i] && newbase <= base
|
||||
&& newbase + sizes_win[i] > base + size)
|
||||
{
|
||||
usage_win[i]++;
|
||||
base_win[i] = newbase;
|
||||
write_bases ();
|
||||
return (void *)
|
||||
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
||||
}
|
||||
grub_fatal ("Out of PCI windows.");
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
volatile void *mem __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
if (usage_win[i] && addr_win[i]
|
||||
== (((grub_addr_t) mem) & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
{
|
||||
usage_win[i]--;
|
||||
return;
|
||||
}
|
||||
grub_fatal ("Tried to unmap not mapped region");
|
||||
}
|
10
bus/pci.c
10
bus/pci.c
|
@ -24,7 +24,7 @@ grub_pci_address_t
|
|||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||
{
|
||||
return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
|
||||
| (dev.function << 8) | (reg << 2);
|
||||
| (dev.function << 8) | reg;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -35,13 +35,13 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
|||
grub_pci_id_t id;
|
||||
grub_uint32_t hdr;
|
||||
|
||||
for (dev.bus = 0; dev.bus < 256; dev.bus++)
|
||||
for (dev.bus = 0; dev.bus < GRUB_PCI_NUM_BUS; dev.bus++)
|
||||
{
|
||||
for (dev.device = 0; dev.device < 32; dev.device++)
|
||||
for (dev.device = 0; dev.device < GRUB_PCI_NUM_DEVICES; dev.device++)
|
||||
{
|
||||
for (dev.function = 0; dev.function < 8; dev.function++)
|
||||
{
|
||||
addr = grub_pci_make_address (dev, 0);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_PCI_ID);
|
||||
id = grub_pci_read (addr);
|
||||
|
||||
/* Check if there is a device present. */
|
||||
|
@ -54,7 +54,7 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
|||
/* Probe only func = 0 if the device if not multifunction */
|
||||
if (dev.function == 0)
|
||||
{
|
||||
addr = grub_pci_make_address (dev, 3);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE);
|
||||
hdr = grub_pci_read (addr);
|
||||
if (!(hdr & 0x800000))
|
||||
break;
|
||||
|
|
|
@ -126,7 +126,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
grub_uint32_t revision;
|
||||
grub_uint32_t frame_interval;
|
||||
|
||||
addr = grub_pci_make_address (dev, 2);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class_code = grub_pci_read (addr) >> 8;
|
||||
|
||||
interf = class_code & 0xFF;
|
||||
|
@ -138,7 +138,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
return 0;
|
||||
|
||||
/* Determine IO base address. */
|
||||
addr = grub_pci_make_address (dev, 4);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
||||
base = grub_pci_read (addr);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -150,7 +150,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
struct grub_uhci *u;
|
||||
int i;
|
||||
|
||||
addr = grub_pci_make_address (dev, 2);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class_code = grub_pci_read (addr) >> 8;
|
||||
|
||||
interf = class_code & 0xFF;
|
||||
|
@ -162,7 +162,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
return 0;
|
||||
|
||||
/* Determine IO base address. */
|
||||
addr = grub_pci_make_address (dev, 8);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||
base = grub_pci_read (addr);
|
||||
/* Stop if there is no IO space base address defined. */
|
||||
if (! (base & 1))
|
||||
|
|
|
@ -229,7 +229,7 @@ grub_acpi_create_ebda (void)
|
|||
sizeof (struct grub_acpi_rsdp_v10)) == 0)
|
||||
{
|
||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
||||
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
||||
v1inebda = target;
|
||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
||||
|
|
|
@ -43,7 +43,7 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
{
|
||||
grub_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, 2);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
||||
{
|
||||
struct grub_video_patch *p = video_patches;
|
||||
|
|
|
@ -51,7 +51,8 @@ enable_rom_area (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
addr = grub_pci_make_address (dev, 36);
|
||||
/* FIXME: should be macroified. */
|
||||
addr = grub_pci_make_address (dev, 144);
|
||||
grub_pci_write_byte (addr++, 0x30);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
|
@ -77,7 +78,8 @@ lock_rom_area (void)
|
|||
grub_pci_address_t addr;
|
||||
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||
|
||||
addr = grub_pci_make_address (dev, 36);
|
||||
/* FIXME: should be macroified. */
|
||||
addr = grub_pci_make_address (dev, 144);
|
||||
grub_pci_write_byte (addr++, 0x10);
|
||||
grub_pci_write_byte (addr++, 0x11);
|
||||
grub_pci_write_byte (addr++, 0x11);
|
||||
|
|
|
@ -57,7 +57,7 @@ static grub_err_t
|
|||
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
||||
{
|
||||
grub_uint8_t context[hash->contextsize];
|
||||
char *readbuf[4096];
|
||||
grub_uint8_t readbuf[4096];
|
||||
|
||||
grub_memset (context, 0, sizeof (context));
|
||||
hash->init (context);
|
||||
|
@ -111,11 +111,9 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|||
{
|
||||
char *filename;
|
||||
|
||||
filename = grub_malloc (grub_strlen (prefix)
|
||||
+ grub_strlen (p) + 2);
|
||||
filename = grub_xasprintf ("%s/%s", prefix, p);
|
||||
if (!filename)
|
||||
return grub_errno;
|
||||
grub_sprintf (filename, "%s/%s", prefix, p);
|
||||
file = grub_file_open (filename);
|
||||
grub_free (filename);
|
||||
}
|
||||
|
|
|
@ -46,12 +46,10 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
char *command_help;
|
||||
grub_uint32_t *unicode_command_help;
|
||||
grub_uint32_t *unicode_last_position;
|
||||
|
||||
command_help = grub_malloc (grub_strlen (cmd->name) +
|
||||
sizeof (" ") - 1 +
|
||||
grub_strlen (summary_translated));
|
||||
|
||||
grub_sprintf(command_help, "%s %s", cmd->name, summary_translated);
|
||||
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
||||
if (!command_help)
|
||||
return 1;
|
||||
|
||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||
&unicode_last_position);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* loadenv.c - command to load/save environment variable. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 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
|
||||
|
@ -196,7 +196,7 @@ free_blocklists (struct blocklist *p)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static grub_err_t
|
||||
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||
grub_file_t file)
|
||||
{
|
||||
|
@ -219,8 +219,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
{
|
||||
/* This might be actually valid, but it is unbelievable that
|
||||
any filesystem makes such a silly allocation. */
|
||||
grub_error (GRUB_ERR_BAD_FS, "malformed file");
|
||||
return 0;
|
||||
return grub_error (GRUB_ERR_BAD_FS, "malformed file");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,8 +229,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
if (total_length != grub_file_size (file))
|
||||
{
|
||||
/* Maybe sparse, unallocated sectors. No way in GRUB. */
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
||||
return 0;
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
||||
}
|
||||
|
||||
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
||||
|
@ -249,16 +247,13 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
|
||||
if (grub_disk_read (disk, p->sector - part_start,
|
||||
p->offset, p->length, blockbuf))
|
||||
return 0;
|
||||
return grub_errno;
|
||||
|
||||
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
||||
return 0;
|
||||
}
|
||||
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
||||
}
|
||||
|
||||
return 1;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -347,7 +342,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
|
|||
if (! envblk)
|
||||
goto fail;
|
||||
|
||||
if (! check_blocklists (envblk, head, file))
|
||||
if (check_blocklists (envblk, head, file))
|
||||
goto fail;
|
||||
|
||||
while (argc)
|
||||
|
|
|
@ -87,7 +87,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
int print_files_long (const char *filename,
|
||||
const struct grub_dirhook_info *info)
|
||||
{
|
||||
char pathname[grub_strlen (dirname) + grub_strlen (filename) + 1];
|
||||
char *pathname;
|
||||
|
||||
if ((! all) && (filename[0] == '.'))
|
||||
return 0;
|
||||
|
@ -97,9 +97,12 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
grub_file_t file;
|
||||
|
||||
if (dirname[grub_strlen (dirname) - 1] == '/')
|
||||
grub_sprintf (pathname, "%s%s", dirname, filename);
|
||||
pathname = grub_xasprintf ("%s%s", dirname, filename);
|
||||
else
|
||||
grub_sprintf (pathname, "%s/%s", dirname, filename);
|
||||
pathname = grub_xasprintf ("%s/%s", dirname, filename);
|
||||
|
||||
if (!pathname)
|
||||
return 1;
|
||||
|
||||
/* XXX: For ext2fs symlinks are detected as files while they
|
||||
should be reported as directories. */
|
||||
|
@ -131,8 +134,9 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
grub_uint32_t whole, fraction;
|
||||
|
||||
whole = grub_divmod64 (fsize, 100, &fraction);
|
||||
grub_sprintf (buf, "%u.%02u%c", whole, fraction,
|
||||
grub_human_sizes[units]);
|
||||
grub_snprintf (buf, sizeof (buf),
|
||||
"%u.%02u%c", whole, fraction,
|
||||
grub_human_sizes[units]);
|
||||
grub_printf ("%-12s", buf);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -135,7 +135,7 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
|
||||
grub_pci_get_device (dev), grub_pci_get_function (dev),
|
||||
pciid & 0xFFFF, pciid >> 16);
|
||||
addr = grub_pci_make_address (dev, 2);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class = grub_pci_read (addr);
|
||||
|
||||
/* Lookup the class name, if there isn't a specific one,
|
||||
|
@ -156,22 +156,24 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
|
||||
if (iospace)
|
||||
{
|
||||
reg = 4;
|
||||
while (reg < 10)
|
||||
reg = GRUB_PCI_REG_ADDRESSES;
|
||||
while (reg < GRUB_PCI_REG_CIS_POINTER)
|
||||
{
|
||||
grub_uint64_t space;
|
||||
addr = grub_pci_make_address (dev, reg);
|
||||
space = grub_pci_read (addr);
|
||||
|
||||
reg++;
|
||||
|
||||
reg += sizeof (grub_uint32_t);
|
||||
|
||||
if (space == 0)
|
||||
continue;
|
||||
|
||||
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
|
||||
{
|
||||
case GRUB_PCI_ADDR_SPACE_IO:
|
||||
grub_printf ("\tIO space %d at 0x%llx\n", (reg - 1) - 4,
|
||||
grub_printf ("\tIO space %d at 0x%llx\n",
|
||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||
/ sizeof (grub_uint32_t)) - 1,
|
||||
(unsigned long long)
|
||||
(space & GRUB_PCI_ADDR_IO_MASK));
|
||||
break;
|
||||
|
@ -181,9 +183,11 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
{
|
||||
addr = grub_pci_make_address (dev, reg);
|
||||
space |= ((grub_uint64_t) grub_pci_read (addr)) << 32;
|
||||
reg++;
|
||||
reg += sizeof (grub_uint32_t);
|
||||
grub_printf ("\t64-bit memory space %d at 0x%016llx [%s]\n",
|
||||
(reg - 2) - 4, (unsigned long long)
|
||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||
/ sizeof (grub_uint32_t)) - 2,
|
||||
(unsigned long long)
|
||||
(space & GRUB_PCI_ADDR_MEM_MASK),
|
||||
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
||||
? "prefetchable" : "non-prefetchable");
|
||||
|
@ -191,7 +195,9 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
}
|
||||
else
|
||||
grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n",
|
||||
(reg - 1) - 4, (unsigned long long)
|
||||
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||
/ sizeof (grub_uint32_t)) - 1,
|
||||
(unsigned long long)
|
||||
(space & GRUB_PCI_ADDR_MEM_MASK),
|
||||
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
||||
? "prefetchable" : "non-prefetchable");
|
||||
|
|
|
@ -62,7 +62,7 @@ grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
|||
|
||||
if (cmd->state[0].set)
|
||||
{
|
||||
grub_sprintf (buf, "%x", value);
|
||||
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||
grub_env_set (cmd->state[0].arg, buf);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -183,12 +183,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
char *filename;
|
||||
|
||||
filename = grub_malloc (grub_strlen (prefix) + sizeof ("/parttool.lst"));
|
||||
filename = grub_xasprintf ("%s/parttool.lst", prefix);
|
||||
if (filename)
|
||||
{
|
||||
grub_file_t file;
|
||||
|
||||
grub_sprintf (filename, "%s/parttool.lst", prefix);
|
||||
file = grub_file_open (filename);
|
||||
if (file)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@ void
|
|||
FUNC_NAME (const char *key, const char *var, int no_floppy)
|
||||
{
|
||||
int count = 0;
|
||||
char *buf = NULL;
|
||||
grub_fs_autoload_hook_t saved_autoload;
|
||||
|
||||
auto int iterate_device (const char *name);
|
||||
|
@ -48,24 +47,20 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
|
|||
|
||||
#ifdef DO_SEARCH_FILE
|
||||
{
|
||||
grub_size_t len;
|
||||
char *p;
|
||||
char *buf;
|
||||
grub_file_t file;
|
||||
|
||||
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
|
||||
p = grub_realloc (buf, len);
|
||||
if (! p)
|
||||
buf = grub_xasprintf ("(%s)%s", name, key);
|
||||
if (! buf)
|
||||
return 1;
|
||||
|
||||
buf = p;
|
||||
grub_sprintf (buf, "(%s)%s", name, key);
|
||||
|
||||
file = grub_file_open (buf);
|
||||
if (file)
|
||||
{
|
||||
found = 1;
|
||||
grub_file_close (file);
|
||||
}
|
||||
grub_free (buf);
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
@ -135,8 +130,6 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
|
|||
else
|
||||
grub_device_iterate (iterate_device);
|
||||
|
||||
grub_free (buf);
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "no such device: %s", key);
|
||||
}
|
||||
|
@ -166,9 +159,7 @@ GRUB_MOD_INIT(search_fs_label)
|
|||
cmd =
|
||||
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
|
||||
N_("NAME [VARIABLE]"),
|
||||
"Search devices by " SEARCH_TARGET "."
|
||||
" If VARIABLE is specified, "
|
||||
"the first device found is set to a variable.");
|
||||
HELP_MESSAGE);
|
||||
}
|
||||
|
||||
#ifdef DO_SEARCH_FILE
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
#define FUNC_NAME grub_search_fs_file
|
||||
#define COMMAND_NAME "search.file"
|
||||
#define SEARCH_TARGET "file"
|
||||
#define HELP_MESSAGE N_("Search devices by file. If VARIABLE is specified, the first device found is set to a variable.")
|
||||
#include "search.c"
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
#define FUNC_NAME grub_search_label
|
||||
#define COMMAND_NAME "search.fs_label"
|
||||
#define SEARCH_TARGET "filesystem label"
|
||||
#define HELP_MESSAGE N_("Search devices by label. If VARIABLE is specified, the first device found is set to a variable.")
|
||||
#include "search.c"
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
#define FUNC_NAME grub_search_fs_uuid
|
||||
#define COMMAND_NAME "search.fs_uuid"
|
||||
#define SEARCH_TARGET "filesystem UUID"
|
||||
#define HELP_MESSAGE N_("Search devices by UUID. If VARIABLE is specified, the first device found is set to a variable.")
|
||||
#include "search.c"
|
||||
|
|
340
commands/setpci.c
Normal file
340
commands/setpci.c
Normal file
|
@ -0,0 +1,340 @@
|
|||
/* lspci.c - List PCI devices. */
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
struct pci_register
|
||||
{
|
||||
const char *name;
|
||||
grub_uint16_t addr;
|
||||
unsigned size;
|
||||
};
|
||||
|
||||
struct pci_register pci_registers[] =
|
||||
{
|
||||
{"VENDOR_ID", GRUB_PCI_REG_VENDOR , 2},
|
||||
{"DEVICE_ID", GRUB_PCI_REG_DEVICE , 2},
|
||||
{"COMMAND", GRUB_PCI_REG_COMMAND , 2},
|
||||
{"STATUS", GRUB_PCI_REG_STATUS , 2},
|
||||
{"REVISION", GRUB_PCI_REG_REVISION , 1},
|
||||
{"CLASS_PROG", GRUB_PCI_REG_CLASS + 1 , 1},
|
||||
{"CLASS_DEVICE", GRUB_PCI_REG_CLASS + 2 , 2},
|
||||
{"CACHE_LINE_SIZE", GRUB_PCI_REG_CACHELINE , 1},
|
||||
{"LATENCY_TIMER", GRUB_PCI_REG_LAT_TIMER , 1},
|
||||
{"HEADER_TYPE", GRUB_PCI_REG_HEADER_TYPE , 1},
|
||||
{"BIST", GRUB_PCI_REG_BIST , 1},
|
||||
{"BASE_ADDRESS_0", GRUB_PCI_REG_ADDRESS_REG0, 4},
|
||||
{"BASE_ADDRESS_1", GRUB_PCI_REG_ADDRESS_REG1, 4},
|
||||
{"BASE_ADDRESS_2", GRUB_PCI_REG_ADDRESS_REG2, 4},
|
||||
{"BASE_ADDRESS_3", GRUB_PCI_REG_ADDRESS_REG3, 4},
|
||||
{"BASE_ADDRESS_4", GRUB_PCI_REG_ADDRESS_REG4, 4},
|
||||
{"BASE_ADDRESS_5", GRUB_PCI_REG_ADDRESS_REG5, 4},
|
||||
{"CARDBUS_CIS", GRUB_PCI_REG_CIS_POINTER , 4},
|
||||
{"SUBVENDOR_ID", GRUB_PCI_REG_SUBVENDOR , 2},
|
||||
{"SUBSYSTEM_ID", GRUB_PCI_REG_SUBSYSTEM , 2},
|
||||
{"ROM_ADDRESS", GRUB_PCI_REG_ROM_ADDRESS , 4},
|
||||
{"CAP_POINTER", GRUB_PCI_REG_CAP_POINTER , 1},
|
||||
{"INTERRUPT_LINE", GRUB_PCI_REG_IRQ_LINE , 1},
|
||||
{"INTERRUPT_PIN", GRUB_PCI_REG_IRQ_PIN , 1},
|
||||
{"MIN_GNT", GRUB_PCI_REG_MIN_GNT , 1},
|
||||
{"MAX_LAT", GRUB_PCI_REG_MIN_GNT , 1},
|
||||
};
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'd', 0, "Select device by vendor and device IDs.",
|
||||
"[vendor]:[device]", ARG_TYPE_STRING},
|
||||
{0, 's', 0, "Select device by its position on the bus.",
|
||||
"[bus]:[slot][.func]", ARG_TYPE_STRING},
|
||||
{0, 'v', 0, "Save read value into variable VARNAME.",
|
||||
"VARNAME", ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_uint32_t pciid_check_mask, pciid_check_value;
|
||||
static int bus, device, function;
|
||||
static int check_bus, check_device, check_function;
|
||||
static grub_uint32_t write_mask, regwrite;
|
||||
static int regsize;
|
||||
static grub_uint16_t regaddr;
|
||||
static const char *varname;
|
||||
|
||||
static int NESTED_FUNC_ATTR
|
||||
grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||
{
|
||||
grub_uint32_t regval = 0;
|
||||
grub_pci_address_t addr;
|
||||
|
||||
if ((pciid & pciid_check_mask) != pciid_check_value)
|
||||
return 0;
|
||||
|
||||
if (check_bus && grub_pci_get_bus (dev) != bus)
|
||||
return 0;
|
||||
|
||||
if (check_device && grub_pci_get_device (dev) != device)
|
||||
return 0;
|
||||
|
||||
if (check_function && grub_pci_get_function (dev) != device)
|
||||
return 0;
|
||||
|
||||
addr = grub_pci_make_address (dev, regaddr);
|
||||
|
||||
switch (regsize)
|
||||
{
|
||||
case 1:
|
||||
regval = grub_pci_read_byte (addr);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
regval = grub_pci_read_word (addr);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
regval = grub_pci_read (addr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (varname)
|
||||
{
|
||||
char buf[sizeof ("XXXXXXXX")];
|
||||
grub_snprintf (buf, sizeof (buf), "%x", regval);
|
||||
grub_env_set (varname, buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!write_mask)
|
||||
{
|
||||
grub_printf ("Register %x of %d:%d.%d is %x\n", regaddr,
|
||||
grub_pci_get_bus (dev),
|
||||
grub_pci_get_device (dev),
|
||||
grub_pci_get_function (dev),
|
||||
regval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
regval = (regval & ~write_mask) | regwrite;
|
||||
|
||||
switch (regsize)
|
||||
{
|
||||
case 1:
|
||||
grub_pci_write_byte (addr, regval);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
grub_pci_write_word (addr, regval);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
grub_pci_write (addr, regval);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_setpci (grub_extcmd_t cmd, int argc, char **argv)
|
||||
{
|
||||
const char *ptr;
|
||||
unsigned i;
|
||||
|
||||
pciid_check_value = 0;
|
||||
pciid_check_mask = 0;
|
||||
|
||||
if (cmd->state[0].set)
|
||||
{
|
||||
ptr = cmd->state[0].arg;
|
||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
ptr = cmd->state[0].arg;
|
||||
}
|
||||
else
|
||||
pciid_check_mask |= 0xffff;
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||
ptr++;
|
||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
||||
<< 16;
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
else
|
||||
pciid_check_mask |= 0xffff0000;
|
||||
}
|
||||
|
||||
pciid_check_value &= pciid_check_mask;
|
||||
|
||||
check_bus = check_device = check_function = 0;
|
||||
|
||||
if (cmd->state[1].set)
|
||||
{
|
||||
const char *optr;
|
||||
|
||||
ptr = cmd->state[1].arg;
|
||||
optr = ptr;
|
||||
bus = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
ptr = optr;
|
||||
}
|
||||
else
|
||||
check_bus = 1;
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||
ptr++;
|
||||
optr = ptr;
|
||||
device = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
ptr = optr;
|
||||
}
|
||||
else
|
||||
check_device = 1;
|
||||
if (*ptr == '.')
|
||||
{
|
||||
ptr++;
|
||||
function = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
check_function = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd->state[2].set)
|
||||
varname = cmd->state[2].arg;
|
||||
else
|
||||
varname = NULL;
|
||||
|
||||
write_mask = 0;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Command expected.");
|
||||
|
||||
if (argc > 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Only one command is supported.");
|
||||
|
||||
ptr = argv[0];
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (pci_registers); i++)
|
||||
{
|
||||
if (grub_strncmp (ptr, pci_registers[i].name,
|
||||
grub_strlen (pci_registers[i].name)) == 0)
|
||||
break;
|
||||
}
|
||||
if (i == ARRAY_SIZE (pci_registers))
|
||||
{
|
||||
regsize = 0;
|
||||
regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown register");
|
||||
}
|
||||
else
|
||||
{
|
||||
regaddr = pci_registers[i].addr;
|
||||
regsize = pci_registers[i].size;
|
||||
ptr += grub_strlen (pci_registers[i].name);
|
||||
}
|
||||
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
||||
if (*ptr == '+')
|
||||
{
|
||||
ptr++;
|
||||
regaddr += grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_memcmp (ptr, ".L", sizeof (".L") - 1) == 0
|
||||
|| grub_memcmp (ptr, ".l", sizeof (".l") - 1) == 0)
|
||||
{
|
||||
regsize = 4;
|
||||
ptr += sizeof (".l") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ptr, ".W", sizeof (".W") - 1) == 0
|
||||
|| grub_memcmp (ptr, ".w", sizeof (".w") - 1) == 0)
|
||||
{
|
||||
regsize = 2;
|
||||
ptr += sizeof (".w") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ptr, ".B", sizeof (".B") - 1) == 0
|
||||
|| grub_memcmp (ptr, ".b", sizeof (".b") - 1) == 0)
|
||||
{
|
||||
regsize = 1;
|
||||
ptr += sizeof (".b") - 1;
|
||||
}
|
||||
|
||||
if (!regsize)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unknown register size.");
|
||||
|
||||
write_mask = 0;
|
||||
if (*ptr == '=')
|
||||
{
|
||||
ptr++;
|
||||
regwrite = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
write_mask = 0xffffffff;
|
||||
if (*ptr == ':')
|
||||
{
|
||||
ptr++;
|
||||
write_mask = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
write_mask = 0xffffffff;
|
||||
}
|
||||
regwrite &= write_mask;
|
||||
}
|
||||
|
||||
if (write_mask && varname)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Option -v isn't valid for writes.");
|
||||
|
||||
grub_pci_iterate (grub_setpci_iter);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(setpci)
|
||||
{
|
||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
||||
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"[REGISTER][=VALUE[:MASK]]",
|
||||
"Manipulate PCI devices.", options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(setpci)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -112,10 +112,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->init)
|
||||
term->init ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
@ -152,10 +153,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->init)
|
||||
term->init ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
@ -269,10 +271,11 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->init)
|
||||
term->init ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
@ -310,10 +313,11 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
|||
break;
|
||||
if (term)
|
||||
{
|
||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||
GRUB_AS_LIST (term));
|
||||
if (term->init)
|
||||
term->init ();
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
/* This prefix is used by xnu and boot-132 to hash
|
||||
together with volume serial. */
|
||||
|
@ -61,7 +61,7 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
|||
GRUB_MD_MD5->final (&ctx);
|
||||
xnu_uuid = GRUB_MD_MD5->read (&ctx);
|
||||
|
||||
grub_sprintf (uuid_string,
|
||||
grub_snprintf (uuid_string, sizeof (uuid_string),
|
||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
|
||||
(unsigned int) xnu_uuid[2], (unsigned int) xnu_uuid[3],
|
||||
|
|
|
@ -23,14 +23,14 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/err.c kern/list.c kern/handler.c \
|
||||
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
||||
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
||||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/partition.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
|
||||
normal/handler.c normal/auth.c lib/crypto.c normal/autofs.c \
|
||||
normal/completion.c normal/main.c normal/color.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/menu.c normal/menu_entry.c \
|
||||
normal/menu_text.c normal/crypto.c normal/term.c \
|
||||
commands/terminal.c lib/charset.c \
|
||||
commands/terminal.c normal/context.c lib/charset.c \
|
||||
script/main.c script/execute.c script/function.c \
|
||||
script/lexer.c script/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
|
@ -124,3 +124,6 @@ endif
|
|||
grub_script.tab.c grub_script.tab.h: 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
|
||||
|
||||
bin_UTILITIES += grub-bin2h
|
||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||
|
|
|
@ -88,11 +88,35 @@ endif
|
|||
bin_UTILITIES += grub-mkrelpath
|
||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
||||
|
||||
bin_UTILITIES += grub-bin2h
|
||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.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.
|
||||
grub_script.tab.c grub_script.tab.h: 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
|
||||
|
||||
# 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.
|
||||
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 > $@
|
||||
|
@ -585,8 +609,8 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
||||
normal/auth.c normal/autofs.c normal/handler.c \
|
||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||
normal/menu_entry.c normal/menu_text.c normal/menu_viewer.c \
|
||||
normal/misc.c normal/crypto.c normal/term.c
|
||||
normal/menu_entry.c normal/menu_text.c \
|
||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
@ -598,7 +622,7 @@ sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# Common Video Subsystem specific modules.
|
||||
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \
|
||||
png.mod font.mod gfxterm.mod video_fb.mod
|
||||
png.mod gfxterm.mod video_fb.mod
|
||||
|
||||
# For video.mod.
|
||||
video_mod_SOURCES = video/video.c
|
||||
|
@ -641,7 +665,10 @@ png_mod_SOURCES = video/readers/png.c
|
|||
png_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For font.mod.
|
||||
pkglib_MODULES += font.mod
|
||||
ifneq (, $(FONT_SOURCE))
|
||||
font/font.c_DEPENDENCIES = ascii.h
|
||||
endif
|
||||
font_mod_SOURCES = font/font_cmd.c font/font.c
|
||||
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
font_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
|
@ -21,7 +21,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|||
kern/i386/halt.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
|
@ -35,7 +35,8 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
||||
env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||
|
@ -53,9 +54,11 @@ boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LI
|
|||
boot_img_FORMAT = binary
|
||||
|
||||
bin_UTILITIES += grub-mkimage
|
||||
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c gnulib/progname.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
|
||||
pkglib_IMAGES += kernel.img
|
||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||
|
@ -65,7 +68,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|||
kern/i386/halt.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
|
@ -79,7 +82,8 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
|
||||
env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
|
@ -102,7 +106,7 @@ bin_SCRIPTS += grub-mkrescue
|
|||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = linux.mod multiboot.mod \
|
||||
pkglib_MODULES = linux.mod \
|
||||
aout.mod play.mod serial.mod \
|
||||
memdisk.mod pci.mod lspci.mod reboot.mod \
|
||||
halt.mod datetime.mod date.mod datehook.mod \
|
||||
|
@ -136,20 +140,10 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For serial.mod.
|
||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
||||
serial_mod_SOURCES = term/serial.c
|
||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For aout.mod.
|
||||
aout_mod_SOURCES = loader/aout.c
|
||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -183,7 +177,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
|
|
@ -30,16 +30,17 @@ sbin_SCRIPTS = grub-install
|
|||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
pkglib_MODULES = chain.mod appleldr.mod \
|
||||
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
||||
fixvideo.mod mmap.mod acpi.mod
|
||||
|
||||
# For kernel.img.
|
||||
kernel_img_EXPORTS = no
|
||||
kernel_img_RELOCATABLE = yes
|
||||
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||
|
@ -51,7 +52,8 @@ kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
|||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
|
||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h \
|
||||
i18n.h env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
|
@ -19,7 +19,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
|||
kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
kern/env.c \
|
||||
|
@ -33,7 +33,7 @@ kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
|
||||
list.h handler.h command.h i18n.h
|
||||
list.h handler.h command.h i18n.h env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
||||
|
@ -92,7 +92,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For serial.mod.
|
||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
||||
serial_mod_SOURCES = term/serial.c
|
||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
@ -122,7 +122,7 @@ lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
|||
kern/i386/misc.S \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
||||
|
@ -64,7 +64,8 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
|
||||
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h i18n.h
|
||||
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h \
|
||||
i18n.h env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
||||
|
@ -84,10 +85,10 @@ bin_UTILITIES = grub-mkimage
|
|||
sbin_UTILITIES = grub-setup
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-setup.
|
||||
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||
|
@ -116,7 +117,7 @@ bin_SCRIPTS += grub-mkrescue
|
|||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||
|
||||
pkglib_MODULES = biosdisk.mod chain.mod \
|
||||
multiboot.mod reboot.mod halt.mod \
|
||||
reboot.mod halt.mod \
|
||||
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
|
||||
vga.mod memdisk.mod pci.mod lspci.mod \
|
||||
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
||||
|
@ -197,20 +198,10 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For serial.mod.
|
||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
||||
serial_mod_SOURCES = term/serial.c
|
||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_helper.S \
|
||||
loader/i386/pc/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For vbe.mod.
|
||||
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
||||
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -303,7 +294,7 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += at_keyboard.mod
|
||||
at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c
|
||||
at_keyboard_mod_SOURCES = term/at_keyboard.c
|
||||
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
@ -25,3 +25,25 @@ pkglib_MODULES += ata.mod
|
|||
ata_mod_SOURCES = disk/ata.c
|
||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For setpci.mod
|
||||
pkglib_MODULES += setpci.mod
|
||||
setpci_mod_SOURCES = commands/setpci.c
|
||||
setpci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
setpci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += multiboot.mod
|
||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_mbi.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
pkglib_MODULES += multiboot2.mod
|
||||
multiboot2_mod_SOURCES = loader/i386/multiboot.c \
|
||||
loader/i386/multiboot_mbi.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
||||
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
|
23
conf/mips-qemu-mips.rmk
Normal file
23
conf/mips-qemu-mips.rmk
Normal file
|
@ -0,0 +1,23 @@
|
|||
# -*- makefile -*-
|
||||
LINK_BASE = 0x80010000
|
||||
target_machine=qemu-mips
|
||||
COMMON_CFLAGS += -march=mips3
|
||||
COMMON_ASFLAGS += -march=mips3
|
||||
include $(srcdir)/conf/mips.mk
|
||||
|
||||
pkglib_IMAGES = kernel.img
|
||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||
symlist.c kern/$(target_cpu)/cache.S
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_FORMAT = binary
|
79
conf/mips-yeeloong.rmk
Normal file
79
conf/mips-yeeloong.rmk
Normal file
|
@ -0,0 +1,79 @@
|
|||
# -*- makefile -*-
|
||||
LINK_BASE = 0x80200000
|
||||
target_machine=yeeloong
|
||||
COMMON_CFLAGS += -march=mips3
|
||||
COMMON_ASFLAGS += -march=mips3
|
||||
include $(srcdir)/conf/mips.mk
|
||||
|
||||
pkglib_IMAGES = kernel.img
|
||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||
kern/$(target_cpu)/cache.S \
|
||||
\
|
||||
term/at_keyboard.c \
|
||||
font/font_cmd.c font/font.c io/bufio.c \
|
||||
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
|
||||
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
|
||||
video/sm712.c bus/pci.c bus/bonito.c \
|
||||
term/gfxterm.c commands/extcmd.c lib/arg.c \
|
||||
symlist.c
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
||||
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||
kernel_img_FORMAT = binary
|
||||
|
||||
# For ata.mod.
|
||||
pkglib_MODULES += ata.mod
|
||||
ata_mod_SOURCES = disk/ata.c
|
||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For lspci.mod
|
||||
pkglib_MODULES += lspci.mod
|
||||
lspci_mod_SOURCES = commands/lspci.c
|
||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ata_pthru.mod.
|
||||
pkglib_MODULES += ata_pthru.mod
|
||||
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
||||
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For mmap.mod.
|
||||
pkglib_MODULES += mmap.mod
|
||||
mmap_mod_SOURCES = mmap/mmap.c mmap/mips/yeeloong/uppermem.c
|
||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For datetime.mod
|
||||
pkglib_MODULES += datetime.mod
|
||||
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For date.mod
|
||||
pkglib_MODULES += date.mod
|
||||
date_mod_SOURCES = commands/date.c
|
||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For datehook.mod
|
||||
pkglib_MODULES += datehook.mod
|
||||
datehook_mod_SOURCES = hook/datehook.c
|
||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
grub_install_SOURCES = util/grub-install.in
|
||||
|
82
conf/mips.rmk
Normal file
82
conf/mips.rmk
Normal file
|
@ -0,0 +1,82 @@
|
|||
|
||||
# -*- makefile -*-
|
||||
|
||||
COMMON_ASFLAGS += -nostdinc
|
||||
COMMON_CFLAGS += -ffreestanding -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
||||
COMMON_LDFLAGS += -nostdlib
|
||||
|
||||
# Used by various components. These rules need to precede them.
|
||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||
|
||||
# Images.
|
||||
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
||||
symbol.h term.h time.h types.h loader.h partition.h \
|
||||
msdos_partition.h machine/kernel.h handler.h list.h \
|
||||
command.h machine/memory.h cpu/libgcc.h cpu/cache.h i18n.h env_private.h
|
||||
|
||||
ifeq ($(platform), yeeloong)
|
||||
kernel_img_HEADERS += pci.h
|
||||
endif
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS =
|
||||
bin_SCRIPTS =
|
||||
|
||||
# For grub-mkimage.
|
||||
bin_UTILITIES += grub-mkimage
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = memdisk.mod \
|
||||
lsmmap.mod
|
||||
|
||||
# For boot.mod.
|
||||
pkglib_MODULES += boot.mod
|
||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For memdisk.mod.
|
||||
memdisk_mod_SOURCES = disk/memdisk.c
|
||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For lsmmap.mod
|
||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For serial.mod.
|
||||
pkglib_MODULES += serial.mod
|
||||
serial_mod_SOURCES = term/serial.c
|
||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For relocator.mod.
|
||||
pkglib_MODULES += relocator.mod
|
||||
relocator_mod_SOURCES = lib/$(target_cpu)/relocator.c lib/$(target_cpu)/relocator_asm.S
|
||||
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += linux.mod
|
||||
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/common.mk
|
|
@ -17,7 +17,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
|
||||
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
|
||||
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
|
||||
command.h i18n.h
|
||||
command.h i18n.h env_private.h
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
@ -31,7 +31,7 @@ pkglib_PROGRAMS = kernel.img
|
|||
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/ieee1275/init.c \
|
||||
|
@ -61,7 +61,6 @@ pkglib_MODULES = halt.mod \
|
|||
linux.mod \
|
||||
reboot.mod \
|
||||
suspend.mod \
|
||||
multiboot.mod \
|
||||
memdisk.mod \
|
||||
lsmmap.mod
|
||||
|
||||
|
@ -91,13 +90,6 @@ halt_mod_SOURCES = commands/halt.c
|
|||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For multiboot.mod
|
||||
multiboot_mod_SOURCES = loader/ieee1275/multiboot2.c \
|
||||
loader/multiboot2.c \
|
||||
loader/multiboot_loader.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For memdisk.mod.
|
||||
memdisk_mod_SOURCES = disk/memdisk.c
|
||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -31,11 +31,11 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
list.h handler.h command.h i18n.h \
|
||||
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
|
||||
sparc64/ieee1275/ieee1275.h
|
||||
sparc64/ieee1275/ieee1275.h env_private.h
|
||||
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/sparc64/ieee1275/ieee1275.c \
|
||||
|
|
50
conf/tests.rmk
Normal file
50
conf/tests.rmk
Normal file
|
@ -0,0 +1,50 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
# For grub-shell
|
||||
grub-shell: tests/util/grub-shell.in config.status
|
||||
./config.status --file=$@:$<
|
||||
chmod +x $@
|
||||
check_SCRIPTS += grub-shell
|
||||
CLEANFILES += grub-shell
|
||||
|
||||
# For grub-shell-tester
|
||||
grub-shell-tester: tests/util/grub-shell-tester.in config.status
|
||||
./config.status --file=$@:$<
|
||||
chmod +x $@
|
||||
check_SCRIPTS += grub-shell-tester
|
||||
CLEANFILES += grub-shell-tester
|
||||
|
||||
pkglib_MODULES += functional_test.mod
|
||||
functional_test_mod_SOURCES = tests/lib/functional_test.c tests/lib/test.c
|
||||
functional_test_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Rules for unit tests
|
||||
check_UTILITIES += example_unit_test
|
||||
example_unit_test_SOURCES = tests/example_unit_test.c kern/list.c kern/misc.c tests/lib/test.c tests/lib/unit_test.c
|
||||
example_unit_test_CFLAGS = -Wno-format
|
||||
|
||||
# Rules for functional tests
|
||||
pkglib_MODULES += example_functional_test.mod
|
||||
example_functional_test_mod_SOURCES = tests/example_functional_test.c
|
||||
example_functional_test_mod_CFLAGS = -Wno-format $(COMMON_CFLAGS)
|
||||
example_functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Rules for scripted tests
|
||||
check_SCRIPTS += example_scripted_test
|
||||
example_scripted_test_SOURCES = tests/example_scripted_test.in
|
||||
|
||||
check_SCRIPTS += example_grub_script_test
|
||||
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
|
||||
|
||||
|
||||
# List of tests to execute on "make check"
|
||||
SCRIPTED_TESTS = example_scripted_test
|
||||
SCRIPTED_TESTS += example_grub_script_test
|
||||
UNIT_TESTS = example_unit_test
|
||||
FUNCTIONAL_TESTS = example_functional_test.mod
|
||||
|
||||
# dependencies between tests and testing-tools
|
||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||
$(FUNCTIONAL_TESTS): functional_test.mod
|
||||
|
|
@ -29,17 +29,18 @@ sbin_SCRIPTS = grub-install
|
|||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
pkglib_MODULES = chain.mod appleldr.mod \
|
||||
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
||||
fixvideo.mod mmap.mod acpi.mod ata.mod
|
||||
fixvideo.mod mmap.mod acpi.mod
|
||||
|
||||
# For kernel.img.
|
||||
kernel_img_EXPORTS = no
|
||||
kernel_img_RELOCATABLE = yes
|
||||
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||
|
@ -51,7 +52,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
|||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
|
||||
handler.h command.h i18n.h
|
||||
handler.h command.h i18n.h env_private.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
@ -77,11 +78,6 @@ acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
|||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ata.mod
|
||||
ata_mod_SOURCES = disk/ata.c
|
||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For mmap.mod.
|
||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
|
||||
mmap/efi/mmap.c
|
||||
|
@ -166,10 +162,5 @@ xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
pkglib_MODULES += relocator.mod
|
||||
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
|
||||
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
include $(srcdir)/conf/i386.mk
|
||||
include $(srcdir)/conf/common.mk
|
||||
|
|
34
config.rpath
34
config.rpath
|
@ -2,7 +2,7 @@
|
|||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2007 Free Software Foundation, Inc.
|
||||
# Copyright 1996-2008 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
|
@ -47,7 +47,7 @@ for cc_temp in $CC""; do
|
|||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
|
@ -64,7 +64,7 @@ else
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2*)
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
|
@ -76,7 +76,13 @@ else
|
|||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
case $cc_basename in
|
||||
icc* | ecc*)
|
||||
ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
icc* | ifort*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
lf95*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
pgcc | pgf77 | pgf90)
|
||||
|
@ -124,7 +130,7 @@ else
|
|||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
|
@ -132,7 +138,7 @@ hardcode_direct=no
|
|||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
|
@ -158,7 +164,7 @@ if test "$with_gnu_ld" = yes; then
|
|||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
|
@ -182,7 +188,7 @@ if test "$with_gnu_ld" = yes; then
|
|||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
|
@ -254,7 +260,7 @@ else
|
|||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
|
@ -264,7 +270,7 @@ else
|
|||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
|
@ -326,7 +332,7 @@ else
|
|||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
|
@ -494,7 +500,7 @@ else
|
|||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
|
@ -505,7 +511,7 @@ case "$host_os" in
|
|||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
aix[4-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
|
@ -517,7 +523,7 @@ case "$host_os" in
|
|||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
|
|
37
configure.ac
37
configure.ac
|
@ -52,6 +52,16 @@ fi
|
|||
case "$target_cpu" in
|
||||
i[[3456]]86) target_cpu=i386 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
mipsel|mips64el)
|
||||
target_cpu=mips;
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
;;
|
||||
mips|mips64)
|
||||
target_cpu=mips;
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
|
||||
CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
|
||||
;;
|
||||
esac
|
||||
|
||||
# Specify the platform (such as firmware).
|
||||
|
@ -69,6 +79,7 @@ if test "x$with_platform" = x; then
|
|||
powerpc-*) platform=ieee1275 ;;
|
||||
powerpc64-*) platform=ieee1275 ;;
|
||||
sparc64-*) platform=ieee1275 ;;
|
||||
mips-*) platform=yeeloong ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
else
|
||||
|
@ -95,6 +106,8 @@ case "$target_cpu"-"$platform" in
|
|||
i386-qemu) ;;
|
||||
powerpc-ieee1275) ;;
|
||||
sparc64-ieee1275) ;;
|
||||
mips-qemu-mips) ;;
|
||||
mips-yeeloong) ;;
|
||||
*-emu) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
|
@ -125,6 +138,8 @@ case "$platform" in
|
|||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
||||
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||
|
@ -153,7 +168,7 @@ if test "x$YACC" = x; then
|
|||
AC_MSG_ERROR([bison is not found])
|
||||
fi
|
||||
|
||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
|
||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
|
||||
if test -e $file ; then
|
||||
AC_SUBST([FONT_SOURCE], [$file])
|
||||
break
|
||||
|
@ -206,7 +221,7 @@ AC_HEADER_MAJOR
|
|||
AC_HEADER_DIRENT
|
||||
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
|
||||
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
|
||||
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h)
|
||||
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
|
||||
|
||||
#
|
||||
# Check for target programs.
|
||||
|
@ -423,18 +438,26 @@ AC_SUBST(TARGET_ASFLAGS)
|
|||
AC_SUBST(TARGET_CPPFLAGS)
|
||||
AC_SUBST(TARGET_LDFLAGS)
|
||||
|
||||
# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2)
|
||||
|
||||
# Set them to their new values for the tests below.
|
||||
CC="$TARGET_CC"
|
||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=-lgcc
|
||||
|
||||
# Check for libgcc symbols
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
|
||||
|
||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=""
|
||||
|
||||
# Defined in aclocal.m4.
|
||||
grub_PROG_TARGET_CC
|
||||
|
|
62
disk/ata.c
62
disk/ata.c
|
@ -26,8 +26,8 @@
|
|||
#include <grub/scsi.h>
|
||||
|
||||
/* At the moment, only two IDE ports are supported. */
|
||||
static const int grub_ata_ioaddress[] = { 0x1f0, 0x170 };
|
||||
static const int grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
|
||||
static const grub_port_t grub_ata_ioaddress[] = { 0x1f0, 0x170 };
|
||||
static const grub_port_t grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
|
||||
|
||||
static struct grub_ata_device *grub_ata_devices;
|
||||
|
||||
|
@ -347,8 +347,8 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
|||
/* Setup the device information. */
|
||||
dev->port = port;
|
||||
dev->device = device;
|
||||
dev->ioaddress = addr;
|
||||
dev->ioaddress2 = addr2;
|
||||
dev->ioaddress = addr + GRUB_MACHINE_PCI_IO_BASE;
|
||||
dev->ioaddress2 = addr2 + GRUB_MACHINE_PCI_IO_BASE;
|
||||
dev->next = NULL;
|
||||
|
||||
grub_ata_regset (dev, GRUB_ATA_REG_DISK, dev->device << 4);
|
||||
|
@ -389,7 +389,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
|||
|
||||
static int NESTED_FUNC_ATTR
|
||||
grub_ata_pciinit (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid __attribute__((unused)))
|
||||
grub_pci_id_t pciid)
|
||||
{
|
||||
static int compat_use[2] = { 0 };
|
||||
grub_pci_address_t addr;
|
||||
|
@ -400,19 +400,34 @@ grub_ata_pciinit (grub_pci_device_t dev,
|
|||
int regb;
|
||||
int i;
|
||||
static int controller = 0;
|
||||
int cs5536 = 0;
|
||||
int nports = 2;
|
||||
|
||||
/* Read class. */
|
||||
addr = grub_pci_make_address (dev, 2);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class = grub_pci_read (addr);
|
||||
|
||||
/* AMD CS5536 Southbridge. */
|
||||
if (pciid == 0x208f1022)
|
||||
{
|
||||
cs5536 = 1;
|
||||
nports = 1;
|
||||
}
|
||||
|
||||
/* Check if this class ID matches that of a PCI IDE Controller. */
|
||||
if (class >> 16 != 0x0101)
|
||||
if (!cs5536 && (class >> 16 != 0x0101))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < nports; i++)
|
||||
{
|
||||
/* Set to 0 when the channel operated in compatibility mode. */
|
||||
int compat = (class >> (8 + 2 * i)) & 1;
|
||||
int compat;
|
||||
|
||||
/* We don't support non-compatibility mode for CS5536. */
|
||||
if (cs5536)
|
||||
compat = 0;
|
||||
else
|
||||
compat = (class >> (8 + 2 * i)) & 1;
|
||||
|
||||
rega = 0;
|
||||
regb = 0;
|
||||
|
@ -429,9 +444,12 @@ grub_ata_pciinit (grub_pci_device_t dev,
|
|||
{
|
||||
/* Read the BARs, which either contain a mmapped IO address
|
||||
or the IO port address. */
|
||||
addr = grub_pci_make_address (dev, 4 + 2 * i);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESSES
|
||||
+ sizeof (grub_uint64_t) * i);
|
||||
bar1 = grub_pci_read (addr);
|
||||
addr = grub_pci_make_address (dev, 5 + 2 * i);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESSES
|
||||
+ sizeof (grub_uint64_t) * i
|
||||
+ sizeof (grub_uint32_t));
|
||||
bar2 = grub_pci_read (addr);
|
||||
|
||||
/* Check if the BARs describe an IO region. */
|
||||
|
@ -485,7 +503,6 @@ grub_ata_initialize (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
grub_ata_setlba (struct grub_ata_device *dev, grub_disk_addr_t sector,
|
||||
grub_size_t size)
|
||||
|
@ -648,12 +665,14 @@ grub_ata_iterate (int (*hook) (const char *name))
|
|||
|
||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||
{
|
||||
char devname[5];
|
||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
||||
char devname[10];
|
||||
|
||||
if (dev->atapi)
|
||||
continue;
|
||||
|
||||
grub_snprintf (devname, sizeof (devname),
|
||||
"ata%d", dev->port * 2 + dev->device);
|
||||
|
||||
if (hook (devname))
|
||||
return 1;
|
||||
}
|
||||
|
@ -668,8 +687,9 @@ grub_ata_open (const char *name, grub_disk_t disk)
|
|||
|
||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||
{
|
||||
char devname[5];
|
||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
||||
char devname[10];
|
||||
grub_snprintf (devname, sizeof (devname),
|
||||
"ata%d", dev->port * 2 + dev->device);
|
||||
if (grub_strcmp (name, devname) == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -735,8 +755,9 @@ grub_atapi_iterate (int (*hook) (const char *name, int luns))
|
|||
|
||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||
{
|
||||
char devname[7];
|
||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
||||
char devname[10];
|
||||
grub_snprintf (devname, sizeof (devname),
|
||||
"ata%d", dev->port * 2 + dev->device);
|
||||
|
||||
if (! dev->atapi)
|
||||
continue;
|
||||
|
@ -808,8 +829,9 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
|
|||
|
||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||
{
|
||||
char devname[7];
|
||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
||||
char devname[10];
|
||||
grub_snprintf (devname, sizeof (devname),
|
||||
"ata%d", dev->port * 2 + dev->device);
|
||||
|
||||
if (!grub_strcmp (devname, name))
|
||||
{
|
||||
|
|
|
@ -440,7 +440,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
|||
|
||||
for (d = fd_devices, count = 0; d; d = d->next, count++)
|
||||
{
|
||||
grub_sprintf (buf, "fd%d", count);
|
||||
grub_snprintf (buf, sizeof (buf), "fd%d", count);
|
||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||
if (hook (buf))
|
||||
return 1;
|
||||
|
@ -448,7 +448,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
|||
|
||||
for (d = hd_devices, count = 0; d; d = d->next, count++)
|
||||
{
|
||||
grub_sprintf (buf, "hd%d", count);
|
||||
grub_snprintf (buf, sizeof (buf), "hd%d", count);
|
||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||
if (hook (buf))
|
||||
return 1;
|
||||
|
@ -456,7 +456,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
|||
|
||||
for (d = cd_devices, count = 0; d; d = d->next, count++)
|
||||
{
|
||||
grub_sprintf (buf, "cd%d", count);
|
||||
grub_snprintf (buf, sizeof (buf), "cd%d", count);
|
||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||
if (hook (buf))
|
||||
return 1;
|
||||
|
@ -805,18 +805,10 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
device_name = grub_malloc (grub_strlen (parent->name) + 1
|
||||
+ grub_strlen (partition_name) + 1);
|
||||
if (! device_name)
|
||||
{
|
||||
grub_free (partition_name);
|
||||
grub_disk_close (parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_sprintf (device_name, "%s,%s", parent->name, partition_name);
|
||||
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
|
||||
grub_free (partition_name);
|
||||
grub_disk_close (parent);
|
||||
|
||||
return device_name;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -56,7 +56,8 @@ grub_biosdisk_call_hook (int (*hook) (const char *name), int drive)
|
|||
{
|
||||
char name[10];
|
||||
|
||||
grub_sprintf (name, (drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
|
||||
grub_snprintf (name, sizeof (name),
|
||||
(drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
|
||||
return hook (name);
|
||||
}
|
||||
|
||||
|
@ -306,8 +307,17 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
while (size)
|
||||
{
|
||||
grub_size_t len;
|
||||
grub_size_t cdoff = 0;
|
||||
|
||||
len = get_safe_sectors (sector, data->sectors);
|
||||
|
||||
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||
{
|
||||
cdoff = (sector & 3) << GRUB_DISK_SECTOR_BITS;
|
||||
len = ALIGN_UP (sector + len, 4) - (sector & ~3);
|
||||
sector &= ~3;
|
||||
}
|
||||
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
|
@ -315,7 +325,7 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
GRUB_MEMORY_MACHINE_SCRATCH_SEG))
|
||||
return grub_errno;
|
||||
|
||||
grub_memcpy (buf, (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR,
|
||||
grub_memcpy (buf, (void *) (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + cdoff),
|
||||
len << GRUB_DISK_SECTOR_BITS);
|
||||
buf += len << GRUB_DISK_SECTOR_BITS;
|
||||
sector += len;
|
||||
|
@ -331,6 +341,9 @@ grub_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
struct grub_biosdisk_data *data = disk->data;
|
||||
|
||||
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||
return grub_error (GRUB_ERR_IO, "can't write to CDROM");
|
||||
|
||||
while (size)
|
||||
{
|
||||
grub_size_t len;
|
||||
|
|
|
@ -118,7 +118,7 @@ grub_ofdisk_iterate (int (*hook) (const char *name))
|
|||
static char *
|
||||
compute_dev_path (const char *name)
|
||||
{
|
||||
char *devpath = grub_malloc (grub_strlen (name) + 2);
|
||||
char *devpath = grub_malloc (grub_strlen (name) + 3);
|
||||
char *p, c;
|
||||
|
||||
if (!devpath)
|
||||
|
|
|
@ -556,7 +556,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
|
|||
}
|
||||
}
|
||||
|
||||
array->name = grub_malloc (13);
|
||||
array->name = grub_xasprintf ("md%d", array->number);
|
||||
if (! array->name)
|
||||
{
|
||||
grub_free (array->uuid);
|
||||
|
@ -565,8 +565,6 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_sprintf (array->name, "md%d", array->number);
|
||||
|
||||
grub_dprintf ("raid", "Found array %s (%s)\n", array->name,
|
||||
scanner_name);
|
||||
|
||||
|
|
|
@ -197,7 +197,6 @@ grub_scsi_iterate (int (*hook) (const char *name))
|
|||
|
||||
int scsi_iterate (const char *name, int luns)
|
||||
{
|
||||
char sname[40];
|
||||
int i;
|
||||
|
||||
/* In case of a single LUN, just return `usbX'. */
|
||||
|
@ -208,9 +207,13 @@ grub_scsi_iterate (int (*hook) (const char *name))
|
|||
distinguish it. */
|
||||
for (i = 0; i < luns; i++)
|
||||
{
|
||||
grub_sprintf (sname, "%s%c", name, 'a' + i);
|
||||
char *sname;
|
||||
sname = grub_xasprintf ("%s%c", name, 'a' + i);
|
||||
if (!sname)
|
||||
return 1;
|
||||
if (hook (sname))
|
||||
return 1;
|
||||
grub_free (sname);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
10
disk/usbms.c
10
disk/usbms.c
|
@ -200,11 +200,15 @@ grub_usbms_iterate (int (*hook) (const char *name, int luns))
|
|||
|
||||
for (p = grub_usbms_dev_list; p; p = p->next)
|
||||
{
|
||||
char devname[20];
|
||||
grub_sprintf (devname, "usb%d", cnt);
|
||||
char *devname;
|
||||
devname = grub_xasprintf ("usb%d", cnt);
|
||||
|
||||
if (hook (devname, p->luns))
|
||||
return 1;
|
||||
{
|
||||
grub_free (devname);
|
||||
return 1;
|
||||
}
|
||||
grub_free (devname);
|
||||
cnt++;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,12 +255,11 @@ grub_efiemu_autocore (void)
|
|||
|
||||
suffix = grub_efiemu_get_default_core_name ();
|
||||
|
||||
filename = grub_malloc (grub_strlen (prefix) + grub_strlen (suffix) + 2);
|
||||
filename = grub_xasprintf ("%s/%s", prefix, suffix);
|
||||
if (! filename)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate temporary space");
|
||||
|
||||
grub_sprintf (filename, "%s/%s", prefix, suffix);
|
||||
|
||||
err = grub_efiemu_load_file (filename);
|
||||
grub_free (filename);
|
||||
|
|
119
font/font.c
119
font/font.c
|
@ -1,7 +1,7 @@
|
|||
/* font.c - Font API and font file loader. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,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
|
||||
|
@ -26,6 +26,11 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/fontformat.h>
|
||||
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
#include "ascii.h"
|
||||
#endif
|
||||
|
||||
#ifndef FONT_DEBUG
|
||||
#define FONT_DEBUG 0
|
||||
|
@ -43,6 +48,7 @@ struct char_index_entry
|
|||
|
||||
#define FONT_WEIGHT_NORMAL 100
|
||||
#define FONT_WEIGHT_BOLD 200
|
||||
#define ASCII_BITMAP_SIZE 16
|
||||
|
||||
struct grub_font
|
||||
{
|
||||
|
@ -84,19 +90,6 @@ struct font_file_section
|
|||
int eof;
|
||||
};
|
||||
|
||||
/* Font file format constants. */
|
||||
static const char pff2_magic[4] = { 'P', 'F', 'F', '2' };
|
||||
static const char section_names_file[4] = { 'F', 'I', 'L', 'E' };
|
||||
static const char section_names_font_name[4] = { 'N', 'A', 'M', 'E' };
|
||||
static const char section_names_point_size[4] = { 'P', 'T', 'S', 'Z' };
|
||||
static const char section_names_weight[4] = { 'W', 'E', 'I', 'G' };
|
||||
static const char section_names_max_char_width[4] = { 'M', 'A', 'X', 'W' };
|
||||
static const char section_names_max_char_height[4] = { 'M', 'A', 'X', 'H' };
|
||||
static const char section_names_ascent[4] = { 'A', 'S', 'C', 'E' };
|
||||
static const char section_names_descent[4] = { 'D', 'E', 'S', 'C' };
|
||||
static const char section_names_char_index[4] = { 'C', 'H', 'I', 'X' };
|
||||
static const char section_names_data[4] = { 'D', 'A', 'T', 'A' };
|
||||
|
||||
/* Replace unknown glyphs with a rounded question mark. */
|
||||
static grub_uint8_t unknown_glyph_bitmap[] =
|
||||
{
|
||||
|
@ -130,6 +123,48 @@ static struct grub_font null_font;
|
|||
/* Flag to ensure module is initialized only once. */
|
||||
static grub_uint8_t font_loader_initialized;
|
||||
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
static struct grub_font_glyph *ascii_font_glyph[0x80];
|
||||
#endif
|
||||
|
||||
static struct grub_font_glyph *
|
||||
ascii_glyph_lookup (grub_uint32_t code)
|
||||
{
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
static int ascii_failback_initialized = 0;
|
||||
|
||||
if (code >= 0x80)
|
||||
return unknown_glyph;
|
||||
|
||||
if (ascii_failback_initialized == 0)
|
||||
{
|
||||
int current;
|
||||
for (current = 0; current < 0x80; current++)
|
||||
{
|
||||
ascii_font_glyph[current] = grub_malloc(sizeof(struct grub_font_glyph)
|
||||
+ ASCII_BITMAP_SIZE);
|
||||
|
||||
ascii_font_glyph[current]->width = 8;
|
||||
ascii_font_glyph[current]->height = 16;
|
||||
ascii_font_glyph[current]->offset_x = 0;
|
||||
ascii_font_glyph[current]->offset_y = -2;
|
||||
ascii_font_glyph[current]->device_width = 8;
|
||||
|
||||
grub_memcpy (ascii_font_glyph[current]->bitmap,
|
||||
&ascii_bitmaps[(0x7f - current) * ASCII_BITMAP_SIZE],
|
||||
ASCII_BITMAP_SIZE);
|
||||
}
|
||||
|
||||
ascii_failback_initialized = 1;
|
||||
}
|
||||
|
||||
return ascii_font_glyph[code];
|
||||
#else
|
||||
(void) code;
|
||||
return unknown_glyph;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
grub_font_loader_init (void)
|
||||
{
|
||||
|
@ -413,7 +448,8 @@ grub_font_load (const char *filename)
|
|||
#if FONT_DEBUG >= 3
|
||||
grub_printf("opened FILE section\n");
|
||||
#endif
|
||||
if (grub_memcmp (section.name, section_names_file, 4) != 0)
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FILE,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"font file format error: 1st section must be FILE");
|
||||
|
@ -442,7 +478,7 @@ grub_font_load (const char *filename)
|
|||
grub_printf("read magic ok\n");
|
||||
#endif
|
||||
|
||||
if (grub_memcmp (magic, pff2_magic, 4) != 0)
|
||||
if (grub_memcmp (magic, FONT_FORMAT_PFF2_MAGIC, 4) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT, "invalid font magic %x %x %x %x",
|
||||
magic[0], magic[1], magic[2], magic[3]);
|
||||
|
@ -482,18 +518,22 @@ grub_font_load (const char *filename)
|
|||
section.name[2], section.name[3]);
|
||||
#endif
|
||||
|
||||
if (grub_memcmp (section.name, section_names_font_name, 4) == 0)
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_point_size, 4) == 0)
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_POINT_SIZE,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_POINT_SIZE) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->point_size) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_weight, 4) == 0)
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_WEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_WEIGHT) - 1) == 0)
|
||||
{
|
||||
char *wt;
|
||||
wt = read_section_as_string (§ion);
|
||||
|
@ -506,32 +546,42 @@ grub_font_load (const char *filename)
|
|||
font->weight = FONT_WEIGHT_BOLD;
|
||||
grub_free (wt);
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_max_char_width, 4) == 0)
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_width) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_max_char_height, 4) == 0)
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_height) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_ascent, 4) == 0)
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_ASCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_ASCENT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->ascent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_descent, 4) == 0)
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DESCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_DESCENT) - 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->descent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_char_index, 4) == 0)
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_CHAR_INDEX,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) - 1) == 0)
|
||||
{
|
||||
if (load_font_index (file, section.length, font) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, section_names_data, 4) == 0)
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DATA,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_DATA) - 1) == 0)
|
||||
{
|
||||
/* When the DATA section marker is reached, we stop reading. */
|
||||
break;
|
||||
|
@ -618,7 +668,7 @@ find_glyph (const grub_font_t font, grub_uint32_t code)
|
|||
table = font->char_index;
|
||||
|
||||
/* Use BMP index if possible. */
|
||||
if (code < 0x10000)
|
||||
if (code < 0x10000 && font->bmp_idx)
|
||||
{
|
||||
if (font->bmp_idx[code] == 0xffff)
|
||||
return 0;
|
||||
|
@ -887,15 +937,18 @@ grub_font_get_string_width (grub_font_t font, const char *str)
|
|||
}
|
||||
|
||||
/* Get the glyph for FONT corresponding to the Unicode code point CODE.
|
||||
Returns a pointer to an glyph indicating there is no glyph available
|
||||
if CODE does not exist in the font. The glyphs are cached once loaded. */
|
||||
Returns the ASCII glyph for the code if no other fonts are available.
|
||||
The glyphs are cached once loaded. */
|
||||
struct grub_font_glyph *
|
||||
grub_font_get_glyph (grub_font_t font, grub_uint32_t code)
|
||||
{
|
||||
struct grub_font_glyph *glyph;
|
||||
glyph = grub_font_get_glyph_internal (font, code);
|
||||
struct grub_font_glyph *glyph = 0;
|
||||
if (font)
|
||||
glyph = grub_font_get_glyph_internal (font, code);
|
||||
if (glyph == 0)
|
||||
glyph = unknown_glyph;
|
||||
{
|
||||
glyph = ascii_glyph_lookup (code);
|
||||
}
|
||||
return glyph;
|
||||
}
|
||||
|
||||
|
@ -990,8 +1043,8 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||
if (best_glyph)
|
||||
return best_glyph;
|
||||
else
|
||||
/* Glyph not available in any font. Return unknown glyph. */
|
||||
return unknown_glyph;
|
||||
/* Glyph not available in any font. Return ASCII failback. */
|
||||
return ascii_glyph_lookup (code);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -280,8 +280,10 @@ grub_cpio_open (grub_file_t file, const char *name)
|
|||
|
||||
/* Compare NAME and FN by hand in order to cope with duplicate
|
||||
slashes. */
|
||||
i = 1;
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (name[i] == '/')
|
||||
i++;
|
||||
while (1)
|
||||
{
|
||||
if (name[i] != fn[j])
|
||||
|
@ -290,13 +292,16 @@ grub_cpio_open (grub_file_t file, const char *name)
|
|||
if (name[i] == '\0')
|
||||
break;
|
||||
|
||||
if (name[i] == '/' && name[i+1] == '/')
|
||||
while (name[i] == '/' && name[i+1] == '/')
|
||||
i++;
|
||||
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if (name[i] != fn[j])
|
||||
goto no_match;
|
||||
|
||||
file->data = data;
|
||||
file->size = data->size;
|
||||
grub_free (fn);
|
||||
|
|
15
fs/ext2.c
15
fs/ext2.c
|
@ -875,12 +875,15 @@ grub_ext2_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_ext2_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (40 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7]));
|
||||
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->sblock.uuid[0]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[4]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[7]));
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
6
fs/fat.c
6
fs/fat.c
|
@ -833,9 +833,9 @@ grub_fat_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_fat_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (sizeof ("xxxx-xxxx"));
|
||||
grub_sprintf (*uuid, "%04x-%04x", (grub_uint16_t) (data->uuid >> 16),
|
||||
(grub_uint16_t) data->uuid);
|
||||
*uuid = grub_xasprintf ("%04x-%04x",
|
||||
(grub_uint16_t) (data->uuid >> 16),
|
||||
(grub_uint16_t) data->uuid);
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
7
fs/hfs.c
7
fs/hfs.c
|
@ -1082,10 +1082,9 @@ grub_hfs_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_hfs_mount (device->disk);
|
||||
if (data && data->sblock.num_serial != 0)
|
||||
{
|
||||
*uuid = grub_malloc (16 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%016llx",
|
||||
(unsigned long long)
|
||||
grub_be_to_cpu64 (data->sblock.num_serial));
|
||||
*uuid = grub_xasprintf ("%016llx",
|
||||
(unsigned long long)
|
||||
grub_be_to_cpu64 (data->sblock.num_serial));
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
|
@ -995,10 +995,9 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_hfsplus_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (16 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%016llx",
|
||||
(unsigned long long)
|
||||
grub_be_to_cpu64 (data->volheader.num_serial));
|
||||
*uuid = grub_xasprintf ("%016llx",
|
||||
(unsigned long long)
|
||||
grub_be_to_cpu64 (data->volheader.num_serial));
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
|
@ -356,7 +356,8 @@ set_mac_env (grub_uint8_t *mac_addr, grub_size_t mac_len)
|
|||
|
||||
for (i = 0; i < mac_len; i++)
|
||||
{
|
||||
grub_sprintf (ptr, "%02x:", mac_addr[i] & 0xff);
|
||||
grub_snprintf (ptr, sizeof (buf) - (ptr - buf),
|
||||
"%02x:", mac_addr[i] & 0xff);
|
||||
ptr += (sizeof ("XX:") - 1);
|
||||
}
|
||||
if (mac_len)
|
||||
|
@ -483,8 +484,8 @@ set_ip_env (char *varname, grub_uint32_t ip)
|
|||
{
|
||||
char buf[sizeof ("XXX.XXX.XXX.XXX")];
|
||||
|
||||
grub_sprintf (buf, "%d.%d.%d.%d", (ip & 0xff),
|
||||
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
|
||||
grub_snprintf (buf, sizeof (buf), "%d.%d.%d.%d", (ip & 0xff),
|
||||
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
|
||||
grub_env_set (varname, buf);
|
||||
}
|
||||
|
||||
|
@ -500,15 +501,13 @@ write_ip_env (grub_uint32_t *ip, const char *val)
|
|||
return 0;
|
||||
|
||||
/* Normalize the IP. */
|
||||
buf = grub_malloc (sizeof ("XXX.XXX.XXX.XXX"));
|
||||
buf = grub_xasprintf ("%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
|
||||
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
*ip = newip;
|
||||
|
||||
grub_sprintf (buf, "%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
|
||||
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -544,11 +543,10 @@ grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)),
|
|||
else if (size > GRUB_PXE_MAX_BLKSIZE)
|
||||
size = GRUB_PXE_MAX_BLKSIZE;
|
||||
|
||||
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
|
||||
buf = grub_xasprintf ("%d", size);
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
grub_sprintf (buf, "%d", size);
|
||||
grub_pxe_blksize = size;
|
||||
|
||||
return buf;
|
||||
|
@ -562,12 +560,10 @@ GRUB_MOD_INIT(pxe)
|
|||
{
|
||||
char *buf;
|
||||
|
||||
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
|
||||
buf = grub_xasprintf ("%d", grub_pxe_blksize);
|
||||
if (buf)
|
||||
{
|
||||
grub_sprintf (buf, "%d", grub_pxe_blksize);
|
||||
grub_env_set ("net_pxe_blksize", buf);
|
||||
}
|
||||
grub_env_set ("net_pxe_blksize", buf);
|
||||
grub_free (buf);
|
||||
|
||||
set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
|
||||
set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);
|
||||
|
|
29
fs/iso9660.c
29
fs/iso9660.c
|
@ -136,7 +136,6 @@ struct grub_iso9660_data
|
|||
struct grub_iso9660_primary_voldesc voldesc;
|
||||
grub_disk_t disk;
|
||||
unsigned int first_sector;
|
||||
unsigned int length;
|
||||
int rockridge;
|
||||
int susp_skip;
|
||||
int joliet;
|
||||
|
@ -744,7 +743,6 @@ grub_iso9660_open (struct grub_file *file, const char *name)
|
|||
goto fail;
|
||||
|
||||
data->first_sector = foundnode->blk;
|
||||
data->length = foundnode->size;
|
||||
|
||||
file->data = data;
|
||||
file->size = foundnode->size;
|
||||
|
@ -840,16 +838,23 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
|
|||
}
|
||||
else
|
||||
{
|
||||
*uuid = grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh"));
|
||||
grub_sprintf (*uuid, "%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
|
||||
data->voldesc.modified.year[0], data->voldesc.modified.year[1],
|
||||
data->voldesc.modified.year[2], data->voldesc.modified.year[3],
|
||||
data->voldesc.modified.month[0], data->voldesc.modified.month[1],
|
||||
data->voldesc.modified.day[0], data->voldesc.modified.day[1],
|
||||
data->voldesc.modified.hour[0], data->voldesc.modified.hour[1],
|
||||
data->voldesc.modified.minute[0], data->voldesc.modified.minute[1],
|
||||
data->voldesc.modified.second[0], data->voldesc.modified.second[1],
|
||||
data->voldesc.modified.hundredth[0], data->voldesc.modified.hundredth[1]);
|
||||
*uuid = grub_xasprintf ("%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
|
||||
data->voldesc.modified.year[0],
|
||||
data->voldesc.modified.year[1],
|
||||
data->voldesc.modified.year[2],
|
||||
data->voldesc.modified.year[3],
|
||||
data->voldesc.modified.month[0],
|
||||
data->voldesc.modified.month[1],
|
||||
data->voldesc.modified.day[0],
|
||||
data->voldesc.modified.day[1],
|
||||
data->voldesc.modified.hour[0],
|
||||
data->voldesc.modified.hour[1],
|
||||
data->voldesc.modified.minute[0],
|
||||
data->voldesc.modified.minute[1],
|
||||
data->voldesc.modified.second[0],
|
||||
data->voldesc.modified.second[1],
|
||||
data->voldesc.modified.hundredth[0],
|
||||
data->voldesc.modified.hundredth[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
21
fs/jfs.c
21
fs/jfs.c
|
@ -842,17 +842,16 @@ grub_jfs_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_jfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (40 + sizeof ('\0'));
|
||||
|
||||
grub_sprintf (*uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
data->sblock.uuid[0], data->sblock.uuid[1],
|
||||
data->sblock.uuid[2], data->sblock.uuid[3],
|
||||
data->sblock.uuid[4], data->sblock.uuid[5],
|
||||
data->sblock.uuid[6], data->sblock.uuid[7],
|
||||
data->sblock.uuid[8], data->sblock.uuid[9],
|
||||
data->sblock.uuid[10], data->sblock.uuid[11],
|
||||
data->sblock.uuid[12], data->sblock.uuid[13],
|
||||
data->sblock.uuid[14], data->sblock.uuid[15]);
|
||||
*uuid = grub_xasprintf ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
|
||||
"%02x%02x%02x%02x%02x%02x",
|
||||
data->sblock.uuid[0], data->sblock.uuid[1],
|
||||
data->sblock.uuid[2], data->sblock.uuid[3],
|
||||
data->sblock.uuid[4], data->sblock.uuid[5],
|
||||
data->sblock.uuid[6], data->sblock.uuid[7],
|
||||
data->sblock.uuid[8], data->sblock.uuid[9],
|
||||
data->sblock.uuid[10], data->sblock.uuid[11],
|
||||
data->sblock.uuid[12], data->sblock.uuid[13],
|
||||
data->sblock.uuid[14], data->sblock.uuid[15]);
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
|
@ -1072,8 +1072,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_ntfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (16 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%016llx", (unsigned long long) data->uuid);
|
||||
*uuid = grub_xasprintf ("%016llx", (unsigned long long) data->uuid);
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
|
@ -1335,12 +1335,15 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_reiserfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"));
|
||||
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->superblock.uuid[0]), grub_be_to_cpu16 (data->superblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[2]), grub_be_to_cpu16 (data->superblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[4]), grub_be_to_cpu16 (data->superblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[6]), grub_be_to_cpu16 (data->superblock.uuid[7]));
|
||||
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->superblock.uuid[0]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[2]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[4]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[6]),
|
||||
grub_be_to_cpu16 (data->superblock.uuid[7]));
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
9
fs/ufs.c
9
fs/ufs.c
|
@ -732,12 +732,9 @@ grub_ufs_uuid (grub_device_t device, char **uuid)
|
|||
|
||||
data = grub_ufs_mount (disk);
|
||||
if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0))
|
||||
{
|
||||
*uuid = grub_malloc (16 + sizeof ('\0'));
|
||||
grub_sprintf (*uuid, "%08x%08x",
|
||||
(unsigned) grub_le_to_cpu32 (data->sblock.uuidhi),
|
||||
(unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
|
||||
}
|
||||
*uuid = grub_xasprintf ("%08x%08x",
|
||||
(unsigned) grub_le_to_cpu32 (data->sblock.uuidhi),
|
||||
(unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
||||
|
|
15
fs/xfs.c
15
fs/xfs.c
|
@ -777,12 +777,15 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
|
|||
data = grub_xfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
*uuid = grub_malloc (sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"));
|
||||
grub_sprintf (*uuid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[4]), grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7]));
|
||||
*uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||
grub_be_to_cpu16 (data->sblock.uuid[0]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[1]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[2]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[3]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[4]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[5]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[6]),
|
||||
grub_be_to_cpu16 (data->sblock.uuid[7]));
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
||||
|
|
17
genmk.rb
17
genmk.rb
|
@ -68,7 +68,7 @@ MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count}
|
|||
|
||||
ifneq ($(TARGET_APPLE_CC),1)
|
||||
#{@name}: #{exe}
|
||||
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $< $@
|
||||
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@
|
||||
else
|
||||
ifneq (#{exe},kernel.exec)
|
||||
#{@name}: #{exe} ./grub-macho2img
|
||||
|
@ -132,13 +132,11 @@ clean-module-#{@name}.#{@rule_count}:
|
|||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count}
|
||||
|
||||
ifneq ($(#{prefix}_EXPORTS),no)
|
||||
clean-module-#{@name}-symbol.#{@rule_count}:
|
||||
rm -f #{defsym}
|
||||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count}
|
||||
DEFSYMFILES += #{defsym}
|
||||
endif
|
||||
mostlyclean-module-#{@name}.#{@rule_count}:
|
||||
rm -f #{deps_str}
|
||||
|
||||
|
@ -170,7 +168,6 @@ endif
|
|||
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
ifneq ($(#{prefix}_EXPORTS),no)
|
||||
ifneq ($(TARGET_APPLE_CC),1)
|
||||
#{defsym}: #{pre_obj}
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
|
||||
|
@ -178,7 +175,6 @@ else
|
|||
#{defsym}: #{pre_obj}
|
||||
$(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
|
||||
endif
|
||||
endif
|
||||
|
||||
#{undsym}: #{pre_obj}
|
||||
echo '#{mod_name}' > $@
|
||||
|
@ -331,8 +327,15 @@ class Program
|
|||
"CLEANFILES += #{@name} #{objs_str}
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
|
||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
$(STRIP) --strip-unneeded -K start -R .note -R .comment $@
|
||||
else
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
$(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@
|
||||
endif
|
||||
|
||||
" + objs.collect_with_index do |obj, i|
|
||||
src = sources[i]
|
||||
|
@ -344,6 +347,7 @@ MOSTLYCLEANFILES += #{deps_str}
|
|||
|
||||
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
||||
|
||||
-include #{dep}
|
||||
|
||||
"
|
||||
|
@ -370,8 +374,7 @@ class Script
|
|||
"CLEANFILES += #{@name}
|
||||
|
||||
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
|
||||
./config.status --file=#{name}:#{src}
|
||||
sed -i -e 's,@pkglib_DATA@,$(pkglib_DATA),g' $@
|
||||
./config.status --file=-:#{src} | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
|
||||
chmod +x $@
|
||||
|
||||
"
|
||||
|
|
|
@ -29,7 +29,7 @@ FNR == 1 {
|
|||
if ($1 in symtab) {
|
||||
modtab[module] = modtab[module] " " symtab[$1];
|
||||
}
|
||||
else {
|
||||
else if ($1 != "__gnu_local_gp") {
|
||||
printf "%s in %s is not defined\n", $1, module >"/dev/stderr";
|
||||
error++;
|
||||
exit;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009,2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# This script is free software; the author
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -17,6 +17,4 @@ module=$1
|
|||
|
||||
grep -v "^#" | sed -n \
|
||||
-e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
|
||||
-e "/grub_term_register_input_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
|
||||
-e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}" \
|
||||
-e "/grub_term_register_output_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}"
|
||||
|
|
|
@ -148,14 +148,24 @@ grub_gettext_translate (const char *orig)
|
|||
|
||||
struct grub_gettext_msg *cur;
|
||||
|
||||
/* Make sure we can use grub_gettext_translate for error messages. Push
|
||||
active error message to error stack and reset error message. */
|
||||
grub_error_push ();
|
||||
|
||||
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_gettext_msg_list),
|
||||
orig);
|
||||
|
||||
if (cur)
|
||||
return cur->translated;
|
||||
{
|
||||
grub_error_pop ();
|
||||
return cur->translated;
|
||||
}
|
||||
|
||||
if (fd_mo == 0)
|
||||
return orig;
|
||||
{
|
||||
grub_error_pop ();
|
||||
return orig;
|
||||
}
|
||||
|
||||
min = 0;
|
||||
max = grub_gettext_max;
|
||||
|
@ -205,6 +215,7 @@ grub_gettext_translate (const char *orig)
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_error_pop ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -275,14 +286,19 @@ grub_gettext_init_ext (const char *lang)
|
|||
/* Warning: if changing some paths in the below line, change the grub_malloc
|
||||
contents below. */
|
||||
|
||||
grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang);
|
||||
mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, lang);
|
||||
if (!mo_file)
|
||||
return;
|
||||
|
||||
fd_mo = grub_mofile_open (mo_file);
|
||||
|
||||
/* Will try adding .gz as well. */
|
||||
if (fd_mo == NULL)
|
||||
{
|
||||
grub_sprintf (mo_file, "%s.gz", mo_file);
|
||||
grub_free (mo_file);
|
||||
mo_file = grub_xasprintf ("%s.gz", mo_file);
|
||||
if (!mo_file)
|
||||
return;
|
||||
fd_mo = grub_mofile_open (mo_file);
|
||||
}
|
||||
|
||||
|
@ -308,7 +324,7 @@ grub_gettext_delete_list (void)
|
|||
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
||||
grub_free (original);
|
||||
|
||||
// Don't delete the translated message because could be in use.
|
||||
/* Don't delete the translated message because could be in use. */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,8 +363,8 @@ GRUB_MOD_INIT (gettext)
|
|||
grub_gettext_init_ext (lang);
|
||||
|
||||
grub_register_command_p1 ("gettext", grub_cmd_translate,
|
||||
"STRING",
|
||||
"Translates the string with the current settings.");
|
||||
N_("STRING"),
|
||||
N_("Translates the string with the current settings."));
|
||||
|
||||
/* Reload .mo file information if lang changes. */
|
||||
grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang);
|
||||
|
|
|
@ -163,15 +163,15 @@ draw_text (grub_gui_progress_bar_t self)
|
|||
grub_video_color_t text_color = grub_gui_map_color (self->text_color);
|
||||
int width = self->bounds.width;
|
||||
int height = self->bounds.height;
|
||||
char *text = grub_malloc (grub_strlen (self->template) + 10);
|
||||
char *text;
|
||||
text = grub_xasprintf (self->template,
|
||||
self->value > 0 ? self->value : -self->value);
|
||||
if (!text)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
grub_sprintf (text, self->template,
|
||||
self->value > 0 ? self->value : -self->value);
|
||||
/* Center the text. */
|
||||
int text_width = grub_font_get_string_width (font, text);
|
||||
int x = (width - text_width) / 2;
|
||||
|
|
|
@ -76,7 +76,7 @@ grub_read_hook_datetime (struct grub_env_var *var,
|
|||
return grub_get_weekday_name (&datetime);
|
||||
}
|
||||
|
||||
grub_sprintf (buf, "%d", n);
|
||||
grub_snprintf (buf, sizeof (buf), "%d", n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,38 @@
|
|||
* 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
|
||||
#define GRUB_AOUT_HEADER 1
|
||||
|
||||
|
|
54
include/grub/at_keyboard.h
Normal file
54
include/grub/at_keyboard.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007,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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_AT_KEYBOARD_HEADER
|
||||
#define GRUB_AT_KEYBOARD_HEADER 1
|
||||
|
||||
#define SHIFT_L 0x2a
|
||||
#define SHIFT_R 0x36
|
||||
#define CTRL 0x1d
|
||||
#define ALT 0x38
|
||||
#define CAPS_LOCK 0x3a
|
||||
#define NUM_LOCK 0x45
|
||||
#define SCROLL_LOCK 0x46
|
||||
|
||||
/* Used for sending commands to the controller. */
|
||||
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
|
||||
#define KEYBOARD_COMMAND_READ 0x20
|
||||
#define KEYBOARD_COMMAND_WRITE 0x60
|
||||
#define KEYBOARD_COMMAND_REBOOT 0xfe
|
||||
|
||||
#define KEYBOARD_SCANCODE_SET1 0x40
|
||||
|
||||
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
|
||||
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
|
||||
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
#define OLPC_UP GRUB_TERM_UP
|
||||
#define OLPC_DOWN GRUB_TERM_DOWN
|
||||
#define OLPC_LEFT GRUB_TERM_LEFT
|
||||
#define OLPC_RIGHT GRUB_TERM_RIGHT
|
||||
#else
|
||||
#define OLPC_UP '\0'
|
||||
#define OLPC_DOWN '\0'
|
||||
#define OLPC_LEFT '\0'
|
||||
#define OLPC_RIGHT '\0'
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -98,8 +98,8 @@ struct grub_ata_device
|
|||
|
||||
/* IO addresses on which the registers for this device can be
|
||||
found. */
|
||||
int ioaddress;
|
||||
int ioaddress2;
|
||||
grub_port_t ioaddress;
|
||||
grub_port_t ioaddress2;
|
||||
|
||||
/* Two devices can be connected to a single cable. Use this field
|
||||
to select device 0 (commonly known as "master") or device 1
|
||||
|
|
72
include/grub/cmos.h
Normal file
72
include/grub/cmos.h
Normal 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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CMOS_H
|
||||
#define GRUB_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/cpu/cmos.h>
|
||||
|
||||
#define GRUB_CMOS_INDEX_SECOND 0
|
||||
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
|
||||
#define GRUB_CMOS_INDEX_MINUTE 2
|
||||
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
|
||||
#define GRUB_CMOS_INDEX_HOUR 4
|
||||
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
|
||||
#define GRUB_CMOS_INDEX_MONTH 8
|
||||
#define GRUB_CMOS_INDEX_YEAR 9
|
||||
|
||||
#define GRUB_CMOS_INDEX_STATUS_A 0xA
|
||||
#define GRUB_CMOS_INDEX_STATUS_B 0xB
|
||||
#define GRUB_CMOS_INDEX_STATUS_C 0xC
|
||||
#define GRUB_CMOS_INDEX_STATUS_D 0xD
|
||||
|
||||
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
|
||||
#define GRUB_CMOS_STATUS_B_24HOUR 2
|
||||
#define GRUB_CMOS_STATUS_B_BINARY 4
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_bcd_to_num (grub_uint8_t a)
|
||||
{
|
||||
return ((a >> 4) * 10 + (a & 0xF));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_num_to_bcd (grub_uint8_t a)
|
||||
{
|
||||
return (((a / 10) << 4) + (a % 10));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_cmos_read (grub_uint8_t index)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
return grub_inb (GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
grub_outb (value, GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
#endif /* GRUB_CMOS_H */
|
|
@ -116,4 +116,9 @@ grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
|
|||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||
|
||||
#if defined (_mips) && ! defined (GRUB_UTIL)
|
||||
#define GRUB_LINKER_HAVE_INIT 1
|
||||
void grub_arch_dl_init_linker (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DL_H */
|
||||
|
|
|
@ -46,12 +46,12 @@ grub_elf_t grub_elf_file (grub_file_t);
|
|||
grub_err_t grub_elf_close (grub_elf_t);
|
||||
|
||||
int grub_elf_is_elf32 (grub_elf_t);
|
||||
grub_size_t grub_elf32_size (grub_elf_t);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
|
||||
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
|
||||
int grub_elf_is_elf64 (grub_elf_t);
|
||||
grub_size_t grub_elf64_size (grub_elf_t);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
|
||||
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/menu.h>
|
||||
|
||||
struct grub_env_var;
|
||||
|
||||
|
@ -30,18 +31,6 @@ typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
|||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
enum grub_env_var_type
|
||||
{
|
||||
/* The default variable type which is local in current context. */
|
||||
GRUB_ENV_VAR_LOCAL,
|
||||
|
||||
/* The exported type, which is passed to new contexts. */
|
||||
GRUB_ENV_VAR_GLOBAL,
|
||||
|
||||
/* The data slot type, which is used to store arbitrary data. */
|
||||
GRUB_ENV_VAR_DATA
|
||||
};
|
||||
|
||||
struct grub_env_var
|
||||
{
|
||||
char *name;
|
||||
|
@ -50,23 +39,24 @@ struct grub_env_var
|
|||
grub_env_write_hook_t write_hook;
|
||||
struct grub_env_var *next;
|
||||
struct grub_env_var **prevp;
|
||||
enum grub_env_var_type type;
|
||||
int global;
|
||||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
|
||||
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
|
||||
grub_env_read_hook_t read_hook,
|
||||
grub_env_write_hook_t write_hook);
|
||||
grub_err_t EXPORT_FUNC(grub_env_context_open) (int export);
|
||||
grub_err_t EXPORT_FUNC(grub_env_context_close) (void);
|
||||
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set_data_slot) (const char *name,
|
||||
const void *ptr);
|
||||
void *EXPORT_FUNC(grub_env_get_data_slot) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset_data_slot) (const char *name);
|
||||
grub_err_t grub_env_context_open (int export);
|
||||
grub_err_t grub_env_context_close (void);
|
||||
grub_err_t grub_env_export (const char *name);
|
||||
|
||||
void grub_env_unset_menu (void);
|
||||
grub_menu_t grub_env_get_menu (void);
|
||||
void grub_env_set_menu (grub_menu_t nmenu);
|
||||
|
||||
#endif /* ! GRUB_ENV_HEADER */
|
||||
|
|
46
include/grub/env_private.h
Normal file
46
include/grub/env_private.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2005,2006,2007,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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_ENV_PRIVATE_HEADER
|
||||
#define GRUB_ENV_PRIVATE_HEADER 1
|
||||
|
||||
#include <grub/env.h>
|
||||
|
||||
/* The size of the hash table. */
|
||||
#define HASHSZ 13
|
||||
|
||||
/* A hashtable for quick lookup of variables. */
|
||||
struct grub_env_context
|
||||
{
|
||||
/* A hash table for variables. */
|
||||
struct grub_env_var *vars[HASHSZ];
|
||||
|
||||
/* One level deeper on the stack. */
|
||||
struct grub_env_context *prev;
|
||||
};
|
||||
|
||||
/* This is used for sorting only. */
|
||||
struct grub_env_sorted_var
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
struct grub_env_sorted_var *next;
|
||||
};
|
||||
|
||||
extern struct grub_env_context *EXPORT_VAR(grub_current_context);
|
||||
|
||||
#endif /* ! GRUB_ENV_PRIVATE_HEADER */
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/file.h>
|
||||
|
||||
/* Forward declaration of opaque structure grub_font.
|
||||
Users only pass struct grub_font pointers to the font module functions,
|
||||
|
|
38
include/grub/fontformat.h
Normal file
38
include/grub/fontformat.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_FONT_FORMAT_HEADER
|
||||
#define GRUB_FONT_FORMAT_HEADER 1
|
||||
|
||||
/* FONT_FORMAT_PFF2_MAGIC use only 4 relevants bytes and the \0. */
|
||||
#define FONT_FORMAT_PFF2_MAGIC "PFF2"
|
||||
#define FONT_FORMAT_SECTION_NAMES_FILE "FILE"
|
||||
#define FONT_FORMAT_SECTION_NAMES_FONT_NAME "NAME"
|
||||
#define FONT_FORMAT_SECTION_NAMES_POINT_SIZE "PTSZ"
|
||||
#define FONT_FORMAT_SECTION_NAMES_WEIGHT "WEIG"
|
||||
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH "MAXW"
|
||||
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT "MAXH"
|
||||
#define FONT_FORMAT_SECTION_NAMES_ASCENT "ASCE"
|
||||
#define FONT_FORMAT_SECTION_NAMES_DESCENT "DESC"
|
||||
#define FONT_FORMAT_SECTION_NAMES_CHAR_INDEX "CHIX"
|
||||
#define FONT_FORMAT_SECTION_NAMES_DATA "DATA"
|
||||
#define FONT_FORMAT_SECTION_NAMES_FAMILY "FAMI"
|
||||
#define FONT_FORMAT_SECTION_NAMES_SLAN "SLAN"
|
||||
|
||||
#endif /* ! GRUB_FONT_FORMAT_HEADER */
|
||||
|
|
@ -19,40 +19,7 @@
|
|||
#ifndef GRUB_CPU_AT_KEYBOARD_HEADER
|
||||
#define GRUB_CPU_AT_KEYBOARD_HEADER 1
|
||||
|
||||
|
||||
#define SHIFT_L 0x2a
|
||||
#define SHIFT_R 0x36
|
||||
#define CTRL 0x1d
|
||||
#define ALT 0x38
|
||||
#define CAPS_LOCK 0x3a
|
||||
#define NUM_LOCK 0x45
|
||||
#define SCROLL_LOCK 0x46
|
||||
|
||||
#define KEYBOARD_REG_DATA 0x60
|
||||
#define KEYBOARD_REG_STATUS 0x64
|
||||
|
||||
/* Used for sending commands to the controller. */
|
||||
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
|
||||
#define KEYBOARD_COMMAND_READ 0x20
|
||||
#define KEYBOARD_COMMAND_WRITE 0x60
|
||||
#define KEYBOARD_COMMAND_REBOOT 0xfe
|
||||
|
||||
#define KEYBOARD_SCANCODE_SET1 0x40
|
||||
|
||||
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
|
||||
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
|
||||
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
#define OLPC_UP GRUB_TERM_UP
|
||||
#define OLPC_DOWN GRUB_TERM_DOWN
|
||||
#define OLPC_LEFT GRUB_TERM_LEFT
|
||||
#define OLPC_RIGHT GRUB_TERM_RIGHT
|
||||
#else
|
||||
#define OLPC_UP '\0'
|
||||
#define OLPC_DOWN '\0'
|
||||
#define OLPC_LEFT '\0'
|
||||
#define OLPC_RIGHT '\0'
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,13 @@
|
|||
#define GRUB_BSD_CPU_HEADER 1
|
||||
|
||||
#include <grub/types.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
|
||||
{
|
||||
|
@ -31,61 +38,11 @@ enum bsd_kernel_types
|
|||
|
||||
#define GRUB_BSD_TEMP_BUFFER 0x80000
|
||||
|
||||
#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 */
|
||||
|
||||
#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_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_B_DEVMAGIC OPENBSD_B_DEVMAGIC
|
||||
#define FREEBSD_B_SLICESHIFT OPENBSD_B_CTRLSHIFT
|
||||
#define FREEBSD_B_UNITSHIFT OPENBSD_B_UNITSHIFT
|
||||
#define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
|
||||
#define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
|
||||
|
||||
#define FREEBSD_MODTYPE_KERNEL "elf kernel"
|
||||
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
|
||||
|
@ -93,64 +50,21 @@ enum bsd_kernel_types
|
|||
#define FREEBSD_MODTYPE_ELF_MODULE_OBJ "elf obj module"
|
||||
#define FREEBSD_MODTYPE_RAW "raw"
|
||||
|
||||
#define FREEBSD_BOOTINFO_VERSION 1
|
||||
|
||||
struct grub_freebsd_bootinfo
|
||||
{
|
||||
grub_uint32_t bi_version;
|
||||
grub_uint8_t *bi_kernelname;
|
||||
struct nfs_diskless *bi_nfs_diskless;
|
||||
grub_uint32_t bi_n_bios_used;
|
||||
grub_uint32_t bi_bios_geom[FREEBSD_N_BIOS_GEOM];
|
||||
grub_uint32_t bi_size;
|
||||
grub_uint8_t bi_memsizes_valid;
|
||||
grub_uint8_t bi_bios_dev;
|
||||
grub_uint8_t bi_pad[2];
|
||||
grub_uint32_t bi_basemem;
|
||||
grub_uint32_t bi_extmem;
|
||||
grub_uint32_t bi_symtab;
|
||||
grub_uint32_t bi_esymtab;
|
||||
grub_uint32_t bi_kernend;
|
||||
grub_uint32_t bi_envp;
|
||||
grub_uint32_t bi_modulep;
|
||||
grub_uint32_t version;
|
||||
grub_uint8_t unused1[44];
|
||||
grub_uint32_t length;
|
||||
grub_uint8_t unused2;
|
||||
grub_uint8_t boot_device;
|
||||
grub_uint8_t unused3[18];
|
||||
grub_uint32_t kern_end;
|
||||
grub_uint32_t environment;
|
||||
grub_uint32_t tags;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#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
|
||||
{
|
||||
grub_uint64_t addr;
|
||||
|
@ -162,97 +76,6 @@ struct grub_openbsd_bios_mmap
|
|||
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;
|
||||
void *bi_data[1];
|
||||
};
|
||||
|
||||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
|
||||
struct grub_netbsd_btinfo_common
|
||||
{
|
||||
int len;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_header
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
grub_uint32_t count;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_entry
|
||||
{
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#define NETBSD_MMAP_AVAILABLE 1
|
||||
#define NETBSD_MMAP_RESERVED 2
|
||||
#define NETBSD_MMAP_ACPI 3
|
||||
#define NETBSD_MMAP_NVS 4
|
||||
grub_uint32_t type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootpath
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char bootpath[80];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_rootdevice
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char devname[16];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootdisk
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
int labelsector; /* label valid if != -1 */
|
||||
struct
|
||||
{
|
||||
grub_uint16_t type, checksum;
|
||||
char packname[16];
|
||||
} label;
|
||||
int biosdev;
|
||||
int partition;
|
||||
};
|
||||
|
||||
void grub_unix_real_boot (grub_addr_t entry, ...)
|
||||
__attribute__ ((cdecl,noreturn));
|
||||
grub_err_t grub_freebsd_load_elfmodule32 (grub_file_t file, int argc,
|
||||
|
|
|
@ -20,55 +20,9 @@
|
|||
#define GRUB_CPU_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/i386/io.h>
|
||||
#include <grub/cpu/io.h>
|
||||
|
||||
#define GRUB_CMOS_ADDR_REG 0x70
|
||||
#define GRUB_CMOS_DATA_REG 0x71
|
||||
|
||||
#define GRUB_CMOS_INDEX_SECOND 0
|
||||
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
|
||||
#define GRUB_CMOS_INDEX_MINUTE 2
|
||||
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
|
||||
#define GRUB_CMOS_INDEX_HOUR 4
|
||||
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
|
||||
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
|
||||
#define GRUB_CMOS_INDEX_MONTH 8
|
||||
#define GRUB_CMOS_INDEX_YEAR 9
|
||||
|
||||
#define GRUB_CMOS_INDEX_STATUS_A 0xA
|
||||
#define GRUB_CMOS_INDEX_STATUS_B 0xB
|
||||
#define GRUB_CMOS_INDEX_STATUS_C 0xC
|
||||
#define GRUB_CMOS_INDEX_STATUS_D 0xD
|
||||
|
||||
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
|
||||
#define GRUB_CMOS_STATUS_B_24HOUR 2
|
||||
#define GRUB_CMOS_STATUS_B_BINARY 4
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_bcd_to_num (grub_uint8_t a)
|
||||
{
|
||||
return ((a >> 4) * 10 + (a & 0xF));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_num_to_bcd (grub_uint8_t a)
|
||||
{
|
||||
return (((a / 10) << 4) + (a % 10));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_cmos_read (grub_uint8_t index)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
return grub_inb (GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
grub_outb (value, GRUB_CMOS_DATA_REG);
|
||||
}
|
||||
|
||||
#endif /* GRUB_CPU_CMOS_H */
|
||||
|
|
|
@ -1 +1,24 @@
|
|||
#include <grub/i386/pc/serial.h>
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
|
||||
|
||||
#endif
|
||||
|
|
74
include/grub/i386/freebsd_linker.h
Normal file
74
include/grub/i386/freebsd_linker.h
Normal 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
|
77
include/grub/i386/freebsd_reboot.h
Normal file
77
include/grub/i386/freebsd_reboot.h
Normal 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
|
|
@ -1 +1 @@
|
|||
#include <grub/i386/pc/serial.h>
|
||||
#include <grub/i386/coreboot/serial.h>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef GRUB_IO_H
|
||||
#define GRUB_IO_H 1
|
||||
|
||||
typedef unsigned short int grub_port_t;
|
||||
|
||||
static __inline unsigned char
|
||||
grub_inb (unsigned short int port)
|
||||
{
|
||||
|
|
|
@ -79,9 +79,9 @@ struct grub_e820_mmap
|
|||
grub_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define GRUB_VIDEO_TYPE_TEXT 0x01
|
||||
#define GRUB_VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
|
||||
#define GRUB_VIDEO_TYPE_EFI 0x70
|
||||
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
|
||||
#define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
|
||||
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
|
||||
|
||||
/* For the Linux/i386 boot protocol version 2.03. */
|
||||
struct linux_kernel_header
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,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
|
||||
|
@ -31,7 +31,7 @@ extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
|
|||
extern char *EXPORT_VAR(grub_linux_tmp_addr);
|
||||
extern char *EXPORT_VAR(grub_linux_real_addr);
|
||||
extern grub_int32_t EXPORT_VAR(grub_linux_is_bzimage);
|
||||
grub_err_t EXPORT_FUNC(grub_linux16_boot) (void);
|
||||
grub_err_t EXPORT_FUNC(grub_linux16_real_boot) (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_LOADER_CPU_HEADER */
|
||||
|
|
112
include/grub/i386/netbsd_bootinfo.h
Normal file
112
include/grub/i386/netbsd_bootinfo.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
|
||||
struct grub_netbsd_btinfo_common
|
||||
{
|
||||
int len;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_header
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
grub_uint32_t count;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_entry
|
||||
{
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#define NETBSD_MMAP_AVAILABLE 1
|
||||
#define NETBSD_MMAP_RESERVED 2
|
||||
#define NETBSD_MMAP_ACPI 3
|
||||
#define NETBSD_MMAP_NVS 4
|
||||
grub_uint32_t type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootpath
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char bootpath[80];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_rootdevice
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
char devname[16];
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootdisk
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
int labelsector; /* label valid if != -1 */
|
||||
struct
|
||||
{
|
||||
grub_uint16_t type, checksum;
|
||||
char packname[16];
|
||||
} label;
|
||||
int biosdev;
|
||||
int partition;
|
||||
};
|
||||
|
||||
struct grub_netbsd_bootinfo
|
||||
{
|
||||
grub_uint32_t bi_count;
|
||||
void *bi_data[1];
|
||||
};
|
||||
|
||||
#endif
|
81
include/grub/i386/netbsd_reboot.h
Normal file
81
include/grub/i386/netbsd_reboot.h
Normal 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
|
72
include/grub/i386/openbsd_bootarg.h
Normal file
72
include/grub/i386/openbsd_bootarg.h
Normal 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
|
79
include/grub/i386/openbsd_reboot.h
Normal file
79
include/grub/i386/openbsd_reboot.h
Normal 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
|
|
@ -66,6 +66,8 @@
|
|||
/* The size of a block list used in the kernel startup code. */
|
||||
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
|
|
|
@ -22,8 +22,11 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/i386/io.h>
|
||||
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0
|
||||
#define GRUB_PCI_ADDR_REG 0xcf8
|
||||
#define GRUB_PCI_DATA_REG 0xcfc
|
||||
#define GRUB_PCI_NUM_BUS 256
|
||||
#define GRUB_PCI_NUM_DEVICES 32
|
||||
|
||||
static inline grub_uint32_t
|
||||
grub_pci_read (grub_pci_address_t addr)
|
||||
|
@ -67,12 +70,12 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
|||
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
|
||||
}
|
||||
|
||||
static inline void *
|
||||
static inline volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base,
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) base;
|
||||
return (volatile void *) base;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -26,7 +26,8 @@ enum
|
|||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
OBJ_TYPE_CONFIG,
|
||||
OBJ_TYPE_FONT
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
|
|
1
include/grub/mips/at_keyboard.h
Normal file
1
include/grub/mips/at_keyboard.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/machine/at_keyboard.h>
|
27
include/grub/mips/cache.h
Normal file
27
include/grub/mips/cache.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* cache.h - Flush the processor's cache. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,2007 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/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CPU_CACHE_H
|
||||
#define GRUB_CPU_CACHE_H 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type);
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue