add two new commands, reboot and halt.

This commit is contained in:
okuji 2000-06-15 10:21:01 +00:00
parent cbda4d4b31
commit 9b91c55408
13 changed files with 154 additions and 11 deletions

View file

@ -1,3 +1,21 @@
2000-06-15 OKUJI Yoshinori <okuji@gnu.org>
* configure.in (AM_INIT_AUTOMAKE): Increase the version number.
I wish that 0.5.96 will not be released actually...
* stage2/builtins.c (halt_func): New function.
(builtin_halt): New variable.
(reboot_func): New function.
(builtin_reboot): New variable.
(builtin_table): Added pointers to BUILTIN_HALT and
BUILTIN_REBOOT.
* stage2/asm.S (grub_halt): New function.
(grub_reboot): Likewise.
* stage2/shared.h (grub_halt): Declared.
(grub_reboot): Likewise.
* grub/asmstub.c (grub_reboot): New function.
(grub_halt): Likewise.
2000-06-12 Gordon Matzigkeit <gord@fig.org> 2000-06-12 Gordon Matzigkeit <gord@fig.org>
* stage2/stage2.c (run_menu): Don't display the menu if the * stage2/stage2.c (run_menu): Don't display the menu if the

3
NEWS
View file

@ -1,5 +1,8 @@
NEWS - list of user-visible changes between releases of GRUB NEWS - list of user-visible changes between releases of GRUB
New in 0.5.96 - XXXX-XX-XX:
* New commands, "reboot" and "halt".
New in 0.5.95 - XXXX-XX-XX: New in 0.5.95 - XXXX-XX-XX:
* NetBSD ELF kernel support is added. You have to specify the new option * NetBSD ELF kernel support is added. You have to specify the new option
to the command "kernel". See below. to the command "kernel". See below.

2
configure vendored
View file

@ -876,7 +876,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE=grub PACKAGE=grub
VERSION=0.5.95 VERSION=0.5.96
cat >> confdefs.h <<EOF cat >> confdefs.h <<EOF
#define PACKAGE "$PACKAGE" #define PACKAGE "$PACKAGE"
EOF EOF

View file

@ -14,7 +14,7 @@ dnl USE OF THIS SOFTWARE.
AC_INIT(stage2/stage2.c) AC_INIT(stage2/stage2.c)
dnl Grab the package and version from the top debian/changelog entry. dnl Grab the package and version from the top debian/changelog entry.
AM_INIT_AUTOMAKE(grub, 0.5.95) AM_INIT_AUTOMAKE(grub, 0.5.96)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.13) AC_PREREQ(2.13)

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH GRUB-INSTALL "8" "June 2000" "grub-install (GNU GRUB 0.5.95)" FSF .TH GRUB-INSTALL "8" "June 2000" "grub-install (GNU GRUB 0.5.96)" FSF
.SH NAME .SH NAME
grub-install \- install GRUB on your drive grub-install \- install GRUB on your drive
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH GRUB "8" "June 2000" "GNU GRUB 0.5.95" FSF .TH GRUB "8" "June 2000" "GNU GRUB 0.5.96" FSF
.SH NAME .SH NAME
GRUB \- the grub shell GRUB \- the grub shell
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020.
.TH MBCHK "1" "June 2000" "mbchk (GNU GRUB 0.5.95)" FSF .TH MBCHK "1" "June 2000" "mbchk (GNU GRUB 0.5.96)" FSF
.SH NAME .SH NAME
mbchk \- check the format of a Multiboot kernel mbchk \- check the format of a Multiboot kernel
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -1,3 +1,3 @@
@set UPDATED 2 April 2000 @set UPDATED 11 June 2000
@set EDITION 0.5.95 @set EDITION 0.5.96
@set VERSION 0.5.95 @set VERSION 0.5.96

View file

@ -1,3 +1,3 @@
@set UPDATED 2 April 2000 @set UPDATED 11 June 2000
@set EDITION 0.5.95 @set EDITION 0.5.96
@set VERSION 0.5.95 @set VERSION 0.5.96

View file

@ -600,6 +600,17 @@ stop (void)
longjmp (env_for_exit, 1); longjmp (env_for_exit, 1);
} }
void
grub_reboot (void)
{
stop ();
}
void
grub_halt (int no_apm)
{
stop ();
}
/* calls for direct boot-loader chaining */ /* calls for direct boot-loader chaining */
void void

View file

@ -190,7 +190,65 @@ ENTRY(stop_floppy)
outb %al, %dx outb %al, %dx
ret ret
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
ENTRY(grub_reboot)
call EXT_C(prot_to_real)
.code16
/* cold boot */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xFFFF, $0x0000
.code32
/*
* grub_halt(int no_apm)
*
* Halt the system, using APM if possible. If NO_APM is true, don't use
* APM even if it is available.
*/
ENTRY(grub_halt)
/* get the argument */
movl 4(%esp), %eax
/* see if zero */
testl %eax, %eax
jnz EXT_C(stop)
call EXT_C(prot_to_real)
.code16
/* detect APM */
movw $0x5300, %ax
xorw %bx, %bx
int $0x15
jc EXT_C(hard_stop)
/* don't check %bx for buggy BIOSes... */
/* disconnect APM first */
movw $0x5304, %ax
xorw %bx, %bx
int $0x15
/* connect APM (Is this really necessary?) */
movw $0x5301, %ax
xorw %bx, %bx
int $0x15
jc EXT_C(hard_stop)
/* set the power state to off */
movw $0x5307, %ax
movw $1, %bx
movw $3, %cx
int $0x15
/* shouldn't reach here */
jc EXT_C(hard_stop)
.code32
/* /*
* track_int13(int drive) * track_int13(int drive)
* *

View file

@ -1193,6 +1193,30 @@ static struct builtin builtin_geometry =
" on the C/H/S values automatically." " on the C/H/S values automatically."
}; };
/* halt */
static int
halt_func (char *arg, int flags)
{
int no_apm;
no_apm = (grub_memcmp (arg, "--no-apm", 8) == 0);
grub_halt (no_apm);
/* Never reach here. */
return 1;
}
static struct builtin builtin_halt =
{
"halt",
halt_func,
BUILTIN_CMDLINE,
"halt [--no-apm]",
"Halt your system. If APM is avaiable on it, turn off the power using"
" the APM BIOS, unless you specify the option `--no-apm'."
};
/* help */ /* help */
#define MAX_SHORT_DOC_LEN 39 #define MAX_SHORT_DOC_LEN 39
@ -2272,6 +2296,26 @@ static struct builtin builtin_read =
" display it in hex format." " display it in hex format."
}; };
/* reboot */
static int
reboot_func (char *arg, int flags)
{
grub_reboot ();
/* Never reach here. */
return 1;
}
static struct builtin builtin_reboot =
{
"reboot",
reboot_func,
BUILTIN_CMDLINE,
"reboot",
"Reboot your system."
};
/* Print the root device information. */ /* Print the root device information. */
static void static void
@ -3084,6 +3128,7 @@ struct builtin *builtin_table[] =
&builtin_find, &builtin_find,
&builtin_fstest, &builtin_fstest,
&builtin_geometry, &builtin_geometry,
&builtin_halt,
&builtin_help, &builtin_help,
&builtin_hide, &builtin_hide,
&builtin_impsprobe, &builtin_impsprobe,
@ -3101,6 +3146,7 @@ struct builtin *builtin_table[] =
&builtin_quit, &builtin_quit,
&builtin_rarp, &builtin_rarp,
&builtin_read, &builtin_read,
&builtin_reboot,
&builtin_root, &builtin_root,
&builtin_rootnoverify, &builtin_rootnoverify,
&builtin_setkey, &builtin_setkey,

View file

@ -547,6 +547,13 @@ void cmain (void);
/* Halt the processor (called after an unrecoverable error). */ /* Halt the processor (called after an unrecoverable error). */
void stop (void) __attribute__ ((noreturn)); void stop (void) __attribute__ ((noreturn));
/* Reboot the system. */
void grub_reboot (void) __attribute__ ((noreturn));
/* Halt the system, using APM if possible. If NO_APM is true, don't use
APM even if it is available. */
void grub_halt (int no_apm) __attribute__ ((noreturn));
/* Copy MAP to the drive map and set up int13_handler. */ /* Copy MAP to the drive map and set up int13_handler. */
void set_int13_handler (unsigned short *map); void set_int13_handler (unsigned short *map);