merge with mainline
This commit is contained in:
commit
81827e248c
69 changed files with 2217 additions and 592 deletions
209
ChangeLog
209
ChangeLog
|
@ -1,3 +1,210 @@
|
||||||
|
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/parttool.c (grub_cmd_parttool): Fix #if !GRUB_NO_MODULES
|
||||||
|
condition.
|
||||||
|
|
||||||
|
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/mm.c (grub_real_malloc): Put magic and size assignment in common
|
||||||
|
part.
|
||||||
|
|
||||||
|
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/mm.c (grub_mm_init_region): Check for region size after aligning
|
||||||
|
pointers.
|
||||||
|
|
||||||
|
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
|
||||||
|
|
||||||
|
2010-05-01 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):
|
||||||
|
Remove broken Cygwin path conversion.
|
||||||
|
* util/misc.c: [__CYGWIN__] Add include and define.
|
||||||
|
[__CYGWIN__] (get_win32_path): Copy function from getroot.c, modify
|
||||||
|
for Cygwin 1.7.
|
||||||
|
(make_system_path_relative_to_its_root): Simplify loop, replace early
|
||||||
|
return by break.
|
||||||
|
[__CYGWIN__] Add conversion to win32 path.
|
||||||
|
Include "/" case in trailing slash removal.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/main.c (grub_load_config): Fix copy-pasted comment.
|
||||||
|
Reported by: Seth Goldberg
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/help.c (grub_cmd_help): Fix a typo.
|
||||||
|
Reported by: Seth Goldberg
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/hashsum.c (GRUB_MOD_INIT): Remove duplication of command
|
||||||
|
name and add N_.
|
||||||
|
* commands/i386/pc/drivemap.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/iorw.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/password_pbkdf2.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/regexp.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/setpci.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/terminal.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* normal/context.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* normal/main.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* term/serial.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/mm.c (grub_real_malloc): Satisfy alignment requirement when
|
||||||
|
extra == 0.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/iorw.c: New file.
|
||||||
|
* conf/i386.rmk (pkglib_MODULES): Add iorw.mod.
|
||||||
|
(iorw_mod_SOURCES): New variable.
|
||||||
|
(iorw_mod_CFLAGS): Likewise.
|
||||||
|
(iorw_mod_LDFLAGS): Likewise.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Hotkey support
|
||||||
|
|
||||||
|
* include/grub/menu.h (grub_menu_entry): New field 'hotkey'.
|
||||||
|
* normal/main.c (hotkey_aliases): New variable.
|
||||||
|
(grub_normal_add_menu_entry): Parse "--hotkey".
|
||||||
|
* normal/menu_text.c (run_menu): Handle hotkeys.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/i386/coreboot/init.c (grub_machine_init): Call
|
||||||
|
grub_machine_mmap_init on qemu.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* boot/i386/qemu/boot.S: Add a missing .code16.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Use LBIO on coreboot.
|
||||||
|
|
||||||
|
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Change
|
||||||
|
kern/i386/multiboot_mmap.c to kern/i386/coreboot/mmap.c.
|
||||||
|
* include/grub/i386/coreboot/memory.h (GRUB_LINUXBIOS_MEMBER_LINK):
|
||||||
|
New declaration.
|
||||||
|
* kern/i386/coreboot/init.c (grub_machine_init): Don't call
|
||||||
|
grub_machine_mmap_init on coreboot.
|
||||||
|
* kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate): Handle
|
||||||
|
GRUB_LINUXBIOS_MEMBER_LINK.
|
||||||
|
(grub_machine_mmap_iterate): Fix declaration.
|
||||||
|
* kern/i386/coreboot/startup.S: Don't save mbi location on coreboot.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Split coreboot and multiboot ports.
|
||||||
|
|
||||||
|
* conf/i386-multiboot.rmk: New file.
|
||||||
|
* configure.ac: Add multiboot port.
|
||||||
|
* include/grub/i386/multiboot/boot.h: New file.
|
||||||
|
* include/grub/i386/multiboot/console.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/init.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/kernel.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/loader.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/memory.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/serial.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/time.h: Likewise.
|
||||||
|
* include/grub/multiboot.h: Add GRUB_MACHINE_MULTIBOOT to ifdef.
|
||||||
|
* loader/multiboot.c: Likewise.
|
||||||
|
* loader/multiboot_mbi2.c: Likewise.
|
||||||
|
* util/grub-mkrescue.in: Generate multiboot rescue.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/parser.c (grub_parser_execute): Cope with read-only config.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Merge handling of input and output terminals. Fix a hang.
|
||||||
|
|
||||||
|
* commands/terminal.c (abstract_terminal): New struct.
|
||||||
|
(handle_command): New function. Based on grub_cmd_terminal_input.
|
||||||
|
(grub_cmd_terminal_input): Use handle_command.
|
||||||
|
(grub_cmd_terminal_output): Use handle_command.
|
||||||
|
|
||||||
|
2010-05-01 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Fix comment handling.
|
||||||
|
|
||||||
|
* tests/grub_script_comments.in: New testcase.
|
||||||
|
* conf/tests.rmk: Rules for new testcase.
|
||||||
|
* script/yylex.l: Updated flex rules.
|
||||||
|
|
||||||
|
2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
|
* docs/grub.texi (play): Document that zero pitches produce rests.
|
||||||
|
* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only
|
||||||
|
if argc is 1.
|
||||||
|
|
||||||
|
2010-04-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* conf/x86-efi.rmk (linux_mod_SOURCES): Write explicitly to avoid
|
||||||
|
autogen issues.
|
||||||
|
|
||||||
|
2010-04-26 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* include/grub/util/getroot.h (grub_get_prefix): Remove prototype.
|
||||||
|
* util/getroot.c [__CYGWIN__] (get_win32_path): Remove function.
|
||||||
|
(grub_get_prefix): Remove function.
|
||||||
|
* util/grub-emu.c (main): Replace grub_get_prefix () call by
|
||||||
|
make_system_path_relative_to_its_root ().
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c (main): Likewise.
|
||||||
|
|
||||||
|
2010-04-24 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
|
||||||
|
(kernel_img_LDFLAGS): Remove -static-libgcc.
|
||||||
|
|
||||||
|
2010-04-24 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* configure.ac: Do not CHECK_BSS_START_SYMBOL
|
||||||
|
and CHECK_END_SYMBOL if grub-emu is built.
|
||||||
|
Unset TARGET_OBJ2ELF if grub-emu is built
|
||||||
|
without module support.
|
||||||
|
|
||||||
|
2010-04-24 Jiro SEKIBA <jir@unicus.jp>
|
||||||
|
|
||||||
|
Nilfs2 support.
|
||||||
|
|
||||||
|
* conf/common.rmk (grub_probe_SOURCES): Add fs/nilfs2.c.
|
||||||
|
(grub_fstest_SOURCES): Likewise.
|
||||||
|
(pkglib_MODULES): Add nilfs2.mod.
|
||||||
|
(nilfs2_mod_SOURCES): New variable.
|
||||||
|
(nilfs2_mod_CFLAGS): Likewise.
|
||||||
|
(nilfs2_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
|
||||||
|
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
|
||||||
|
* fs/nilfs2.c: New file.
|
||||||
|
|
||||||
|
2010-04-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
|
||||||
|
is not supported.
|
||||||
|
|
||||||
|
2010-04-19 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||||
|
|
||||||
|
Add grub-mkconfig support for NetBSD.
|
||||||
|
|
||||||
|
* util/grub.d/10_netbsd.in: grub-mkconfig helper script for NetBSD.
|
||||||
|
* util/grub-mkconfig.in: export new NetBSD specific variables.
|
||||||
|
* po/POTFILES-shell: added 10_netbsd.in.
|
||||||
|
* util/grub-mkconfig_lib.in: check for gettext binary, default to echo.
|
||||||
|
|
||||||
2010-04-19 BVK Chaitanya <bvk.groups@gmail.com>
|
2010-04-19 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
Fix emu build with grub-emu-pci and grub-emu-modules.
|
Fix emu build with grub-emu-pci and grub-emu-modules.
|
||||||
|
@ -55,7 +262,7 @@
|
||||||
|
|
||||||
* disk/lvm.c (grub_lvm_memberlist): Issue an error if pv->disk = 0.
|
* disk/lvm.c (grub_lvm_memberlist): Issue an error if pv->disk = 0.
|
||||||
|
|
||||||
2010-04-17 Christian Franke <franke@computer.org>
|
2010-04-17 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
* Makefile.in: Add missing localedir setting.
|
* Makefile.in: Add missing localedir setting.
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,12 @@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
||||||
OBJCONV = @OBJCONV@
|
OBJCONV = @OBJCONV@
|
||||||
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
||||||
-Wall -W
|
-Wall -W
|
||||||
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
|
TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@
|
||||||
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
||||||
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
|
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
|
||||||
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
||||||
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
||||||
kernel_img_LDFLAGS = -static-libgcc -lgcc
|
kernel_img_LDFLAGS = -lgcc
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
OBJCOPY = @OBJCOPY@
|
OBJCOPY = @OBJCOPY@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
|
|
@ -63,5 +63,8 @@ VARIABLE(grub_core_entry_addr)
|
||||||
*right here* and this is why we need this kludge. */
|
*right here* and this is why we need this kludge. */
|
||||||
|
|
||||||
. = GRUB_BOOT_MACHINE_SIZE - 16
|
. = GRUB_BOOT_MACHINE_SIZE - 16
|
||||||
|
|
||||||
|
.code16
|
||||||
|
|
||||||
jmp _start
|
jmp _start
|
||||||
. = GRUB_BOOT_MACHINE_SIZE
|
. = GRUB_BOOT_MACHINE_SIZE
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/crypto.h>
|
#include <grub/crypto.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
|
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
||||||
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
|
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
||||||
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
|
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIRECTORY"),
|
||||||
ARG_TYPE_STRING},
|
ARG_TYPE_STRING},
|
||||||
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
|
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -249,21 +250,21 @@ GRUB_MOD_INIT(hashsum)
|
||||||
options);
|
options);
|
||||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"md5sum [-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]",
|
"[FILE1 [FILE2 ...]]"),
|
||||||
"Compute or check hash checksum.",
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"sha256sum [-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]",
|
"[FILE1 [FILE2 ...]]"),
|
||||||
"Compute or check hash checksum.",
|
"Compute or check hash checksum.",
|
||||||
options);
|
options);
|
||||||
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"sha512sum [-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]",
|
"[FILE1 [FILE2 ...]]"),
|
||||||
"Compute or check hash checksum.",
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||||
else
|
else
|
||||||
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
|
||||||
_(cmd->description));
|
_(cmd->description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,11 +402,10 @@ GRUB_MOD_INIT (drivemap)
|
||||||
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
|
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
|
||||||
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
||||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"drivemap"
|
N_("-l | -r | [-s] grubdev osdisk."),
|
||||||
N_("-l | -r | [-s] grubdev osdisk."),
|
N_("Manage the BIOS drive mappings."),
|
||||||
N_("Manage the BIOS drive mappings."),
|
options);
|
||||||
options);
|
|
||||||
drivemap_hook =
|
drivemap_hook =
|
||||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
grub_loader_register_preboot_hook (&install_int13_handler,
|
||||||
&uninstall_int13_handler,
|
&uninstall_int13_handler,
|
||||||
|
|
|
@ -177,16 +177,20 @@ static grub_err_t
|
||||||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
if (argc == 1)
|
||||||
if (file)
|
|
||||||
{
|
{
|
||||||
struct note buf;
|
struct note buf;
|
||||||
grub_uint32_t tempo;
|
grub_uint32_t tempo;
|
||||||
|
grub_file_t file;
|
||||||
|
|
||||||
|
file = grub_file_open (args[0]);
|
||||||
|
|
||||||
|
if (! file)
|
||||||
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||||
|
|
||||||
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
||||||
{
|
{
|
||||||
|
|
150
commands/iorw.c
Normal file
150
commands/iorw.c
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/* memrw.c - command to read / write physical memory */
|
||||||
|
/*
|
||||||
|
* 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/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/env.h>
|
||||||
|
#include <grub/cpu/io.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||||
|
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] =
|
||||||
|
{
|
||||||
|
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||||
|
N_("VARNAME"), ARG_TYPE_STRING},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
||||||
|
{
|
||||||
|
grub_target_addr_t addr;
|
||||||
|
grub_uint32_t value = 0;
|
||||||
|
char buf[sizeof ("XXXXXXXX")];
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||||
|
|
||||||
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
|
switch (cmd->cmd->name[sizeof ("in") - 1])
|
||||||
|
{
|
||||||
|
case 'l':
|
||||||
|
value = grub_inl (addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
value = grub_inw (addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
value = grub_inb (addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd->state[0].set)
|
||||||
|
{
|
||||||
|
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||||
|
grub_env_set (cmd->state[0].arg, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grub_printf ("0x%x\n", value);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||||
|
{
|
||||||
|
grub_target_addr_t addr;
|
||||||
|
grub_uint32_t value;
|
||||||
|
grub_uint32_t mask = 0xffffffff;
|
||||||
|
|
||||||
|
if (argc != 2 && argc != 3)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||||
|
|
||||||
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
|
value = grub_strtoul (argv[1], 0, 0);
|
||||||
|
if (argc == 3)
|
||||||
|
mask = grub_strtoul (argv[2], 0, 0);
|
||||||
|
value &= mask;
|
||||||
|
switch (cmd->name[sizeof ("out") - 1])
|
||||||
|
{
|
||||||
|
case 'l':
|
||||||
|
if (mask != 0xffffffff)
|
||||||
|
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
|
||||||
|
else
|
||||||
|
grub_outl (value, addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
if ((mask & 0xffff) != 0xffff)
|
||||||
|
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
|
||||||
|
else
|
||||||
|
grub_outw (value, addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
if ((mask & 0xff) != 0xff)
|
||||||
|
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
|
||||||
|
else
|
||||||
|
grub_outb (value, addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(memrw)
|
||||||
|
{
|
||||||
|
cmd_read_byte =
|
||||||
|
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
N_("PORT"), N_("Read byte from PORT."), options);
|
||||||
|
cmd_read_word =
|
||||||
|
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
N_("PORT"), N_("Read word from PORT."), options);
|
||||||
|
cmd_read_dword =
|
||||||
|
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
N_("PORT"), N_("Read dword from PORT."), options);
|
||||||
|
cmd_write_byte =
|
||||||
|
grub_register_command ("outb", grub_cmd_write,
|
||||||
|
N_("PORT VALUE [MASK]"),
|
||||||
|
N_("Write byte VALUE to PORT."));
|
||||||
|
cmd_write_word =
|
||||||
|
grub_register_command ("outw", grub_cmd_write,
|
||||||
|
N_("PORT VALUE [MASK]"),
|
||||||
|
N_("Write word VALUE to PORT."));
|
||||||
|
cmd_write_dword =
|
||||||
|
grub_register_command ("outl", grub_cmd_write,
|
||||||
|
N_("ADDR VALUE [MASK]"),
|
||||||
|
N_("Write dword VALUE to PORT."));
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(memrw)
|
||||||
|
{
|
||||||
|
grub_unregister_extcmd (cmd_read_byte);
|
||||||
|
grub_unregister_extcmd (cmd_read_word);
|
||||||
|
grub_unregister_extcmd (cmd_read_dword);
|
||||||
|
grub_unregister_command (cmd_write_byte);
|
||||||
|
grub_unregister_command (cmd_write_word);
|
||||||
|
grub_unregister_command (cmd_write_dword);
|
||||||
|
}
|
|
@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load modules. */
|
/* Load modules. */
|
||||||
#if GRUB_NO_MODULES
|
#if !GRUB_NO_MODULES
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
prefix = grub_env_get ("prefix");
|
prefix = grub_env_get ("prefix");
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
|
@ -186,8 +187,8 @@ GRUB_MOD_INIT(password_pbkdf2)
|
||||||
{
|
{
|
||||||
my_mod = mod;
|
my_mod = mod;
|
||||||
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
||||||
"password_pbkdf2 USER PBKDF2_PASSWORD",
|
N_("USER PBKDF2_PASSWORD"),
|
||||||
"Set user password (PBKDF2). ");
|
N_("Set user password (PBKDF2). "));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(password_pbkdf2)
|
GRUB_MOD_FINI(password_pbkdf2)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -69,8 +70,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(regexp)
|
GRUB_MOD_INIT(regexp)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("regexp", grub_cmd_regexp,
|
cmd = grub_register_command ("regexp", grub_cmd_regexp,
|
||||||
"REGEXP STRING",
|
N_("REGEXP STRING"),
|
||||||
"Test if REGEXP matches STRING.");
|
N_("Test if REGEXP matches STRING."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(regexp)
|
GRUB_MOD_FINI(regexp)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
struct pci_register
|
struct pci_register
|
||||||
{
|
{
|
||||||
|
@ -329,9 +330,9 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT(setpci)
|
GRUB_MOD_INIT(setpci)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||||
"[REGISTER][=VALUE[:MASK]]",
|
"[REGISTER][=VALUE[:MASK]]"),
|
||||||
"Manipulate PCI devices.", options);
|
N_("Manipulate PCI devices."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(setpci)
|
GRUB_MOD_FINI(setpci)
|
||||||
|
|
|
@ -26,37 +26,48 @@
|
||||||
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
||||||
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
||||||
|
|
||||||
|
struct abstract_terminal
|
||||||
|
{
|
||||||
|
struct abstract_terminal *next;
|
||||||
|
const char *name;
|
||||||
|
grub_err_t (*init) (void);
|
||||||
|
grub_err_t (*fini) (void);
|
||||||
|
};
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
handle_command (int argc, char **args, struct abstract_terminal **enabled,
|
||||||
int argc, char **args)
|
struct abstract_terminal **disabled,
|
||||||
|
struct grub_term_autoload *autoloads,
|
||||||
|
const char *active_str,
|
||||||
|
const char *available_str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
grub_term_input_t term;
|
struct abstract_terminal *term;
|
||||||
struct grub_term_autoload *aut;
|
struct grub_term_autoload *aut;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_puts_ (N_ ("Active input terminals:"));
|
grub_puts_ (active_str);
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
grub_printf ("%s ", term->name);
|
grub_printf ("%s ", term->name);
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
grub_puts_ (N_ ("Available input terminals:"));
|
grub_puts_ (available_str);
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
grub_printf ("%s ", term->name);
|
grub_printf ("%s ", term->name);
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
/* This is quadratic but we don't expect mode than 30 terminal
|
||||||
modules ever. */
|
modules ever. */
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
for (aut = autoloads; aut; aut = aut->next)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (!term)
|
if (!term)
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (!term)
|
if (!term)
|
||||||
grub_printf ("%s ", aut->name);
|
grub_printf ("%s ", aut->name);
|
||||||
}
|
}
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -73,112 +84,108 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
int again = 0;
|
int again = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term == 0)
|
if (term == 0)
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
break;
|
break;
|
||||||
if (again)
|
if (again)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
args[i]);
|
args[i]);
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
for (aut = autoloads; aut; aut = aut->next)
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
if (grub_strcmp (args[i], aut->name) == 0)
|
||||||
{
|
{
|
||||||
grub_dl_t mod;
|
grub_dl_t mod;
|
||||||
mod = grub_dl_load (aut->modname);
|
mod = grub_dl_load (aut->modname);
|
||||||
if (mod)
|
if (mod)
|
||||||
grub_dl_ref (mod);
|
grub_dl_ref (mod);
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!aut)
|
if (!aut)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
args[i]);
|
args[i]);
|
||||||
again = 1;
|
again = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0)
|
if (grub_strcmp (args[0], "--append") == 0)
|
||||||
{
|
{
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
{
|
{
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
}
|
||||||
GRUB_AS_LIST (term));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--remove") == 0)
|
if (grub_strcmp (args[0], "--remove") == 0)
|
||||||
{
|
{
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
{
|
{
|
||||||
if (!term->next && term == grub_term_inputs)
|
if (!term->next && term == *enabled)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
"can't remove the last terminal");
|
"can't remove the last terminal");
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
if (term->fini)
|
||||||
if (term->fini)
|
term->fini ();
|
||||||
term->fini ();
|
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
}
|
||||||
GRUB_AS_LIST (term));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
{
|
{
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
}
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
{
|
{
|
||||||
for (i = 0; i < argc; i++)
|
struct abstract_terminal *next;
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
for (term = *enabled; term; term = next)
|
||||||
break;
|
|
||||||
if (i == argc)
|
|
||||||
{
|
{
|
||||||
if (!term->next && term == grub_term_inputs)
|
next = term->next;
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
for (i = 0; i < argc; i++)
|
||||||
"can't remove the last terminal");
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
break;
|
||||||
GRUB_AS_LIST (term));
|
if (i == argc)
|
||||||
if (term->fini)
|
{
|
||||||
term->fini ();
|
if (!term->next && term == *enabled)
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
GRUB_AS_LIST (term));
|
"can't remove the last terminal");
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
|
if (term->fini)
|
||||||
|
term->fini ();
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,163 +193,34 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
int i;
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, next);
|
||||||
grub_term_output_t term;
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, name);
|
||||||
struct grub_term_autoload *aut;
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
|
||||||
|
return handle_command (argc, args,
|
||||||
|
(struct abstract_terminal **) &grub_term_inputs,
|
||||||
|
(struct abstract_terminal **) &grub_term_inputs_disabled,
|
||||||
|
grub_term_input_autoload,
|
||||||
|
N_ ("Active input terminals:"),
|
||||||
|
N_ ("Available input terminals:"));
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == 0)
|
static grub_err_t
|
||||||
{
|
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||||
grub_puts_ (N_ ("Active output terminals:"));
|
int argc, char **args)
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
{
|
||||||
grub_printf ("%s ", term->name);
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, next);
|
||||||
grub_printf ("\n");
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
|
||||||
grub_puts_ (N_ ("Available output terminals:"));
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
|
||||||
grub_printf ("%s ", term->name);
|
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
(struct abstract_terminal **) &grub_term_outputs_disabled,
|
||||||
modules ever. */
|
grub_term_output_autoload,
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
N_ ("Active output terminals:"),
|
||||||
{
|
N_ ("Available output terminals:"));
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
grub_printf ("%s ", aut->name);
|
|
||||||
}
|
|
||||||
grub_printf ("\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0
|
|
||||||
|| grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i == argc)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
|
||||||
|
|
||||||
for (; i < argc; i++)
|
|
||||||
{
|
|
||||||
int again = 0;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term == 0)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
break;
|
|
||||||
if (again)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
mod = grub_dl_load (aut->modname);
|
|
||||||
if (mod)
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!aut)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
again = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
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));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
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));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (i == argc)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
||||||
|
@ -351,14 +229,14 @@ GRUB_MOD_INIT(terminal)
|
||||||
{
|
{
|
||||||
cmd_terminal_input =
|
cmd_terminal_input =
|
||||||
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
||||||
"[--append|--remove] "
|
N_("[--append|--remove] "
|
||||||
"[TERMINAL1] [TERMINAL2] ...",
|
"[TERMINAL1] [TERMINAL2] ..."),
|
||||||
"List or select an input terminal.");
|
N_("List or select an input terminal."));
|
||||||
cmd_terminal_output =
|
cmd_terminal_output =
|
||||||
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
||||||
"[--append|--remove] "
|
N_("[--append|--remove] "
|
||||||
"[TERMINAL1] [TERMINAL2] ...",
|
"[TERMINAL1] [TERMINAL2] ..."),
|
||||||
"List or select an output terminal.");
|
N_("List or select an output terminal."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(terminal)
|
GRUB_MOD_FINI(terminal)
|
||||||
|
|
|
@ -30,9 +30,9 @@ grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
|
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
|
||||||
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||||
|
@ -68,7 +68,7 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c kern/emu/hostfs.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
||||||
fs/befs_be.c fs/tar.c \
|
fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
|
@ -297,6 +297,12 @@ minix_mod_SOURCES = fs/minix.c
|
||||||
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For nilfs2.mod.
|
||||||
|
pkglib_MODULES += nilfs2.mod
|
||||||
|
nilfs2_mod_SOURCES = fs/nilfs2.c
|
||||||
|
nilfs2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For hfs.mod.
|
# For hfs.mod.
|
||||||
hfs_mod_SOURCES = fs/hfs.c
|
hfs_mod_SOURCES = fs/hfs.c
|
||||||
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
|
|
@ -10,7 +10,7 @@ pkglib_PROGRAMS += kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
kern/i386/multiboot_mmap.c \
|
kern/i386/coreboot/mmap.c \
|
||||||
kern/i386/halt.c \
|
kern/i386/halt.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
|
|
74
conf/i386-multiboot.rmk
Normal file
74
conf/i386-multiboot.rmk
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
|
# Images.
|
||||||
|
|
||||||
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
|
pkglib_PROGRAMS += kernel.img
|
||||||
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
|
kern/i386/misc.S \
|
||||||
|
kern/i386/coreboot/init.c \
|
||||||
|
kern/i386/multiboot_mmap.c \
|
||||||
|
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/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 \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c \
|
||||||
|
kern/env.c \
|
||||||
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
|
symlist.c
|
||||||
|
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
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For aout.mod.
|
||||||
|
aout_mod_SOURCES = loader/aout.c
|
||||||
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For bsd.mod
|
||||||
|
pkglib_MODULES += bsd.mod
|
||||||
|
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
||||||
|
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
|
@ -82,9 +82,9 @@ grub_setup_SOURCES = gnulib/progname.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||||
partmap/gpt.c \
|
partmap/gpt.c \
|
||||||
|
|
|
@ -68,3 +68,8 @@ play_mod_SOURCES = commands/i386/pc/play.c
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For iorw.mod.
|
||||||
|
pkglib_MODULES += iorw.mod
|
||||||
|
iorw_mod_SOURCES = commands/iorw.c
|
||||||
|
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
|
@ -58,9 +58,9 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||||
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||||
|
|
|
@ -68,6 +68,9 @@ grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
|
||||||
check_SCRIPTS += grub_script_dollar
|
check_SCRIPTS += grub_script_dollar
|
||||||
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
|
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_comments
|
||||||
|
grub_script_comments_SOURCES = tests/grub_script_comments.in
|
||||||
|
|
||||||
# List of tests to execute on "make check"
|
# List of tests to execute on "make check"
|
||||||
# SCRIPTED_TESTS = example_scripted_test
|
# SCRIPTED_TESTS = example_scripted_test
|
||||||
# SCRIPTED_TESTS += example_grub_script_test
|
# SCRIPTED_TESTS += example_grub_script_test
|
||||||
|
@ -83,6 +86,7 @@ SCRIPTED_TESTS += grub_script_if
|
||||||
SCRIPTED_TESTS += grub_script_blanklines
|
SCRIPTED_TESTS += grub_script_blanklines
|
||||||
SCRIPTED_TESTS += grub_script_final_semicolon
|
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||||
SCRIPTED_TESTS += grub_script_dollar
|
SCRIPTED_TESTS += grub_script_dollar
|
||||||
|
SCRIPTED_TESTS += grub_script_comments
|
||||||
|
|
||||||
# dependencies between tests and testing-tools
|
# dependencies between tests and testing-tools
|
||||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||||
|
|
|
@ -64,13 +64,17 @@ appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
|
||||||
ifeq ($(target_cpu), x86_64)
|
ifeq ($(target_cpu), x86_64)
|
||||||
linux_mod_SOURCES += loader/i386/linux_trampoline.S
|
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
|
||||||
endif
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
else
|
||||||
|
linux_mod_SOURCES = loader/i386/efi/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
|
22
configure.ac
22
configure.ac
|
@ -102,6 +102,7 @@ case "$target_cpu"-"$platform" in
|
||||||
i386-efi) ;;
|
i386-efi) ;;
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
i386-pc) ;;
|
i386-pc) ;;
|
||||||
|
i386-multiboot) ;;
|
||||||
i386-coreboot) ;;
|
i386-coreboot) ;;
|
||||||
i386-linuxbios) platform=coreboot ;;
|
i386-linuxbios) platform=coreboot ;;
|
||||||
i386-ieee1275) ;;
|
i386-ieee1275) ;;
|
||||||
|
@ -136,6 +137,7 @@ esac
|
||||||
|
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
||||||
|
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
|
||||||
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
||||||
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
||||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||||
|
@ -413,9 +415,7 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||||
[grub_cv_cc_mcmodel=no])
|
[grub_cv_cc_mcmodel=no])
|
||||||
])
|
])
|
||||||
if test "x$grub_cv_cc_mcmodel" = xno; then
|
if test "x$grub_cv_cc_mcmodel" = xno; then
|
||||||
CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
|
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
|
|
||||||
AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
|
|
||||||
else
|
else
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||||
fi
|
fi
|
||||||
|
@ -513,11 +513,11 @@ grub_PROG_OBJCOPY_ABSOLUTE
|
||||||
fi
|
fi
|
||||||
grub_PROG_LD_BUILD_ID_NONE
|
grub_PROG_LD_BUILD_ID_NONE
|
||||||
if test "x$target_cpu" = xi386; then
|
if test "x$target_cpu" = xi386; then
|
||||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
|
||||||
# Check symbols provided by linker script.
|
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000,--defsym,___main=0x8100"
|
# Check symbols provided by linker script.
|
||||||
fi
|
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
|
||||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
fi
|
||||||
grub_CHECK_BSS_START_SYMBOL
|
grub_CHECK_BSS_START_SYMBOL
|
||||||
grub_CHECK_END_SYMBOL
|
grub_CHECK_END_SYMBOL
|
||||||
fi
|
fi
|
||||||
|
@ -637,6 +637,12 @@ else
|
||||||
fi
|
fi
|
||||||
AC_SUBST(TARGET_NO_MODULES)
|
AC_SUBST(TARGET_NO_MODULES)
|
||||||
|
|
||||||
|
if test "$TARGET_NO_MODULES" = yes ; then
|
||||||
|
# Do not convert modules, otherwise linkage may fail (Cygwin only).
|
||||||
|
# FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
|
||||||
|
TARGET_OBJ2ELF=
|
||||||
|
fi
|
||||||
|
|
||||||
if test x"$enable_grub_emu_usb" = xno ; then
|
if test x"$enable_grub_emu_usb" = xno ; then
|
||||||
grub_emu_usb_excuse="explicitly disabled"
|
grub_emu_usb_excuse="explicitly disabled"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1379,7 +1379,8 @@ pitch and duration pairs.
|
||||||
If the arguments are a series of numbers, play the inline tune.
|
If the arguments are a series of numbers, play the inline tune.
|
||||||
|
|
||||||
The tempo is the base for all note durations. 60 gives a 1-second base, 120
|
The tempo is the base for all note durations. 60 gives a 1-second base, 120
|
||||||
gives a half-second base, etc. Pitches are Hz.
|
gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
|
||||||
|
a rest.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <grub/efiemu/efiemu.h>
|
#include <grub/efiemu/efiemu.h>
|
||||||
#include <grub/machine/efiemu.h>
|
#include <grub/machine/efiemu.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* System table. Two version depending on mode */
|
/* System table. Two version depending on mode */
|
||||||
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
|
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
|
||||||
|
@ -327,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
|
||||||
{
|
{
|
||||||
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
||||||
grub_cmd_efiemu_load,
|
grub_cmd_efiemu_load,
|
||||||
"FILE",
|
N_("FILE"),
|
||||||
"Load and initialize EFI emulator.");
|
N_("Load and initialize EFI emulator."));
|
||||||
cmd_prepare = grub_register_command ("efiemu_prepare",
|
cmd_prepare = grub_register_command ("efiemu_prepare",
|
||||||
grub_cmd_efiemu_prepare,
|
grub_cmd_efiemu_prepare,
|
||||||
0,
|
0,
|
||||||
"Finalize loading of EFI emulator.");
|
N_("Finalize loading of EFI emulator."));
|
||||||
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
||||||
0,
|
0,
|
||||||
"Unload EFI emulator.");
|
N_("Unload EFI emulator."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(efiemu)
|
GRUB_MOD_FINI(efiemu)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -62,11 +63,11 @@ GRUB_MOD_INIT(font)
|
||||||
|
|
||||||
cmd_loadfont =
|
cmd_loadfont =
|
||||||
grub_register_command ("loadfont", loadfont_command,
|
grub_register_command ("loadfont", loadfont_command,
|
||||||
"FILE...",
|
N_("FILE..."),
|
||||||
"Specify one or more font files to load.");
|
N_("Specify one or more font files to load."));
|
||||||
cmd_lsfonts =
|
cmd_lsfonts =
|
||||||
grub_register_command ("lsfonts", lsfonts_command,
|
grub_register_command ("lsfonts", lsfonts_command,
|
||||||
0, "List the loaded fonts.");
|
0, N_("List the loaded fonts."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(font)
|
GRUB_MOD_FINI(font)
|
||||||
|
|
1133
fs/nilfs2.c
Normal file
1133
fs/nilfs2.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,6 @@ enum grub_dev_abstraction_types {
|
||||||
};
|
};
|
||||||
|
|
||||||
char *grub_guess_root_device (const char *dir);
|
char *grub_guess_root_device (const char *dir);
|
||||||
char *grub_get_prefix (const char *dir);
|
|
||||||
int grub_util_get_dev_abstraction (const char *os_dev);
|
int grub_util_get_dev_abstraction (const char *os_dev);
|
||||||
char *grub_util_get_grub_dev (const char *os_dev);
|
char *grub_util_get_grub_dev (const char *os_dev);
|
||||||
const char *grub_util_check_block_device (const char *blk_dev);
|
const char *grub_util_check_block_device (const char *blk_dev);
|
||||||
|
|
|
@ -19,6 +19,8 @@ extern const char *program_name;
|
||||||
void grub_init_all (void);
|
void grub_init_all (void);
|
||||||
void grub_fini_all (void);
|
void grub_fini_all (void);
|
||||||
|
|
||||||
|
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||||
|
|
||||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
|
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
|
||||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
|
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
|
||||||
char * EXPORT_FUNC(xstrdup) (const char *str);
|
char * EXPORT_FUNC(xstrdup) (const char *str);
|
||||||
|
|
|
@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
|
||||||
|
|
||||||
struct grub_linuxbios_table_item
|
struct grub_linuxbios_table_item
|
||||||
{
|
{
|
||||||
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
|
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
|
||||||
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
|
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
|
||||||
|
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
|
||||||
grub_uint32_t tag;
|
grub_uint32_t tag;
|
||||||
grub_uint32_t size;
|
grub_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
1
include/grub/i386/multiboot/boot.h
Normal file
1
include/grub/i386/multiboot/boot.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/boot.h>
|
1
include/grub/i386/multiboot/console.h
Normal file
1
include/grub/i386/multiboot/console.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/console.h>
|
1
include/grub/i386/multiboot/init.h
Normal file
1
include/grub/i386/multiboot/init.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/init.h>
|
1
include/grub/i386/multiboot/kernel.h
Normal file
1
include/grub/i386/multiboot/kernel.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/kernel.h>
|
1
include/grub/i386/multiboot/loader.h
Normal file
1
include/grub/i386/multiboot/loader.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/loader.h>
|
1
include/grub/i386/multiboot/memory.h
Normal file
1
include/grub/i386/multiboot/memory.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/memory.h>
|
1
include/grub/i386/multiboot/serial.h
Normal file
1
include/grub/i386/multiboot/serial.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/serial.h>
|
1
include/grub/i386/multiboot/time.h
Normal file
1
include/grub/i386/multiboot/time.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/time.h>
|
|
@ -47,6 +47,8 @@ struct grub_menu_entry
|
||||||
/* The sourcecode of the menu entry, used by the editor. */
|
/* The sourcecode of the menu entry, used by the editor. */
|
||||||
const char *sourcecode;
|
const char *sourcecode;
|
||||||
|
|
||||||
|
int hotkey;
|
||||||
|
|
||||||
/* The next element. */
|
/* The next element. */
|
||||||
struct grub_menu_entry *next;
|
struct grub_menu_entry *next;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,7 @@ void grub_multiboot_set_bootdev (void);
|
||||||
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
||||||
grub_err_t grub_multiboot_set_video_mode (void);
|
grub_err_t grub_multiboot_set_video_mode (void);
|
||||||
|
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#include <grub/i386/pc/vbe.h>
|
#include <grub/i386/pc/vbe.h>
|
||||||
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <grub/file.h>
|
#include <grub/file.h>
|
||||||
#include <grub/device.h>
|
#include <grub/device.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* set ENVVAR=VALUE */
|
/* set ENVVAR=VALUE */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -178,11 +179,13 @@ void
|
||||||
grub_register_core_commands (void)
|
grub_register_core_commands (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("set", grub_core_cmd_set,
|
grub_register_command ("set", grub_core_cmd_set,
|
||||||
"[ENVVAR=VALUE]", "Set an environment variable.");
|
N_("[ENVVAR=VALUE]"),
|
||||||
|
N_("Set an environment variable."));
|
||||||
grub_register_command ("unset", grub_core_cmd_unset,
|
grub_register_command ("unset", grub_core_cmd_unset,
|
||||||
"ENVVAR", "Remove an environment variable.");
|
N_("ENVVAR"),
|
||||||
|
N_("Remove an environment variable."));
|
||||||
grub_register_command ("ls", grub_core_cmd_ls,
|
grub_register_command ("ls", grub_core_cmd_ls,
|
||||||
"[ARG]", "List devices or files.");
|
N_("[ARG]"), N_("List devices or files."));
|
||||||
grub_register_command ("insmod", grub_core_cmd_insmod,
|
grub_register_command ("insmod", grub_core_cmd_insmod,
|
||||||
"MODULE", "Insert a module.");
|
N_("MODULE"), N_("Insert a module."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
# include <sys/fcntl.h>
|
# include <sys/fcntl.h>
|
||||||
|
@ -83,103 +85,6 @@ xgetcwd (void)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* Convert POSIX path to Win32 path,
|
|
||||||
remove drive letter, replace backslashes. */
|
|
||||||
static char *
|
|
||||||
get_win32_path (const char *path)
|
|
||||||
{
|
|
||||||
char winpath[PATH_MAX];
|
|
||||||
cygwin_conv_to_full_win32_path (path, winpath);
|
|
||||||
|
|
||||||
int len = strlen (winpath);
|
|
||||||
if (len > 2 && winpath[1] == ':')
|
|
||||||
{
|
|
||||||
len -= 2;
|
|
||||||
memmove (winpath, winpath + 2, len + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
if (winpath[i] == '\\')
|
|
||||||
winpath[i] = '/';
|
|
||||||
return xstrdup (winpath);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *
|
|
||||||
grub_get_prefix (const char *dir)
|
|
||||||
{
|
|
||||||
char *saved_cwd;
|
|
||||||
char *abs_dir, *prev_dir;
|
|
||||||
char *prefix;
|
|
||||||
struct stat st, prev_st;
|
|
||||||
|
|
||||||
/* Save the current directory. */
|
|
||||||
saved_cwd = xgetcwd ();
|
|
||||||
|
|
||||||
if (chdir (dir) < 0)
|
|
||||||
grub_util_error ("cannot change directory to `%s'", dir);
|
|
||||||
|
|
||||||
abs_dir = xgetcwd ();
|
|
||||||
strip_extra_slashes (abs_dir);
|
|
||||||
prev_dir = xstrdup (abs_dir);
|
|
||||||
|
|
||||||
if (stat (".", &prev_st) < 0)
|
|
||||||
grub_util_error ("cannot stat `%s'", dir);
|
|
||||||
|
|
||||||
if (! S_ISDIR (prev_st.st_mode))
|
|
||||||
grub_util_error ("`%s' is not a directory", dir);
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (chdir ("..") < 0)
|
|
||||||
grub_util_error ("cannot change directory to the parent");
|
|
||||||
|
|
||||||
if (stat (".", &st) < 0)
|
|
||||||
grub_util_error ("cannot stat current directory");
|
|
||||||
|
|
||||||
if (! S_ISDIR (st.st_mode))
|
|
||||||
grub_util_error ("current directory is not a directory???");
|
|
||||||
|
|
||||||
if (prev_st.st_dev != st.st_dev || prev_st.st_ino == st.st_ino)
|
|
||||||
break;
|
|
||||||
|
|
||||||
free (prev_dir);
|
|
||||||
prev_dir = xgetcwd ();
|
|
||||||
prev_st = st;
|
|
||||||
}
|
|
||||||
|
|
||||||
strip_extra_slashes (prev_dir);
|
|
||||||
prefix = xmalloc (strlen (abs_dir) - strlen (prev_dir) + 2);
|
|
||||||
prefix[0] = '/';
|
|
||||||
strcpy (prefix + 1, abs_dir + strlen (prev_dir));
|
|
||||||
strip_extra_slashes (prefix);
|
|
||||||
|
|
||||||
if (chdir (saved_cwd) < 0)
|
|
||||||
grub_util_error ("cannot change directory to `%s'", dir);
|
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
|
|
||||||
{
|
|
||||||
/* Reached some mount point not below /cygdrive.
|
|
||||||
GRUB does not know Cygwin's emulated mounts,
|
|
||||||
convert to Win32 path. */
|
|
||||||
grub_util_info ("Cygwin prefix = %s", prefix);
|
|
||||||
char * wprefix = get_win32_path (prefix);
|
|
||||||
free (prefix);
|
|
||||||
prefix = wprefix;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free (saved_cwd);
|
|
||||||
free (abs_dir);
|
|
||||||
free (prev_dir);
|
|
||||||
|
|
||||||
grub_util_info ("prefix = %s", prefix);
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -641,4 +546,3 @@ grub_util_check_char_device (const char *blk_dev)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ main (int argc, char *argv[])
|
||||||
if (strcmp (root_dev, "host") == 0)
|
if (strcmp (root_dev, "host") == 0)
|
||||||
dir = xstrdup (dir);
|
dir = xstrdup (dir);
|
||||||
else
|
else
|
||||||
dir = grub_get_prefix (dir);
|
dir = grub_make_system_path_relative_to_its_root (dir);
|
||||||
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
|
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
|
||||||
sprintf (prefix, "(%s)%s", root_dev, dir);
|
sprintf (prefix, "(%s)%s", root_dev, dir);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
|
103
kern/emu/misc.c
103
kern/emu/misc.c
|
@ -3,8 +3,12 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
|
@ -171,3 +175,102 @@ grub_get_rtc (void)
|
||||||
+ (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
|
+ (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
|
||||||
* GRUB_TICKS_PER_SECOND / 1000000));
|
* GRUB_TICKS_PER_SECOND / 1000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function never prints trailing slashes (so that its output
|
||||||
|
can be appended a slash unconditionally). */
|
||||||
|
char *
|
||||||
|
grub_make_system_path_relative_to_its_root (const char *path)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
char *p, *buf, *buf2, *buf3;
|
||||||
|
uintptr_t offset = 0;
|
||||||
|
dev_t num;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/* canonicalize. */
|
||||||
|
p = canonicalize_file_name (path);
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
|
grub_util_error ("failed to get canonical path of %s", path);
|
||||||
|
|
||||||
|
len = strlen (p) + 1;
|
||||||
|
buf = xstrdup (p);
|
||||||
|
free (p);
|
||||||
|
|
||||||
|
if (stat (buf, &st) < 0)
|
||||||
|
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
||||||
|
|
||||||
|
buf2 = xstrdup (buf);
|
||||||
|
num = st.st_dev;
|
||||||
|
|
||||||
|
/* This loop sets offset to the number of chars of the root
|
||||||
|
directory we're inspecting. */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
p = strrchr (buf, '/');
|
||||||
|
if (p == NULL)
|
||||||
|
/* This should never happen. */
|
||||||
|
grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)");
|
||||||
|
if (p != buf)
|
||||||
|
*p = 0;
|
||||||
|
else
|
||||||
|
*++p = 0;
|
||||||
|
|
||||||
|
if (stat (buf, &st) < 0)
|
||||||
|
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
||||||
|
|
||||||
|
/* buf is another filesystem; we found it. */
|
||||||
|
if (st.st_dev != num)
|
||||||
|
{
|
||||||
|
/* offset == 0 means path given is the mount point.
|
||||||
|
This works around special-casing of "/" in Un*x. This function never
|
||||||
|
prints trailing slashes (so that its output can be appended a slash
|
||||||
|
unconditionally). Each slash in is considered a preceding slash, and
|
||||||
|
therefore the root directory is an empty string. */
|
||||||
|
if (offset == 0)
|
||||||
|
{
|
||||||
|
free (buf);
|
||||||
|
free (buf2);
|
||||||
|
return xstrdup ("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = p - buf;
|
||||||
|
/* offset == 1 means root directory. */
|
||||||
|
if (offset == 1)
|
||||||
|
{
|
||||||
|
/* Include leading slash. */
|
||||||
|
offset = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free (buf);
|
||||||
|
buf3 = xstrdup (buf2 + offset);
|
||||||
|
free (buf2);
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
|
||||||
|
{
|
||||||
|
/* Reached some mount point not below /cygdrive.
|
||||||
|
GRUB does not know Cygwin's emulated mounts,
|
||||||
|
convert to Win32 path. */
|
||||||
|
grub_util_info ("Cygwin path = %s\n", buf3);
|
||||||
|
char * temp = get_win32_path (buf3);
|
||||||
|
free (buf3);
|
||||||
|
buf3 = temp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Remove trailing slashes, return empty string if root directory. */
|
||||||
|
len = strlen (buf3);
|
||||||
|
while (len > 0 && buf3[len - 1] == '/')
|
||||||
|
{
|
||||||
|
buf3[len - 1] = '\0';
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf3;
|
||||||
|
}
|
||||||
|
|
|
@ -117,7 +117,9 @@ grub_machine_init (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
grub_machine_mmap_init ();
|
grub_machine_mmap_init ();
|
||||||
|
#endif
|
||||||
grub_machine_mmap_iterate (heap_init);
|
grub_machine_mmap_iterate (heap_init);
|
||||||
|
|
||||||
grub_tsc_init ();
|
grub_tsc_init ();
|
||||||
|
|
|
@ -57,13 +57,23 @@ signature_found:
|
||||||
(long) table_header->size);
|
(long) table_header->size);
|
||||||
for (; table_item->size;
|
for (; table_item->size;
|
||||||
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
|
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
|
||||||
if (hook (table_item))
|
{
|
||||||
return 1;
|
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
|
||||||
|
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
|
||||||
|
*(grub_uint64_t *) (table_item + 1)))
|
||||||
|
{
|
||||||
|
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
|
||||||
|
*(grub_uint64_t *) (table_item + 1);
|
||||||
|
goto signature_found;
|
||||||
|
}
|
||||||
|
if (hook (table_item))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
grub_err_t
|
||||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||||
{
|
{
|
||||||
mem_region_t mem_region;
|
mem_region_t mem_region;
|
||||||
|
|
|
@ -66,10 +66,12 @@ multiboot_header:
|
||||||
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
|
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
|
||||||
|
|
||||||
codestart:
|
codestart:
|
||||||
|
#ifdef GRUB_MACHINE_MULTIBOOT
|
||||||
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
|
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
|
||||||
jne 0f
|
jne 0f
|
||||||
movl %ebx, EXT_C(startup_multiboot_info)
|
movl %ebx, EXT_C(startup_multiboot_info)
|
||||||
0:
|
0:
|
||||||
|
#endif
|
||||||
|
|
||||||
/* initialize the stack */
|
/* initialize the stack */
|
||||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
|
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
|
||||||
|
|
|
@ -102,7 +102,7 @@ grub_load_config (void)
|
||||||
auto int hook (struct grub_module_header *);
|
auto int hook (struct grub_module_header *);
|
||||||
int hook (struct grub_module_header *header)
|
int hook (struct grub_module_header *header)
|
||||||
{
|
{
|
||||||
/* Not an ELF module, skip. */
|
/* Not an embedded config, skip. */
|
||||||
if (header->type != OBJ_TYPE_CONFIG)
|
if (header->type != OBJ_TYPE_CONFIG)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
38
kern/mm.c
38
kern/mm.c
|
@ -148,15 +148,14 @@ grub_mm_init_region (void *addr, grub_size_t size)
|
||||||
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
|
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If this region is too small, ignore it. */
|
|
||||||
if (size < GRUB_MM_ALIGN * 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Allocate a region from the head. */
|
/* Allocate a region from the head. */
|
||||||
r = (grub_mm_region_t) (((grub_addr_t) addr + GRUB_MM_ALIGN - 1)
|
r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN);
|
||||||
& (~(GRUB_MM_ALIGN - 1)));
|
|
||||||
size -= (char *) r - (char *) addr + sizeof (*r);
|
size -= (char *) r - (char *) addr + sizeof (*r);
|
||||||
|
|
||||||
|
/* If this region is too small, ignore it. */
|
||||||
|
if (size < GRUB_MM_ALIGN)
|
||||||
|
return;
|
||||||
|
|
||||||
h = (grub_mm_header_t) ((char *) r + GRUB_MM_ALIGN);
|
h = (grub_mm_header_t) ((char *) r + GRUB_MM_ALIGN);
|
||||||
h->next = h;
|
h->next = h;
|
||||||
h->magic = GRUB_MM_FREE_MAGIC;
|
h->magic = GRUB_MM_FREE_MAGIC;
|
||||||
|
@ -221,9 +220,8 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
||||||
+---------------+ v
|
+---------------+ v
|
||||||
*/
|
*/
|
||||||
q->next = p->next;
|
q->next = p->next;
|
||||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
|
||||||
}
|
}
|
||||||
else if (extra == 0 || p->size == n + extra)
|
else if (align == 1 || p->size == n + extra)
|
||||||
{
|
{
|
||||||
/* There might be alignment requirement, when taking it into
|
/* There might be alignment requirement, when taking it into
|
||||||
account memory block fits in.
|
account memory block fits in.
|
||||||
|
@ -240,10 +238,25 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
||||||
| alloc, size=n | |
|
| alloc, size=n | |
|
||||||
+---------------+ v
|
+---------------+ v
|
||||||
*/
|
*/
|
||||||
|
|
||||||
p->size -= n;
|
p->size -= n;
|
||||||
p += p->size;
|
p += p->size;
|
||||||
p->size = n;
|
}
|
||||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
else if (extra == 0)
|
||||||
|
{
|
||||||
|
grub_mm_header_t r;
|
||||||
|
|
||||||
|
r = p + extra + n;
|
||||||
|
r->magic = GRUB_MM_FREE_MAGIC;
|
||||||
|
r->size = p->size - extra - n;
|
||||||
|
r->next = p->next;
|
||||||
|
q->next = r;
|
||||||
|
|
||||||
|
if (q == p)
|
||||||
|
{
|
||||||
|
q = r;
|
||||||
|
r->next = r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -276,10 +289,11 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
||||||
p->size = extra;
|
p->size = extra;
|
||||||
p->next = r;
|
p->next = r;
|
||||||
p += extra;
|
p += extra;
|
||||||
p->size = n;
|
|
||||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->magic = GRUB_MM_ALLOC_MAGIC;
|
||||||
|
p->size = n;
|
||||||
|
|
||||||
/* Mark find as a start marker for next allocation to fasten it.
|
/* Mark find as a start marker for next allocation to fasten it.
|
||||||
This will have side effect of fragmenting memory as small
|
This will have side effect of fragmenting memory as small
|
||||||
pieces before this will be un-used. */
|
pieces before this will be un-used. */
|
||||||
|
|
|
@ -249,12 +249,11 @@ grub_parser_execute (char *source)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = grub_strchr (source, '\n');
|
p = grub_strchr (source, '\n');
|
||||||
if (p)
|
|
||||||
*p = 0;
|
|
||||||
|
|
||||||
*line = grub_strdup (source);
|
|
||||||
if (p)
|
if (p)
|
||||||
*p = '\n';
|
*line = grub_strndup (source, p - source);
|
||||||
|
else
|
||||||
|
*line = grub_strdup (source);
|
||||||
source = p ? p + 1 : 0;
|
source = p ? p + 1 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#define DEFAULT_VIDEO_MODE "text"
|
#define DEFAULT_VIDEO_MODE "text"
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_VIDEO_MODE "auto"
|
#define DEFAULT_VIDEO_MODE "auto"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
|
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#include <grub/i386/pc/vbe.h>
|
#include <grub/i386/pc/vbe.h>
|
||||||
#define HAS_VGA_TEXT 1
|
#define HAS_VGA_TEXT 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#ifndef GRUB_MMAP_REGISTER_BY_FIRMWARE
|
#ifndef GRUB_MMAP_REGISTER_BY_FIRMWARE
|
||||||
|
|
||||||
|
@ -414,8 +415,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(mmap)
|
GRUB_MOD_INIT(mmap)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("badram", grub_cmd_badram,
|
cmd = grub_register_command ("badram", grub_cmd_badram,
|
||||||
"ADDR1,MASK1[,ADDR2,MASK2[,...]]",
|
N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
|
||||||
"Declare memory regions as badram.");
|
N_("Declare memory regions as badram."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(mmap)
|
GRUB_MOD_FINI(mmap)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
struct menu_pointer
|
struct menu_pointer
|
||||||
{
|
{
|
||||||
|
@ -172,7 +173,7 @@ grub_context_init (void)
|
||||||
grub_env_export ("prefix");
|
grub_env_export ("prefix");
|
||||||
|
|
||||||
export_cmd = grub_register_command ("export", grub_cmd_export,
|
export_cmd = grub_register_command ("export", grub_cmd_export,
|
||||||
"export ENVVAR", "Export a variable.");
|
N_("ENVVAR"), N_("Export a variable."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -155,6 +155,17 @@ free_menu_entry_classes (struct grub_menu_entry_class *head)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int key;
|
||||||
|
} hotkey_aliases[] =
|
||||||
|
{
|
||||||
|
{"backspace", '\b'},
|
||||||
|
{"tab", '\t'},
|
||||||
|
{"delete", GRUB_TERM_DC}
|
||||||
|
};
|
||||||
|
|
||||||
/* Add a menu entry to the current menu context (as given by the environment
|
/* Add a menu entry to the current menu context (as given by the environment
|
||||||
variable data slot `menu'). As the configuration file is read, the script
|
variable data slot `menu'). As the configuration file is read, the script
|
||||||
parser calls this when a menu entry is to be created. */
|
parser calls this when a menu entry is to be created. */
|
||||||
|
@ -171,6 +182,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
||||||
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
|
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
|
||||||
struct grub_menu_entry_class *classes_tail;
|
struct grub_menu_entry_class *classes_tail;
|
||||||
char *users = NULL;
|
char *users = NULL;
|
||||||
|
int hotkey = 0;
|
||||||
|
|
||||||
/* Allocate dummy head node for class list. */
|
/* Allocate dummy head node for class list. */
|
||||||
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
|
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
|
||||||
|
@ -237,6 +249,32 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (grub_strcmp(arg, "hotkey") == 0)
|
||||||
|
{
|
||||||
|
unsigned j;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
if (args[i][1] == 0)
|
||||||
|
{
|
||||||
|
hotkey = args[i][0];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j < ARRAY_SIZE (hotkey_aliases); j++)
|
||||||
|
if (grub_strcmp (args[i], hotkey_aliases[j].name) == 0)
|
||||||
|
{
|
||||||
|
hotkey = hotkey_aliases[j].key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j < ARRAY_SIZE (hotkey_aliases))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
failed = 1;
|
||||||
|
grub_error (GRUB_ERR_MENU,
|
||||||
|
"Invalid hotkey: '%s'.", args[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Handle invalid argument. */
|
/* Handle invalid argument. */
|
||||||
|
@ -293,6 +331,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
||||||
}
|
}
|
||||||
|
|
||||||
(*last)->title = menutitle;
|
(*last)->title = menutitle;
|
||||||
|
(*last)->hotkey = hotkey;
|
||||||
(*last)->classes = classes_head;
|
(*last)->classes = classes_head;
|
||||||
if (users)
|
if (users)
|
||||||
(*last)->restricted = 1;
|
(*last)->restricted = 1;
|
||||||
|
@ -666,9 +705,9 @@ GRUB_MOD_INIT(normal)
|
||||||
|
|
||||||
/* Register a command "normal" for the rescue mode. */
|
/* Register a command "normal" for the rescue mode. */
|
||||||
grub_register_command ("normal", grub_cmd_normal,
|
grub_register_command ("normal", grub_cmd_normal,
|
||||||
0, "Enter normal mode.");
|
0, N_("Enter normal mode."));
|
||||||
grub_register_command ("normal_exit", grub_cmd_normal_exit,
|
grub_register_command ("normal_exit", grub_cmd_normal_exit,
|
||||||
0, "Exit from normal mode.");
|
0, N_("Exit from normal mode."));
|
||||||
|
|
||||||
/* Reload terminal colors when these variables are written to. */
|
/* Reload terminal colors when these variables are written to. */
|
||||||
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);
|
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);
|
||||||
|
|
|
@ -478,6 +478,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||||
goto refresh;
|
goto refresh;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
|
grub_menu_entry_t entry;
|
||||||
|
int i;
|
||||||
|
for (i = 0, entry = menu->entry_list; i < menu->size;
|
||||||
|
i++, entry = entry->next)
|
||||||
|
if (entry->hotkey == c)
|
||||||
|
{
|
||||||
|
menu_fini ();
|
||||||
|
*auto_boot = 0;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
# Shell language are included here.
|
# Shell language are included here.
|
||||||
util/grub.d/10_kfreebsd.in
|
util/grub.d/10_kfreebsd.in
|
||||||
util/grub.d/10_linux.in
|
util/grub.d/10_linux.in
|
||||||
|
util/grub.d/10_netbsd.in
|
||||||
|
|
|
@ -112,9 +112,9 @@ typedef size_t yy_size_t;
|
||||||
%option extra-type="struct grub_parser_param*"
|
%option extra-type="struct grub_parser_param*"
|
||||||
|
|
||||||
BLANK [ \t]
|
BLANK [ \t]
|
||||||
COMMENT ^[ \t]*#.*$
|
COMMENT #.*$
|
||||||
|
|
||||||
CHAR [^|&$;<> \t\n\'\"\\]
|
CHAR [^{}|&$;<> \t\n\'\"\\]
|
||||||
DIGITS [[:digit:]]+
|
DIGITS [[:digit:]]+
|
||||||
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
|
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/bitmap_scale.h>
|
#include <grub/bitmap_scale.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#define DEFAULT_VIDEO_MODE "auto"
|
#define DEFAULT_VIDEO_MODE "auto"
|
||||||
#define DEFAULT_BORDER_WIDTH 10
|
#define DEFAULT_BORDER_WIDTH 10
|
||||||
|
@ -1187,8 +1188,8 @@ GRUB_MOD_INIT(gfxterm)
|
||||||
grub_register_extcmd ("background_image",
|
grub_register_extcmd ("background_image",
|
||||||
grub_gfxterm_background_image_cmd,
|
grub_gfxterm_background_image_cmd,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"[-m (stretch|normal)] FILE",
|
N_("[-m (stretch|normal)] FILE"),
|
||||||
"Load background image for active terminal.",
|
N_("Load background image for active terminal."),
|
||||||
background_image_cmd_options);
|
background_image_cmd_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -616,8 +616,8 @@ GRUB_MOD_INIT(serial)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
|
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"serial [OPTIONS...]",
|
N_("[OPTIONS...]"),
|
||||||
"Configure serial port.", options);
|
N_("Configure serial port."), options);
|
||||||
|
|
||||||
/* Set default settings. */
|
/* Set default settings. */
|
||||||
serial_settings.port = serial_hw_get_port (0);
|
serial_settings.port = serial_hw_get_port (0);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <grub/terminfo.h>
|
#include <grub/terminfo.h>
|
||||||
#include <grub/tparm.h>
|
#include <grub/tparm.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
struct terminfo
|
struct terminfo
|
||||||
{
|
{
|
||||||
|
@ -178,7 +179,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(terminfo)
|
GRUB_MOD_INIT(terminfo)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
|
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
|
||||||
"[TERM]", "Set terminfo type.");
|
N_("[TERM]"), N_("Set terminfo type."));
|
||||||
grub_terminfo_set_current ("vt100");
|
grub_terminfo_set_current ("vt100");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
28
tests/grub_script_comments.in
Normal file
28
tests/grub_script_comments.in
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#! @builddir@/grub-shell-tester
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
echo a###b
|
||||||
|
echo a# #b
|
||||||
|
|
||||||
|
echo #
|
||||||
|
echo \#
|
||||||
|
|
||||||
|
echo '#'
|
||||||
|
echo "#"
|
||||||
|
|
||||||
|
echo '\#'
|
||||||
|
echo "\#"
|
|
@ -239,11 +239,14 @@ export GRUB_DEFAULT \
|
||||||
GRUB_DISTRIBUTOR \
|
GRUB_DISTRIBUTOR \
|
||||||
GRUB_CMDLINE_LINUX \
|
GRUB_CMDLINE_LINUX \
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT \
|
GRUB_CMDLINE_LINUX_DEFAULT \
|
||||||
|
GRUB_CMDLINE_NETBSD \
|
||||||
|
GRUB_CMDLINE_NETBSD_DEFAULT \
|
||||||
GRUB_TERMINAL_INPUT \
|
GRUB_TERMINAL_INPUT \
|
||||||
GRUB_TERMINAL_OUTPUT \
|
GRUB_TERMINAL_OUTPUT \
|
||||||
GRUB_SERIAL_COMMAND \
|
GRUB_SERIAL_COMMAND \
|
||||||
GRUB_DISABLE_LINUX_UUID \
|
GRUB_DISABLE_LINUX_UUID \
|
||||||
GRUB_DISABLE_LINUX_RECOVERY \
|
GRUB_DISABLE_LINUX_RECOVERY \
|
||||||
|
GRUB_DISABLE_NETBSD_RECOVERY \
|
||||||
GRUB_GFXMODE \
|
GRUB_GFXMODE \
|
||||||
GRUB_BACKGROUND \
|
GRUB_BACKGROUND \
|
||||||
GRUB_THEME \
|
GRUB_THEME \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Helper library for grub-mkconfig
|
# Helper library for grub-mkconfig
|
||||||
# Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
# Copyright (C) 2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# GRUB is free software: you can redistribute it and/or modify
|
# GRUB is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,6 +31,12 @@ if test "x$grub_mkrelpath" = x; then
|
||||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $(which gettext >/dev/null 2>/dev/null) ; then
|
||||||
|
gettext="gettext"
|
||||||
|
else
|
||||||
|
gettext="echo"
|
||||||
|
fi
|
||||||
|
|
||||||
grub_warn ()
|
grub_warn ()
|
||||||
{
|
{
|
||||||
echo "Warning: $@" >&2
|
echo "Warning: $@" >&2
|
||||||
|
@ -38,21 +44,7 @@ grub_warn ()
|
||||||
|
|
||||||
make_system_path_relative_to_its_root ()
|
make_system_path_relative_to_its_root ()
|
||||||
{
|
{
|
||||||
path="`${grub_mkrelpath} $1`"
|
${grub_mkrelpath} $1
|
||||||
|
|
||||||
case "`uname 2>/dev/null`" in
|
|
||||||
CYGWIN*)
|
|
||||||
# Cygwin: Check if regular or emulated mount.
|
|
||||||
if [ -z "$dir" ] || [ "`stat -c %D "$dir/.."`" != 620000 ] ; then
|
|
||||||
# Reached some mount point not below /cygdrive.
|
|
||||||
# GRUB does not know Cygwin's emulated mounts,
|
|
||||||
# convert to Win32 path and remove drive letter.
|
|
||||||
path=`cygpath -m "$path" | sed -n 's,^[A-Za-z]:,,p'`
|
|
||||||
test ! -z "$path" || return 1
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$path"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is_path_readable_by_grub ()
|
is_path_readable_by_grub ()
|
||||||
|
@ -190,5 +182,5 @@ version_find_latest ()
|
||||||
}
|
}
|
||||||
|
|
||||||
gettext_quoted () {
|
gettext_quoted () {
|
||||||
gettext "$@" | sed "s/'/'\\\\''/g"
|
$gettext "$@" | sed "s/'/'\\\\''/g"
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
|
#include <grub/emu/misc.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
argument = argv[optind];
|
argument = argv[optind];
|
||||||
|
|
||||||
relpath = make_system_path_relative_to_its_root (argument);
|
relpath = grub_make_system_path_relative_to_its_root (argument);
|
||||||
printf ("%s\n", relpath);
|
printf ("%s\n", relpath);
|
||||||
free (relpath);
|
free (relpath);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ target_cpu=@target_cpu@
|
||||||
native_platform=@platform@
|
native_platform=@platform@
|
||||||
pkglib_DATA="@pkglib_DATA@"
|
pkglib_DATA="@pkglib_DATA@"
|
||||||
|
|
||||||
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
|
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-multiboot
|
||||||
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
|
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
|
||||||
|
|
||||||
# Usage: usage
|
# Usage: usage
|
||||||
|
@ -122,45 +122,45 @@ process_input_dir ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${override_dir}" = "" ] ; then
|
if [ "${override_dir}" = "" ] ; then
|
||||||
if test -e "${coreboot_dir}" ; then
|
if test -e "${multiboot_dir}" ; then
|
||||||
process_input_dir ${coreboot_dir} coreboot
|
process_input_dir ${multiboot_dir} multiboot
|
||||||
fi
|
fi
|
||||||
if test -e "${pc_dir}" ; then
|
if test -e "${pc_dir}" ; then
|
||||||
process_input_dir ${pc_dir} pc
|
process_input_dir ${pc_dir} pc
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
process_input_dir ${override_dir} ${native_platform}
|
process_input_dir ${override_dir} ${native_platform}
|
||||||
coreboot_dir=
|
multiboot_dir=
|
||||||
pc_dir=
|
pc_dir=
|
||||||
case "${native_platform}" in
|
case "${native_platform}" in
|
||||||
coreboot) coreboot_dir=${override_dir} ;;
|
multiboot) multiboot_dir=${override_dir} ;;
|
||||||
pc) pc_dir=${override_dir} ;;
|
pc) pc_dir=${override_dir} ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build coreboot core.img
|
# build multiboot core.img
|
||||||
if test -e "${coreboot_dir}" ; then
|
if test -e "${multiboot_dir}" ; then
|
||||||
echo "Enabling coreboot support ..."
|
echo "Enabling multiboot support ..."
|
||||||
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
|
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
|
||||||
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
||||||
mkdir -p ${memdisk_dir}/boot/grub
|
mkdir -p ${memdisk_dir}/boot/grub
|
||||||
# obtain date-based UUID
|
# obtain date-based UUID
|
||||||
iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
|
iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
|
||||||
|
|
||||||
modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
|
modules="$(cat ${multiboot_dir}/partmap.lst) ${modules}"
|
||||||
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
||||||
search --fs-uuid --set ${iso_uuid}
|
search --fs-uuid --set ${iso_uuid}
|
||||||
set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
|
set prefix=(\${root})/boot/grub/${target_cpu}-multiboot
|
||||||
EOF
|
EOF
|
||||||
(for i in ${modules} ; do
|
(for i in ${modules} ; do
|
||||||
echo "insmod $i"
|
echo "insmod $i"
|
||||||
done ; \
|
done ; \
|
||||||
echo "source /boot/grub/grub.cfg") \
|
echo "source /boot/grub/grub.cfg") \
|
||||||
> ${iso9660_dir}/boot/grub/i386-coreboot/grub.cfg
|
> ${iso9660_dir}/boot/grub/i386-multiboot/grub.cfg
|
||||||
|
|
||||||
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
||||||
rm -rf ${memdisk_dir}
|
rm -rf ${memdisk_dir}
|
||||||
grub-mkelfimage -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
|
grub-mkelfimage -d ${multiboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
|
||||||
memdisk tar search iso9660 configfile sh \
|
memdisk tar search iso9660 configfile sh \
|
||||||
ata at_keyboard
|
ata at_keyboard
|
||||||
rm -f ${memdisk_img}
|
rm -f ${memdisk_img}
|
||||||
|
|
|
@ -262,7 +262,7 @@ probe (const char *path, char *device_name)
|
||||||
grub_util_info ("reading %s via OS facilities", path);
|
grub_util_info ("reading %s via OS facilities", path);
|
||||||
filebuf_via_sys = grub_util_read_image (path);
|
filebuf_via_sys = grub_util_read_image (path);
|
||||||
|
|
||||||
rel_path = make_system_path_relative_to_its_root (path);
|
rel_path = grub_make_system_path_relative_to_its_root (path);
|
||||||
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
|
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
|
||||||
free (rel_path);
|
free (rel_path);
|
||||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||||
|
|
86
util/grub.d/10_netbsd.in
Normal file
86
util/grub.d/10_netbsd.in
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
# grub-mkconfig helper script.
|
||||||
|
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# GRUB is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# GRUB is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
bindir=@bindir@
|
||||||
|
libdir=@libdir@
|
||||||
|
. ${libdir}/grub/grub-mkconfig_lib
|
||||||
|
|
||||||
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
|
export TEXTDOMAINDIR=@localedir@
|
||||||
|
|
||||||
|
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||||
|
OS=NetBSD
|
||||||
|
else
|
||||||
|
OS="${GRUB_DISTRIBUTOR} NetBSD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
netbsd_entry ()
|
||||||
|
{
|
||||||
|
loader="$1" # "knetbsd" or "multiboot"
|
||||||
|
kernel="$2" # absolute path to the kernel file
|
||||||
|
recovery="$3" # is this is a recovery entry?
|
||||||
|
args="$4" # extra arguments appended to loader command
|
||||||
|
|
||||||
|
kroot_device="$(echo ${GRUB_DEVICE} | sed -e 's,^/dev/r,,')"
|
||||||
|
if ${recovery} ; then
|
||||||
|
title="$(gettext_quoted "%s, with kernel %s (via %s, recovery mode)")"
|
||||||
|
else
|
||||||
|
title="$(gettext_quoted "%s, with kernel %s (via %s)")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "menuentry \"${title}\" {\n" \
|
||||||
|
"${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}"
|
||||||
|
printf "%s\n" "${prepare_boot_cache}"
|
||||||
|
case "${loader}" in
|
||||||
|
knetbsd)
|
||||||
|
printf "\tknetbsd %s -r %s %s\n" \
|
||||||
|
"${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}"
|
||||||
|
;;
|
||||||
|
multiboot)
|
||||||
|
printf "\tmultiboot %s %s root=%s %s\n" \
|
||||||
|
"${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
printf "}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e 's,^, ,')"
|
||||||
|
|
||||||
|
# We look for NetBSD kernels in / but not in subdirectories. We simply
|
||||||
|
# pick all statically linked ELF executable files (or links) in / with a
|
||||||
|
# name that starts with `netbsd'.
|
||||||
|
pattern="^ELF[^,]*executable.*statically linked"
|
||||||
|
for k in $(ls -t /netbsd*) ; do
|
||||||
|
if ! grub_file_is_not_garbage "$k" ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! ((file -bL "$k" | grep -q "${pattern}") ||
|
||||||
|
(zcat "$k" | file -bL - | grep -q "${pattern}")) 2>/dev/null ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found NetBSD kernel: $k" >&2
|
||||||
|
netbsd_entry "knetbsd" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||||
|
netbsd_entry "multiboot" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||||
|
if [ "x${GRUB_DISABLE_NETBSD_RECOVERY}" != "xtrue" ]; then
|
||||||
|
netbsd_entry "knetbsd" "$k" true "-s"
|
||||||
|
netbsd_entry "multiboot" "$k" true "-s"
|
||||||
|
fi
|
||||||
|
done
|
113
util/misc.c
113
util/misc.c
|
@ -53,6 +53,11 @@
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
# include <sys/cygwin.h>
|
||||||
|
# define DEV_CYGDRIVE_MAJOR 98
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
@ -299,102 +304,26 @@ canonicalize_file_name (const char *path)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function never prints trailing slashes (so that its output
|
#ifdef __CYGWIN__
|
||||||
can be appended a slash unconditionally). */
|
/* Convert POSIX path to Win32 path,
|
||||||
char *
|
remove drive letter, replace backslashes. */
|
||||||
make_system_path_relative_to_its_root (const char *path)
|
static char *
|
||||||
|
get_win32_path (const char *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
char winpath[PATH_MAX];
|
||||||
char *p, *buf, *buf2, *buf3;
|
if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath)))
|
||||||
uintptr_t offset = 0;
|
grub_util_error ("cygwin_conv_path() failed");
|
||||||
dev_t num;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
/* canonicalize. */
|
int len = strlen (winpath);
|
||||||
p = canonicalize_file_name (path);
|
int offs = (len > 2 && winpath[1] == ':' ? 2 : 0);
|
||||||
|
|
||||||
if (p == NULL)
|
int i;
|
||||||
grub_util_error ("failed to get canonical path of %s", path);
|
for (i = offs; i < len; i++)
|
||||||
|
if (winpath[i] == '\\')
|
||||||
len = strlen (p) + 1;
|
winpath[i] = '/';
|
||||||
buf = xstrdup (p);
|
return xstrdup (winpath + offs);
|
||||||
free (p);
|
|
||||||
|
|
||||||
if (stat (buf, &st) < 0)
|
|
||||||
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
|
||||||
|
|
||||||
buf2 = xstrdup (buf);
|
|
||||||
num = st.st_dev;
|
|
||||||
|
|
||||||
/* This loop sets offset to the number of chars of the root
|
|
||||||
directory we're inspecting. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
p = strrchr (buf, '/');
|
|
||||||
if (p == NULL)
|
|
||||||
/* This should never happen. */
|
|
||||||
grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)");
|
|
||||||
if (p != buf)
|
|
||||||
*p = 0;
|
|
||||||
else
|
|
||||||
*++p = 0;
|
|
||||||
|
|
||||||
if (stat (buf, &st) < 0)
|
|
||||||
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
|
||||||
|
|
||||||
/* buf is another filesystem; we found it. */
|
|
||||||
if (st.st_dev != num)
|
|
||||||
{
|
|
||||||
/* offset == 0 means path given is the mount point.
|
|
||||||
This works around special-casing of "/" in Un*x. This function never
|
|
||||||
prints trailing slashes (so that its output can be appended a slash
|
|
||||||
unconditionally). Each slash in is considered a preceding slash, and
|
|
||||||
therefore the root directory is an empty string. */
|
|
||||||
if (offset == 0)
|
|
||||||
{
|
|
||||||
free (buf);
|
|
||||||
free (buf2);
|
|
||||||
return xstrdup ("");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = p - buf;
|
|
||||||
/* offset == 1 means root directory. */
|
|
||||||
if (offset == 1)
|
|
||||||
{
|
|
||||||
free (buf);
|
|
||||||
len = strlen (buf2);
|
|
||||||
while (buf2[len - 1] == '/' && len > 1)
|
|
||||||
{
|
|
||||||
buf2[len - 1] = '\0';
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
if (len > 1)
|
|
||||||
return buf2;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This means path given is just a backslash. As above
|
|
||||||
we have to return an empty string. */
|
|
||||||
free (buf2);
|
|
||||||
return xstrdup ("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free (buf);
|
|
||||||
buf3 = xstrdup (buf2 + offset);
|
|
||||||
free (buf2);
|
|
||||||
|
|
||||||
len = strlen (buf3);
|
|
||||||
while (buf3[len - 1] == '/' && len > 1)
|
|
||||||
{
|
|
||||||
buf3[len - 1] = '\0';
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf3;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
void
|
void
|
||||||
|
|
|
@ -627,7 +627,8 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
find_dest_dev (&ginfo, argv);
|
find_dest_dev (&ginfo, argv);
|
||||||
|
|
||||||
ginfo.prefix = grub_get_prefix (ginfo.dir ? : DEFAULT_DIRECTORY);
|
ginfo.prefix = make_system_path_relative_to_its_root (ginfo.dir ?
|
||||||
|
: DEFAULT_DIRECTORY);
|
||||||
|
|
||||||
check_root_dev (&ginfo);
|
check_root_dev (&ginfo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue