f714229e34
* conf/i386-efi.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c and reboot.c by commands/halt.c and reboot.c. (grub_install_SOURCES): Add halt.mod and reboot.mod. (halt_mod_SOURCES): New variable. (halt_mod_CFLAGS): Likewise. (halt_mod_LDFLAGS): Likewise. (reboot_mod_SOURCES): Likewise. (reboot_mod_CFLAGS): Likewise. (reboot_mod_LDFLAGS): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace commands/ieee1275/halt.c and reboot.c by commands/halt.c and reboot.c. (halt_mod_SOURCES): Likewise. (reboot_mod_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Replace commands/i386/pc/reboot.c by commands/reboot.c. (reboot_mod_SOURCES): Likewise. * commands/i386/pc/reboot.c: merge this file ... * commands/ieee1275/reboot.c: ... and this file ... * commands/reboot.c: ... to this file. Add some precompiler directive to include the correct header for each machine. * commands/ieee1275/halt.c: move this file ... * commands/halt.c: ... to here. Add some precompiler directive to include the correct header for each machine. * include/grub/efi/efi.h (grub_reboot): New function declaration. (grub_halt): Likewise. * kern/efi/efi.c (grub_reboot): New function. (grub_halt): Likewise.
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/* halt.c - command to halt the computer. */
|
||
/*
|
||
* GRUB -- GRand Unified Bootloader
|
||
* Copyright (C) 2005,2007,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/normal.h>
|
||
#include <grub/dl.h>
|
||
#include <grub/machine/machine.h>
|
||
|
||
#if defined(GRUB_MACHINE_IEEE1275)
|
||
#include <grub/machine/kernel.h>
|
||
#elif defined(GRUB_MACHINE_EFI)
|
||
#include <grub/efi/efi.h>
|
||
#endif
|
||
|
||
static grub_err_t
|
||
grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
|
||
int argc __attribute__ ((unused)),
|
||
char **args __attribute__ ((unused)))
|
||
{
|
||
grub_halt ();
|
||
return 0;
|
||
}
|
||
|
||
|
||
GRUB_MOD_INIT(halt)
|
||
{
|
||
(void)mod; /* To stop warning. */
|
||
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
||
"halt", "halts the computer. This command does not"
|
||
" work on all firmware.", 0);
|
||
}
|
||
|
||
GRUB_MOD_FINI(halt)
|
||
{
|
||
grub_unregister_command ("halt");
|
||
}
|