Merge mainline into mbivid
This commit is contained in:
commit
54100be961
21 changed files with 429 additions and 11 deletions
102
ChangeLog
102
ChangeLog
|
@ -1,3 +1,105 @@
|
|||
2010-01-14 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* include/grub/i386/loader.h (grub_linux16_boot): Renamed to ...
|
||||
(grub_linux16_real_boot): ... this.
|
||||
* kern/i386/loader.S: Likewise.
|
||||
* loader/i386/pc/linux.c: Include `<grub/video.h>' and `<grub/mm.h>'.
|
||||
(grub_linux16_boot): New function. Switches to text mode and calls
|
||||
grub_linux16_real_boot().
|
||||
|
||||
* loader/i386/bsd.c: Include `<grub/video.h>'.
|
||||
(grub_freebsd_boot, grub_openbsd_boot, grub_netbsd_boot): Switch to
|
||||
text mode before calling grub_unix_real_boot().
|
||||
|
||||
* loader/i386/multiboot.c: Include `<grub/video.h>'.
|
||||
(grub_multiboot_boot): Switch to text mode before calling
|
||||
grub_relocator32_boot().
|
||||
|
||||
* loader/i386/pc/chainloader.c: Include `<grub/video.h>'.
|
||||
(grub_chainloader_boot): Switch to text mode before calling
|
||||
grub_chainloader_real_boot().
|
||||
|
||||
2010-01-05 Jordan Uggla <jordan.uggla@gmail.com>
|
||||
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-reboot.in: Make sure prev_saved_entry always gets a
|
||||
non-empty value.
|
||||
|
||||
2010-01-05 Jordan Uggla <jordan.uggla@gmail.com>
|
||||
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Define a "savedefault" function for use
|
||||
in menu entries.
|
||||
* util/grub-mkconfig_lib.in (save_default_entry): Use it.
|
||||
|
||||
2010-01-05 Jordan Uggla <jordan.uggla@gmail.com>
|
||||
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig_lib.in (save_default_entry): Only set
|
||||
saved_entry if boot_once is unset.
|
||||
* util/grub.d/00_header.in: Set boot_once to "true" if there was a
|
||||
previous saved entry (i.e. grub-reboot).
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/30_os-prober.in: Call save_default_entry for hurd.
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Use `set var=val' rather than plain
|
||||
`var=val'.
|
||||
* util/grub-mkconfig_lib.in (save_default_entry): Likewise.
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-reboot.in: Fix --version output.
|
||||
* util/grub-set-default.in: Likewise.
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Silently ignore zero-sized environment
|
||||
blocks.
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Quote the value assigned to `default',
|
||||
in case it contains spaces.
|
||||
|
||||
2009-12-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/30_os-prober.in: Fix merge error that moved a
|
||||
`save_default_entry' call from the macosx case to the linux case.
|
||||
|
||||
2009-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
2009-10-25 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* normal/menu.c (grub_menu_execute_entry): Save selected entry title
|
||||
in `chosen' environment variable.
|
||||
* normal/menu_text.c (get_entry_number): Check if the variable
|
||||
matches the title of a menu entry.
|
||||
(run_menu): Pass menu to get_entry_number.
|
||||
|
||||
* util/grub-reboot.in: New file.
|
||||
* util/grub-set-default.in: New file.
|
||||
* conf/common.rmk (grub-reboot): New utility.
|
||||
(grub-set-default): New utility.
|
||||
|
||||
* util/grub-mkconfig_lib.in (save_default_entry): New function.
|
||||
* util/grub.d/00_header.in: If GRUB_DEFAULT is `saved', set
|
||||
default to `${saved_entry}'. If `${prev_saved_entry}' is non-empty,
|
||||
move it to `saved_entry' for the next boot. Load environment on
|
||||
initialisation.
|
||||
* util/grub.d/10_kfreebsd.in: Call save_default_entry.
|
||||
* util/grub.d/10_hurd.in: Likewise.
|
||||
* util/grub.d/10_linux.in (linux_entry): Likewise.
|
||||
* util/grub.d/10_windows.in: Likewise.
|
||||
* util/grub.d/30_os-prober.in: Likewise.
|
||||
|
||||
* util/grub-install.in: Create environment block.
|
||||
* util/i386/efi/grub-install.in: Likewise.
|
||||
* util/ieee1275/grub-install.in: Likewise.
|
||||
* util/sparc64/ieee1275/grub-install.in: Likewise.
|
||||
|
||||
2010-01-14 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Unit testing framework for GRUB.
|
||||
|
|
|
@ -185,6 +185,20 @@ CLEANFILES += $(grub-mkconfig_SCRIPTS)
|
|||
|
||||
grub-mkconfig_DATA += util/grub.d/README
|
||||
|
||||
# For grub-set-default.
|
||||
grub-set-default: util/grub-set-default.in config.status
|
||||
./config.status --file=$@:$<
|
||||
chmod +x $@
|
||||
sbin_SCRIPTS += grub-set-default
|
||||
CLEANFILES += grub-set-default
|
||||
|
||||
# For grub-reboot.
|
||||
grub-reboot: util/grub-reboot.in config.status
|
||||
./config.status --file=$@:$<
|
||||
chmod +x $@
|
||||
sbin_SCRIPTS += grub-reboot
|
||||
CLEANFILES += grub-reboot
|
||||
|
||||
# Filing systems.
|
||||
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
||||
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,7 +31,7 @@ extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
|
|||
extern char *EXPORT_VAR(grub_linux_tmp_addr);
|
||||
extern char *EXPORT_VAR(grub_linux_real_addr);
|
||||
extern grub_int32_t EXPORT_VAR(grub_linux_is_bzimage);
|
||||
grub_err_t EXPORT_FUNC(grub_linux16_boot) (void);
|
||||
grub_err_t EXPORT_FUNC(grub_linux16_real_boot) (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_LOADER_CPU_HEADER */
|
||||
|
|
|
@ -59,7 +59,7 @@ VARIABLE(grub_linux_real_addr)
|
|||
VARIABLE(grub_linux_is_bzimage)
|
||||
.long 0
|
||||
|
||||
FUNCTION(grub_linux16_boot)
|
||||
FUNCTION(grub_linux16_real_boot)
|
||||
/* Must be done before zImage copy. */
|
||||
call EXT_C(grub_dl_unload_all)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,7 +35,7 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <grub/video.h>
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#endif
|
||||
|
@ -509,6 +509,8 @@ grub_freebsd_boot (void)
|
|||
|
||||
bi.bi_kernend = kern_end;
|
||||
|
||||
grub_video_set_mode ("text", NULL);
|
||||
|
||||
if (is_64bit)
|
||||
{
|
||||
grub_uint32_t *gdt;
|
||||
|
@ -617,6 +619,8 @@ grub_openbsd_boot (void)
|
|||
pa->ba_type = OPENBSD_BOOTARG_END;
|
||||
pa++;
|
||||
|
||||
grub_video_set_mode ("text", NULL);
|
||||
|
||||
grub_unix_real_boot (entry, bootflags, openbsd_root, OPENBSD_BOOTARG_APIVER,
|
||||
0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
|
||||
(grub_uint32_t) (grub_mmap_get_lower () >> 10),
|
||||
|
@ -713,6 +717,8 @@ grub_netbsd_boot (void)
|
|||
bootinfo->bi_data[0] = mmap;
|
||||
}
|
||||
|
||||
grub_video_set_mode ("text", NULL);
|
||||
|
||||
grub_unix_real_boot (entry, bootflags, 0, bootinfo,
|
||||
0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
|
||||
(grub_uint32_t) (grub_mmap_get_lower () >> 10));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* multiboot.c - boot a multiboot OS image. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -43,6 +43,7 @@
|
|||
#include <grub/gzio.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i386/relocator.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
extern grub_dl_t my_mod;
|
||||
static grub_size_t code_size, alloc_mbi;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* chainloader.c - boot another boot loader */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2007,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2004,2007,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
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
static int boot_drive;
|
||||
|
@ -41,6 +42,7 @@ static void *boot_part_addr;
|
|||
static grub_err_t
|
||||
grub_chainloader_boot (void)
|
||||
{
|
||||
grub_video_set_mode ("text", NULL);
|
||||
grub_chainloader_real_boot (boot_drive, boot_part_addr);
|
||||
|
||||
/* Never reach here. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* linux.c - boot Linux zImage or bzImage */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +31,8 @@
|
|||
#include <grub/cpu/linux.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x9000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
|
||||
|
@ -48,6 +50,16 @@ grub_linux_unload (void)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_linux16_boot (void)
|
||||
{
|
||||
grub_video_set_mode ("text", NULL);
|
||||
grub_linux16_real_boot ();
|
||||
|
||||
/* Not reached. */
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
|
|
|
@ -157,6 +157,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry)
|
|||
return;
|
||||
}
|
||||
|
||||
grub_env_set ("chosen", entry->title);
|
||||
|
||||
grub_parser_execute ((char *) entry->sourcecode);
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
||||
|
@ -273,7 +275,7 @@ grub_menu_register_viewer (struct grub_menu_viewer *viewer)
|
|||
|
||||
/* Get the entry number from the variable NAME. */
|
||||
static int
|
||||
get_entry_number (const char *name)
|
||||
get_entry_number (grub_menu_t menu, const char *name)
|
||||
{
|
||||
char *val;
|
||||
int entry;
|
||||
|
@ -286,6 +288,28 @@ get_entry_number (const char *name)
|
|||
|
||||
entry = (int) grub_strtoul (val, 0, 0);
|
||||
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
/* See if the variable matches the title of a menu entry. */
|
||||
grub_menu_entry_t e = menu->entry_list;
|
||||
int i;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
for (i = 0; e; i++)
|
||||
{
|
||||
if (grub_strcmp (e->title, val) == 0)
|
||||
{
|
||||
entry = i;
|
||||
break;
|
||||
}
|
||||
e = e->next;
|
||||
}
|
||||
|
||||
if (! e)
|
||||
entry = -1;
|
||||
}
|
||||
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
@ -312,7 +336,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||
int default_entry, current_entry;
|
||||
int timeout;
|
||||
|
||||
default_entry = get_entry_number ("default");
|
||||
default_entry = get_entry_number (menu, "default");
|
||||
|
||||
/* If DEFAULT_ENTRY is not within the menu entries, fall back to
|
||||
the first entry. */
|
||||
|
|
|
@ -40,6 +40,7 @@ else
|
|||
fi
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
|
@ -263,6 +264,10 @@ done
|
|||
# Write device to a variable so we don't have to traverse /dev every time.
|
||||
grub_device=`$grub_probe --target=device ${grubdir}`
|
||||
|
||||
if ! test -f ${grubdir}/grubenv; then
|
||||
$grub_editenv ${grubdir}/grubenv create
|
||||
fi
|
||||
|
||||
# Create the core image. First, auto-detect the filesystem module.
|
||||
fs_module=`$grub_probe --target=fs --device ${grub_device}`
|
||||
if test "x$fs_module" = x -a "x$modules" = x; then
|
||||
|
|
|
@ -94,6 +94,15 @@ convert_system_path_to_grub_path ()
|
|||
echo ${drive}${relative_path}
|
||||
}
|
||||
|
||||
save_default_entry ()
|
||||
{
|
||||
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then
|
||||
cat << EOF
|
||||
savedefault
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_grub_to_access_device ()
|
||||
{
|
||||
device=$1
|
||||
|
|
108
util/grub-reboot.in
Normal file
108
util/grub-reboot.in
Normal file
|
@ -0,0 +1,108 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Set a default boot entry for GRUB, for the next boot only.
|
||||
# Copyright (C) 2004,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/>.
|
||||
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] entry
|
||||
Set the default boot entry for GRUB, for the next boot only.
|
||||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--root-directory=DIR expect GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
|
||||
ENTRY is a number or a menu item title.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Check the arguments.
|
||||
for option in "$@"; do
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "grub-reboot (GNU GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if test "x$entry" != x; then
|
||||
echo "More than one entry?" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
entry="${option}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x$entry" = x; then
|
||||
echo "entry not specified." 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
grub_prefix=`echo /grub | sed ${transform}`
|
||||
bootdir=${rootdir}
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
bootdir=${rootdir}/boot
|
||||
;;
|
||||
esac
|
||||
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
|
||||
prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^saved_entry=//p'`
|
||||
if [ "$prev_saved_entry" ]; then
|
||||
$grub_editenv ${grubdir}/grubenv set prev_saved_entry="$prev_saved_entry"
|
||||
else
|
||||
# We need some non-empty value for prev_saved_entry so that GRUB will
|
||||
# recognise that grub-reboot has been used and restore the previous
|
||||
# saved entry. "0" is the same as an empty value, i.e. the first menu
|
||||
# entry.
|
||||
$grub_editenv ${grubdir}/grubenv set prev_saved_entry=0
|
||||
fi
|
||||
$grub_editenv ${grubdir}/grubenv set saved_entry="$entry"
|
||||
|
||||
# Bye.
|
||||
exit 0
|
99
util/grub-set-default.in
Normal file
99
util/grub-set-default.in
Normal file
|
@ -0,0 +1,99 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Set a default boot entry for GRUB.
|
||||
# Copyright (C) 2004,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/>.
|
||||
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] entry
|
||||
Set the default boot entry for GRUB.
|
||||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--root-directory=DIR expect GRUB images under the directory DIR
|
||||
instead of the root directory
|
||||
|
||||
ENTRY is a number or a menu item title.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Check the arguments.
|
||||
for option in "$@"; do
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "grub-set-default (GNU GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--root-directory=*)
|
||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if test "x$entry" != x; then
|
||||
echo "More than one entry?" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
entry="${option}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x$entry" = x; then
|
||||
echo "entry not specified." 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize these directories here, since ROOTDIR was initialized.
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
|
||||
# instead of /boot/grub.
|
||||
grub_prefix=`echo /grub | sed ${transform}`
|
||||
bootdir=${rootdir}
|
||||
;;
|
||||
*)
|
||||
# Use /boot/grub by default.
|
||||
bootdir=${rootdir}/boot
|
||||
;;
|
||||
esac
|
||||
|
||||
grubdir=${bootdir}/`echo grub | sed ${transform}`
|
||||
|
||||
$grub_editenv ${grubdir}/grubenv unset prev_saved_entry
|
||||
$grub_editenv ${grubdir}/grubenv set saved_entry="$entry"
|
||||
|
||||
# Bye.
|
||||
exit 0
|
|
@ -34,11 +34,29 @@ for i in ${GRUB_PRELOAD_MODULES} ; do
|
|||
done
|
||||
|
||||
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
|
||||
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
|
||||
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
|
||||
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
|
||||
|
||||
cat << EOF
|
||||
set default=${GRUB_DEFAULT}
|
||||
if [ -s \$prefix/grubenv ]; then
|
||||
load_env
|
||||
fi
|
||||
set default="${GRUB_DEFAULT}"
|
||||
if [ \${prev_saved_entry} ]; then
|
||||
set saved_entry=\${prev_saved_entry}
|
||||
save_env saved_entry
|
||||
set prev_saved_entry=
|
||||
save_env prev_saved_entry
|
||||
set boot_once=true
|
||||
fi
|
||||
|
||||
function savedefault {
|
||||
if [ -z \${boot_once} ]; then
|
||||
saved_entry=\${chosen}
|
||||
save_env saved_entry
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
|
||||
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
|
||||
|
|
|
@ -76,6 +76,7 @@ cat << EOF
|
|||
echo $(gettext "Loading GNU Mach ...")
|
||||
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
echo $(gettext "Loading the Hurd ...")
|
||||
|
|
|
@ -39,6 +39,7 @@ kfreebsd_entry ()
|
|||
args="$4" # not used yet
|
||||
title="$(gettext "%s, with kFreeBSD %s")"
|
||||
printf "menuentry \"${title}\" {\n" "${os}" "${version}"
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
|
|
|
@ -59,6 +59,7 @@ linux_entry ()
|
|||
title="$(gettext "%s, with Linux %s")"
|
||||
fi
|
||||
printf "menuentry \"${title}\" {\n" "${os}" "${version}"
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
|
|
|
@ -73,6 +73,7 @@ for dir in $dirlist ; do
|
|||
menuentry "$OS" {
|
||||
EOF
|
||||
|
||||
save_default_entry | sed -e 's,^,\t,'
|
||||
prepare_grub_to_access_device "$dev" | sed 's,^,\t,'
|
||||
|
||||
cat << EOF
|
||||
|
|
|
@ -41,6 +41,7 @@ osx_entry() {
|
|||
cat << EOF
|
||||
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
|
@ -105,6 +106,7 @@ for OS in ${OSPROBED} ; do
|
|||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
||||
case ${LONGNAME} in
|
||||
|
@ -146,6 +148,7 @@ EOF
|
|||
cat << EOF
|
||||
menuentry "${LLABEL} (on ${DEVICE})" {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
if [ -z "${prepare_boot_cache}" ]; then
|
||||
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
|
||||
fi
|
||||
|
@ -172,6 +175,7 @@ EOF
|
|||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
|
||||
mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`"
|
||||
|
|
|
@ -35,6 +35,7 @@ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${t
|
|||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
|
@ -179,6 +180,10 @@ for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
|
|||
cp -f $file ${grubdir} || exit 1
|
||||
done
|
||||
|
||||
if ! test -f ${grubdir}/grubenv; then
|
||||
$grub_editenv ${grubdir}/grubenv create
|
||||
fi
|
||||
|
||||
# Create the core image. First, auto-detect the filesystem module.
|
||||
fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
|
||||
if test "x$fs_module" = xfat; then :; else
|
||||
|
|
|
@ -37,6 +37,7 @@ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${t
|
|||
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
|
@ -163,6 +164,10 @@ for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ; do
|
|||
cp -f $file ${grubdir} || exit 1
|
||||
done
|
||||
|
||||
if ! test -f ${grubdir}/grubenv; then
|
||||
$grub_editenv ${grubdir}/grubenv create
|
||||
fi
|
||||
|
||||
# Create the core image. First, auto-detect the filesystem module.
|
||||
fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
|
||||
if test "x$fs_module" = x -a "x$modules" = x; then
|
||||
|
|
Loading…
Reference in a new issue