Merge from trunk

This commit is contained in:
Robert Millan 2009-12-04 00:04:41 +00:00
commit 69ac6c405a
21 changed files with 99 additions and 129 deletions

View file

@ -1,3 +1,51 @@
2009-12-04 Robert Millan <rmh.grub@aybabtu.com>
* commands/halt.c: Replace misc arch-specific headers with
`<grub/misc.h>'.
* commands/reboot.c: Likewise.
* commands/i386/pc/halt.c: Replace `<grub/machine/init.h>' with
`<grub/misc.h>'.
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Remove `cpu/reboot.h'.
(halt_mod_SOURCES): Move `kern/i386/halt.c' from here ...
(kernel_img_SOURCES): ... to here.
* include/grub/efi/efi.h (grub_reboot, grub_halt): Remove prototypes.
* include/grub/i386/pc/init.h: Likewise.
* include/grub/powerpc/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/misc.h (grub_reboot, grub_halt): New prototypes.
* include/grub/i386/halt.h: Remove.
* include/grub/i386/reboot.h: Likewise.
* kern/i386/halt.c: Remove `<grub/cpu/halt.h>'.
2009-12-03 David S. Miller <davem@sunset.davemloft.net>
* conf/sparc64-ieee1275.rmk (grub_mkimage_SOURCES,
grub_setup_SOURCES, grub_ofpathname_SOURCES): Add gnulib/progname.c
* util/sparc64/ieee1275/grub-mkimage.c: Include <grub/i18n.h> and
"progname.h"
* util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
* util/sparc64/ieee1275/grub-setup.c: Likewise.
(usage): Add missing comma in printf.
2009-12-02 Robert Millan <rmh.grub@aybabtu.com>
Use the same reboot approach on i386 coreboot and qemu as we do on
BIOS.
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add `cpu/reboot.h'.
(reboot_mod_SOURCES): Remove `kern/i386/reboot.c'.
* kern/i386/reboot.c: Remove.
* include/grub/i386/reboot.h (grub_reboot): Export function.
* kern/i386/pc/startup.S (grub_reboot): Move from here ...
* kern/i386/realmode.S (grub_reboot): ... to here. Jump to
0xf000:0xfff0 instead of 0xffff:0x0000.
[!GRUB_MACHINE_PCBIOS] (prot_to_real): Do not restore interrupts.
* kern/i386/qemu/startup.S: Include `"../realmode.S"'.
2009-11-30 Robert Millan <rmh.grub@aybabtu.com> 2009-11-30 Robert Millan <rmh.grub@aybabtu.com>
Fix $srcdir != $objdir build. Fix $srcdir != $objdir build.

View file

@ -19,15 +19,7 @@
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/misc.h>
#if defined(GRUB_MACHINE_IEEE1275)
#include <grub/machine/kernel.h>
#elif defined(GRUB_MACHINE_EFI)
#include <grub/efi/efi.h>
#else
/* Platforms shipping standalone halt, such as coreboot. */
#include <grub/cpu/halt.h>
#endif
static grub_err_t static grub_err_t
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)), grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),

View file

@ -18,7 +18,7 @@
*/ */
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/machine/init.h> #include <grub/misc.h>
#include <grub/extcmd.h> #include <grub/extcmd.h>
static const struct grub_arg_option options[] = static const struct grub_arg_option options[] =

View file

@ -19,18 +19,7 @@
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/misc.h>
#if defined(GRUB_MACHINE_IEEE1275)
#include <grub/machine/kernel.h>
#elif defined(GRUB_MACHINE_EFI)
#include <grub/efi/efi.h>
#elif defined(GRUB_MACHINE_PCBIOS)
#include <grub/machine/init.h>
#else
/* Platforms shipping standalone reboot, such as coreboot. */
#include <grub/cpu/reboot.h>
#endif
static grub_err_t static grub_err_t
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),

View file

@ -18,6 +18,7 @@ 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/multiboot_mmap.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 \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -61,6 +62,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \ kern/i386/misc.S \
kern/i386/coreboot/init.c \ kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \ kern/i386/qemu/mmap.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 \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -124,12 +126,12 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod. # For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS) reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS) reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod. # For halt.mod.
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS) halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS) halt_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -63,7 +63,7 @@ sbin_UTILITIES = grub-setup grub-ofpathname
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
util/resolve.c util/resolve.c gnulib/progname.c
# For grub-setup. # For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
@ -82,12 +82,12 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
partmap/sun.c partmap/acorn.c \ partmap/sun.c partmap/acorn.c \
\ \
disk/raid.c disk/mdraid_linux.c disk/lvm.c \ disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c \ util/raid.c util/lvm.c gnulib/progname.c \
grub_setup_init.c grub_setup_init.c
# For grub-ofpathname. # For grub-ofpathname.
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install

View file

@ -54,8 +54,6 @@ char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
grub_efi_device_path_t * grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle); EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key); int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
int EXPORT_FUNC (grub_efi_finish_boot_services) (void); int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
void grub_efi_mm_init (void); void grub_efi_mm_init (void);

View file

@ -1,19 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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/>.
*/
extern void grub_halt (void);

View file

@ -39,13 +39,6 @@ grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *
/* Turn on/off Gate A20. */ /* Turn on/off Gate A20. */
void grub_gate_a20 (int on); void grub_gate_a20 (int on);
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
void EXPORT_FUNC(grub_stop_floppy) (void); void EXPORT_FUNC(grub_stop_floppy) (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */ #endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -1,19 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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/>.
*/
extern void grub_reboot (void);

View file

@ -222,4 +222,15 @@ grub_div_roundup (unsigned int x, unsigned int y)
return (x + y - 1) / y; return (x + y - 1) / y;
} }
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
#else
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_MISC_HEADER */ #endif /* ! GRUB_MISC_HEADER */

View file

@ -23,9 +23,6 @@
#ifndef ASM_FILE #ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its /* The prefix which points to the directory where GRUB modules and its
configuration file are located. */ configuration file are located. */
extern char grub_prefix[]; extern char grub_prefix[];

View file

@ -54,9 +54,6 @@ extern grub_int32_t grub_total_module_size;
configuration file are located. */ configuration file are located. */
extern char grub_prefix[]; extern char grub_prefix[];
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
#endif /* ! ASM_FILE */ #endif /* ! ASM_FILE */
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ #endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -17,7 +17,6 @@
*/ */
#include <grub/cpu/io.h> #include <grub/cpu/io.h>
#include <grub/cpu/halt.h>
#include <grub/machine/init.h> #include <grub/machine/init.h>
#include <grub/misc.h> #include <grub/misc.h>

View file

@ -484,21 +484,6 @@ FUNCTION(grub_exit)
jmp cold_reboot jmp cold_reboot
.code32 .code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* cold boot */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xFFFF, $0x0000
.code32
/* /*
* grub_halt(int no_apm) * grub_halt(int no_apm)
* *

View file

@ -95,3 +95,5 @@ codestart:
/* This should never happen. */ /* This should never happen. */
jmp EXT_C(grub_stop) jmp EXT_C(grub_stop)
#include "../realmode.S"

View file

@ -215,10 +215,27 @@ realcseg:
movw %ax, %gs movw %ax, %gs
movw %ax, %ss movw %ax, %ss
#ifdef GRUB_MACHINE_PCBIOS
/* restore interrupts */ /* restore interrupts */
sti sti
#endif
/* return on new stack! */ /* return on new stack! */
DATA32 ret DATA32 ret
.code32 .code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* set 0x472 to 0x0000 for cold boot (0x1234 for warm boot) */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xf000, $0xfff0
.code32

View file

@ -1,32 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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/cpu/io.h>
#include <grub/cpu/at_keyboard.h>
#include <grub/cpu/reboot.h>
#include <grub/misc.h>
void
grub_reboot (void)
{
/* Use the keyboard controller to reboot. That's what keyboards were
designed for, isn't it? */
grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
}

View file

@ -21,6 +21,7 @@
#include <grub/machine/boot.h> #include <grub/machine/boot.h>
#include <grub/machine/kernel.h> #include <grub/machine/kernel.h>
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/i18n.h>
#include <grub/disk.h> #include <grub/disk.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/resolve.h> #include <grub/util/resolve.h>
@ -34,6 +35,8 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
static void static void
compress_kernel (char *kernel_img, size_t kernel_size, compress_kernel (char *kernel_img, size_t kernel_size,
char **core_img, size_t *core_size) char **core_img, size_t *core_size)

View file

@ -20,6 +20,10 @@
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/ofpath.h> #include <grub/util/ofpath.h>
#include <grub/i18n.h>
#include "progname.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *of_path; char *of_path;

View file

@ -21,6 +21,7 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/device.h> #include <grub/device.h>
#include <grub/i18n.h>
#include <grub/disk.h> #include <grub/disk.h>
#include <grub/file.h> #include <grub/file.h>
#include <grub/fs.h> #include <grub/fs.h>
@ -49,6 +50,8 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
/* This program fills in various fields inside of the 'boot' and 'core' /* This program fills in various fields inside of the 'boot' and 'core'
* image files. * image files.
* *
@ -419,7 +422,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", program_name ", program_name,
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY, DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT); DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);