merge from mainline

This commit is contained in:
Colin Watson 2010-05-27 16:36:31 +01:00
commit 26c9e9bf61
30 changed files with 454 additions and 103 deletions

146
ChangeLog
View file

@ -1,3 +1,149 @@
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* util/grub-script-check.c (main): Ensure defined behaviour on empty
input files (in which case exit zero).
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* kern/emu/misc.c (canonicalize_file_name): realpath can still
return NULL for various reasons even if it has a maximum-length
buffer: for example, there might be a symlink loop, or the path
might exceed PATH_MAX. If this happens, return NULL.
2010-05-27 Robert Millan <rmh@gnu.org>
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Insert
partmap module to handle cross-partmap setups.
Reported by Orestes Mas. Gràcies!
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.in: Initialise override_dir rather than
assuming that it's unset or empty in the environment.
2010-05-26 Grégoire Sutre <gregoire.sutre@gmail.com>
* kern/emu/hostdisk.c (find_partition_start) [__NetBSD__]: Renamed
variable index into p_index to suppress a warning with -Wshadow.
2010-05-25 BVK Chaitanya <bvk.groups@gmail.com>
* INSTALL: Added flex >= 2.5.35 requirement.
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
* commands/usbtest.c (grub_usb_get_string): Properly support UTF-16.
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
cmostest support.
* commands/i386/cmostest.c: New file.
* conf/i386-coreboot.rmk (pkglib_MODULES): Add cmostest.mod.
(cmostest_mod_SOURCES): New variable.
(cmostest_mod_CFLAGS): Likewise.
(cmostest_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk: Likewise.
* docs/grub.texi (Vendor power-on keys): New section.
* util/grub-mkconfig.in: export GRUB_DEFAULT_BUTTON,
GRUB_HIDDEN_TIMEOUT_BUTTON, GRUB_TIMEOUT_BUTTON
and GRUB_BUTTON_CMOS_ADDRESS.
* util/grub.d/00_header.in: Handle powering-on by separate button.
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
* gfxmenu/gui_list.c (draw_menu): Don't add scrollbar width to padding.
Removed drawing_scrollbar argument. All users updated
Fixes #29792.
Reported by Jo Shields
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
* gfxmenu/view.c (grub_gfxmenu_draw_terminal_box): Apply only to current
buffer since gfxterm handles double repaint.
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
* gfxmenu/gfxmenu.c (grub_gfxmenu_try): Change viewport on both buffers.
* term/gfxterm.c (real_scroll): Likewise.
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/pc/mmap.c (grub_machine_mmap_iterate): Zero-fill entry
before calling BIOS.
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i18n.h: Always enable grub_gettext.
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/pc/init.c (make_install_device): Fix a leftover usage of old
partition naming style.
2010-05-21 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig.in: Fix handling of -o so that it works when
not the first option.
2010-05-20 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrelpath.c (usage): Remove excess apostrophe.
2010-05-20 Colin Watson <cjwatson@ubuntu.com>
* util/misc.c: Move inclusion of <limits.h> to ...
* kern/emu/misc.c: ... here. Needed for canonicalize_file_name.
2010-05-20 Grégoire Sutre <gregoire.sutre@gmail.com>
* kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev) [__NetBSD__]:
Fix merge error in NetBSD code.
(find_partition_start) [__NetBSD__]: Likewise.
2010-05-19 BVK Chaitanya <bvk.groups@gmail.com>
Fix grub-mkrescue usage unit testing.
* tests/util/grub-shell.in: Use --grub-mkimage with grub-mkrescue.
2010-05-18 Christian Franke <franke@computer.org>
* util/grub.d/10_windows.in: Use path names instead of
drive letters to prevent warning from Cygwin 1.7.
Add drivemap command to menuentry if needed.
2010-05-18 Justus Winter <4winter@informatik.uni-hamburg.de>
* util/grub.d/10_hurd.in: Include all gnumach* kernels, not only
gnumach and gnumach.gz.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i18n.h (gettext): Inline instead of using #define.
(grub_gettext): Likewise.
(_): Likewise.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.in (CPPFLAGS): Replace -DGRUB_LIBDIR with
-DGRUB_PKGLIBROOTDIR= and prepend @PACKAGE_TARNAME@. All users updated.
* util/grub-mkimage.c (image_targets): Add i386-multiboot.
(main): Add a slash after pkglibdirroot.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Add missing "in" keyword.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.in: Remove -O i386-pc duplication.
Reported by: Seth Goldberg.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* po/POTFILES: Rename util/grub-mkrawimage.c to util/grub-mkimage.c.
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Check for Linux device-mapper support.

View file

@ -16,6 +16,7 @@ configuring the GRUB.
* GNU Bison 2.3 or later
* GNU gettext 0.17 or later
* GNU binutils 2.9.1.0.23 or later
* Flex 2.5.35 or later
* Other standard GNU/Unix tools
If you use a development snapshot or want to hack on GRUB you may

View file

@ -90,7 +90,7 @@ GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@ $(LIBS)
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(libdir)\" -DLOCALEDIR=\"$(localedir)\"
-DGRUB_PKGLIBROOTDIR=\"$(libdir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`\" -DLOCALEDIR=\"$(localedir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@

59
commands/i386/cmostest.c Normal file
View file

@ -0,0 +1,59 @@
/*
* 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/command.h>
#include <grub/misc.h>
#include <grub/cmos.h>
static grub_err_t
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int byte, bit;
char *rest;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
byte = grub_strtoul (argv[0], &rest, 0);
if (*rest != ':')
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
bit = grub_strtoul (rest + 1, 0, 0);
if (grub_cmos_read (byte) & (1 << bit))
return GRUB_ERR_NONE;
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
}
static grub_command_t cmd;
GRUB_MOD_INIT(cmostest)
{
cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
"cmostest BYTE:BIT",
"Test bit at BYTE:BIT in CMOS.");
}
GRUB_MOD_FINI(cmostest)
{
grub_unregister_command (cmd);
}

View file

@ -83,15 +83,24 @@ grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
0x06, (3 << 8) | index,
langid, descstr.length, (char *) descstrp);
*string = grub_malloc (descstr.length / 2);
if (descstrp->length == 0)
{
grub_free (descstrp);
*string = grub_strdup ("");
if (! *string)
return GRUB_USB_ERR_INTERNAL;
return GRUB_USB_ERR_NONE;
}
*string = grub_malloc (descstr.length * 2 + 1);
if (! *string)
{
grub_free (descstrp);
return GRUB_USB_ERR_INTERNAL;
}
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
(*string)[descstr.length / 2 - 1] = '\0';
*grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str,
descstrp->length / 2 - 1) = 0;
grub_free (descstrp);
return GRUB_USB_ERR_NONE;

View file

@ -68,5 +68,11 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For cmostest.mod
pkglib_MODULES += cmostest.mod
cmostest_mod_SOURCES = commands/i386/cmostest.c
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View file

@ -244,6 +244,12 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For cmostest.mod
pkglib_MODULES += cmostest.mod
cmostest_mod_SOURCES = commands/i386/cmostest.c
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
ifeq ($(enable_efiemu), yes)
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)

View file

@ -80,6 +80,7 @@ This edition documents version @value{VERSION}.
* Configuration:: Writing your own configuration file
* Network:: Downloading OS images from a network
* Serial terminal:: Using GRUB via a serial line
* Vendor power-on keys:: Changing GRUB behaviour on vendor power-on keys
* Preset Menu:: Embedding a configuration file into GRUB
* Images:: GRUB image files
* Filesystem:: Filesystem syntax and semantics
@ -747,6 +748,23 @@ implements few VT100 escape sequences. If you specify this option then
GRUB provides you with an alternative menu interface, because the normal
menu requires several fancy features of your terminal.
@node Vendor power-on keys
@chapter Using GRUB with vendor power-on keys
Some laptop vendor provide an additional power-on button which boots another OS.
GRUB supports such buttons with GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON,
GRUB_HIDDEN_TIMEOUT_BUTTON and GRUB_BUTTON_CMOS_ADDRESS variables in
default/grub. GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON and
GRUB_HIDDEN_TIMEOUT_BUTTON are used instead of corresponding variables without
_BUTTON suffix when powered using special button.
GRUB_BUTTON_CMOS_ADDRESS is vendor specific and partially model-specific.
Values known to GRUB team are:
@table @key
@item Dell XPS M1530
85:3
@end table
To take full advantage of this function install GRUB into MBR.
@node Filesystem
@chapter Filesystem syntax and semantics

View file

@ -110,6 +110,13 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
view->nested = nested;
view->first_timeout = -1;
grub_video_set_viewport (0, 0, mode_info.width, mode_info.height);
if (view->double_repaint)
{
grub_video_swap_buffers ();
grub_video_set_viewport (0, 0, mode_info.width, mode_info.height);
}
grub_gfxmenu_view_draw (view);
instance->data = view;

View file

@ -210,8 +210,7 @@ draw_scrollbar (list_impl_t self,
/* Draw the list of items. */
static void
draw_menu (list_impl_t self, int width, int drawing_scrollbar,
int num_shown_items)
draw_menu (list_impl_t self, int width, int num_shown_items)
{
if (! self->menu_box || ! self->selected_item_box)
return;
@ -226,8 +225,6 @@ draw_menu (list_impl_t self, int width, int drawing_scrollbar,
make_selected_item_visible (self);
int scrollbar_h_space = drawing_scrollbar ? self->scrollbar_width : 0;
grub_gfxmenu_box_t selbox = self->selected_item_box;
int sel_leftpad = selbox->get_left_pad (selbox);
int item_top = boxpad;
@ -244,12 +241,8 @@ draw_menu (list_impl_t self, int width, int drawing_scrollbar,
if (is_selected)
{
int sel_toppad = selbox->get_top_pad (selbox);
selbox->set_content_size (selbox,
(width - 2 * boxpad
- scrollbar_h_space),
item_height);
selbox->draw (selbox,
item_left - sel_leftpad,
selbox->set_content_size (selbox, (width - 2 * boxpad), item_height);
selbox->draw (selbox, item_left - sel_leftpad,
item_top - sel_toppad);
}
@ -320,7 +313,7 @@ list_paint (void *vself, const grub_video_rect_t *region)
box->draw (box, 0, 0);
grub_gui_set_viewport (&content_rect, &vpsave2);
draw_menu (self, content_rect.width, drawing_scrollbar, num_shown_items);
draw_menu (self, content_rect.width, num_shown_items);
grub_gui_restore_viewport (&vpsave2);
if (drawing_scrollbar)

View file

@ -357,11 +357,6 @@ grub_gfxmenu_draw_terminal_box (void)
term_box->draw (term_box,
term_rect.x - term_box->get_left_pad (term_box),
term_rect.y - term_box->get_top_pad (term_box));
grub_video_swap_buffers ();
if (term_view->double_repaint)
term_box->draw (term_box,
term_rect.x - term_box->get_left_pad (term_box),
term_rect.y - term_box->get_top_pad (term_box));
}
static void

View file

@ -22,10 +22,10 @@
#include <config.h>
#include <grub/symbol.h>
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
/* NLS can be disabled through the configure --disable-nls option. */
#if (defined(ENABLE_NLS) && ENABLE_NLS)
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
# ifdef GRUB_UTIL
@ -41,18 +41,26 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# ifdef GRUB_UTIL
# define gettext(Msgid) ((const char *) (Msgid))
# else
# define grub_gettext(str) ((const char *) (str))
# endif /* GRUB_UTIL */
static inline const char * __attribute__ ((always_inline))
gettext (const char *str)
{
return str;
}
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
#ifdef GRUB_UTIL
# define _(str) gettext(str)
static inline const char * __attribute__ ((always_inline))
_ (const char *str)
{
return gettext(str);
}
#else
# define _(str) grub_gettext(str)
static inline const char * __attribute__ ((always_inline))
_ (const char *str)
{
return grub_gettext(str);
}
#endif /* GRUB_UTIL */
#define N_(str) str

View file

@ -338,7 +338,7 @@ find_partition_start (const char *dev)
struct hd_geometry hdg;
# else /* defined(__NetBSD__) */
struct disklabel label;
int index;
int p_index;
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
@ -412,7 +412,8 @@ devmapper_fail:
fd = open (dev, O_RDONLY);
if (fd == -1)
{
grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk geometry", dev);
grub_error (GRUB_ERR_BAD_DEVICE,
"cannot open `%s' while attempting to get disk geometry", dev);
return 0;
}
@ -434,18 +435,15 @@ devmapper_fail:
# if !defined(__NetBSD__)
return hdg.start;
# else /* defined(__NetBSD__) */
/* Since dev and convert_system_partition_to_system_disk (dev) are
* different, we know that dev is of the form /dev/r[wsc]d[0-9]+[a-z]
* and in particular it cannot be a floppy device. */
index = dev[strlen(dev) - 1] - 'a';
p_index = dev[strlen(dev) - 1] - 'a';
if (index >= label.d_npartitions)
if (p_index >= label.d_npartitions)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", dev);
return 0;
}
return (grub_disk_addr_t) label.d_partitions[index].p_offset;
return (grub_disk_addr_t) label.d_partitions[p_index].p_offset;
# endif /* !defined(__NetBSD__) */
}
#endif /* __linux__ || __CYGWIN__ */
@ -1433,7 +1431,6 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
/* Since os_dev and convert_system_partition_to_system_disk (os_dev) are
* different, we know that os_dev is of the form /dev/r[wsc]d[0-9]+[a-z]
* and in particular it cannot be a floppy device. */
index = os_dev[strlen(os_dev) - 1] - 'a';
# endif /* !defined(__NetBSD__) */
start = find_partition_start (os_dev);

View file

@ -9,6 +9,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <grub/mm.h>
#include <grub/err.h>
@ -182,7 +185,8 @@ canonicalize_file_name (const char *path)
char *ret;
#ifdef PATH_MAX
ret = xmalloc (PATH_MAX);
(void) realpath (path, ret);
if (!realpath (path, ret))
return NULL;
#else
ret = realpath (path, NULL);
#endif

View file

@ -75,8 +75,8 @@ make_install_device (void)
ptr += grub_strlen (ptr);
if (grub_install_bsd_part >= 0)
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ",%c",
grub_install_bsd_part + 'a');
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ",%u",
grub_install_bsd_part + 1);
ptr += grub_strlen (ptr);
}

View file

@ -20,6 +20,7 @@
#include <grub/machine/memory.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/misc.h>
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
@ -28,6 +29,8 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
struct grub_machine_mmap_entry *entry
= (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
grub_memset (entry, 0, sizeof (entry));
/* Check if grub_get_mmap_entry works. */
cont = grub_get_mmap_entry (entry, 0);
@ -43,6 +46,8 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
if (! cont)
break;
grub_memset (entry, 0, sizeof (entry));
cont = grub_get_mmap_entry (entry, cont);
}
while (entry->size);

View file

@ -77,5 +77,5 @@ normal/misc.c
term/serial.c
util/grub-mkrawimage.c
util/grub-mkimage.c
util/i386/pc/grub-setup.c

View file

@ -707,12 +707,6 @@ real_scroll (void)
draw_cursor (0);
grub_video_set_active_render_target (render_target);
/* Save viewport and set it to our window. */
grub_video_get_viewport ((unsigned *) &saved_view.x,
(unsigned *) &saved_view.y,
(unsigned *) &saved_view.width,
(unsigned *) &saved_view.height);
grub_video_set_viewport (window.x, window.y, window.width, window.height);
i = window.double_repaint ? 2 : 1;
@ -720,6 +714,15 @@ real_scroll (void)
while (i--)
{
/* Save viewport and set it to our window. */
grub_video_get_viewport ((unsigned *) &saved_view.x,
(unsigned *) &saved_view.y,
(unsigned *) &saved_view.width,
(unsigned *) &saved_view.height);
grub_video_set_viewport (window.x, window.y, window.width,
window.height);
/* Clear new border area. */
grub_video_fill_rect (color,
virtual_screen.offset_x,
@ -735,6 +738,10 @@ real_scroll (void)
grub_video_scroll (color, 0, -virtual_screen.normal_char_height
* virtual_screen.total_scroll);
/* Restore saved viewport. */
grub_video_set_viewport (saved_view.x, saved_view.y,
saved_view.width, saved_view.height);
if (i)
grub_video_swap_buffers ();
}
@ -746,9 +753,6 @@ real_scroll (void)
grub_video_scroll (color, 0, -virtual_screen.normal_char_height
* virtual_screen.total_scroll);
/* Restore saved viewport. */
grub_video_set_viewport (saved_view.x, saved_view.y,
saved_view.width, saved_view.height);
grub_video_set_active_render_target (render_target);
}

View file

@ -124,7 +124,8 @@ halt
EOF
isofile=`mktemp`
grub-mkrescue --output=${isofile} --override-directory=${builddir} \
grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} \
--override-directory=${builddir} \
/boot/grub/grub.cfg=${cfgfile} /boot/grub/testcase.cfg=${source} \
>/dev/null 2>&1

View file

@ -342,7 +342,7 @@ else
prefix_drive=`$grub_probe --target=drive --device ${grub_device}` || exit 1
fi
case "${target_cpu}-${platform}"
case "${target_cpu}-${platform}" in
i386-pc) mkimage_target=i386-pc ;;
sparc64-ieee1275) mkimage_target=sparc64-ieee1275-raw ;;
mips-yeeloong) mkimage_target=mipsel-yeeloong-elf ;;

View file

@ -50,7 +50,13 @@ EOF
}
# Check the arguments.
next_grub_cfg=false
for option in "$@"; do
if $next_grub_cfg; then
grub_cfg=$option
next_grub_cfg=false
continue
fi
case "$option" in
-h | --help)
usage
@ -59,8 +65,7 @@ for option in "$@"; do
echo "$0 (GNU GRUB ${package_version})"
exit 0 ;;
-o)
shift
grub_cfg=$1
next_grub_cfg=:
;;
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
@ -72,6 +77,11 @@ for option in "$@"; do
;;
esac
done
if $next_grub_cfg; then
echo "Missing argument to \`-o'" 1>&2
usage
exit 1
fi
. ${libdir}/grub/grub-mkconfig_lib
@ -236,6 +246,10 @@ export GRUB_DEFAULT \
GRUB_HIDDEN_TIMEOUT \
GRUB_HIDDEN_TIMEOUT_QUIET \
GRUB_TIMEOUT \
GRUB_DEFAULT_BUTTON \
GRUB_HIDDEN_TIMEOUT_BUTTON \
GRUB_TIMEOUT_BUTTON \
GRUB_BUTTON_CMOS_ADDRESS \
GRUB_DISTRIBUTOR \
GRUB_CMDLINE_LINUX \
GRUB_CMDLINE_LINUX_DEFAULT \

View file

@ -105,6 +105,11 @@ prepare_grub_to_access_device ()
echo "insmod ${module}"
done
partmap="`${grub_probe} --device ${device} --target=partmap`"
for module in ${partmap} ; do
echo "insmod ${module}"
done
fs="`${grub_probe} --device ${device} --target=fs`"
for module in ${fs} ; do
echo "insmod ${module}"

View file

@ -99,6 +99,28 @@ struct image_target_desc image_targets[] =
.mod_gap = GRUB_KERNEL_I386_COREBOOT_MOD_GAP,
.mod_align = GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
},
{
.name = "i386-multiboot",
.voidp_sizeof = 4,
.bigendian = 0,
.id = IMAGE_COREBOOT,
.flags = PLATFORM_FLAGS_NONE,
.prefix = GRUB_KERNEL_I386_COREBOOT_PREFIX,
.data_end = GRUB_KERNEL_I386_COREBOOT_DATA_END,
.raw_size = 0,
.total_module_size = TARGET_NO_FIELD,
.kernel_image_size = TARGET_NO_FIELD,
.compressed_size = TARGET_NO_FIELD,
.section_align = 1,
.vaddr_offset = 0,
.install_dos_part = TARGET_NO_FIELD,
.install_bsd_part = TARGET_NO_FIELD,
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
.elf_target = EM_386,
.link_align = 4,
.mod_gap = GRUB_KERNEL_I386_COREBOOT_MOD_GAP,
.mod_align = GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
},
{
.name = "i386-pc",
.voidp_sizeof = 4,
@ -1182,7 +1204,7 @@ Make a bootable image of GRUB.\n\
\n\
Report bugs to <%s>.\n\
"),
program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY,
program_name, GRUB_PKGLIBROOTDIR, DEFAULT_DIRECTORY,
formats,
PACKAGE_BUGREPORT);
free (formats);
@ -1320,14 +1342,16 @@ main (int argc, char *argv[])
last = strchr (last + 1, '-');
if (!last)
last = image_target->name + strlen (image_target->name);
dir = xmalloc (sizeof (GRUB_LIBDIR) + (last - image_target->name));
memcpy (dir, GRUB_LIBDIR, sizeof (GRUB_LIBDIR) - 1);
memcpy (dir + sizeof (GRUB_LIBDIR) - 1, image_target->name,
dir = xmalloc (sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name)
+ 1);
memcpy (dir, GRUB_PKGLIBROOTDIR, sizeof (GRUB_PKGLIBROOTDIR) - 1);
*(dir + sizeof (GRUB_PKGLIBROOTDIR) - 1) = '/';
memcpy (dir + sizeof (GRUB_PKGLIBROOTDIR), image_target->name,
last - image_target->name);
*(dir + sizeof (GRUB_LIBDIR) - 1 + (last - image_target->name)) = 0;
*(dir + sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name)) = 0;
}
generate_image (dir ? : GRUB_LIBDIR, prefix ? : DEFAULT_DIRECTORY, fp,
generate_image (dir, prefix ? : DEFAULT_DIRECTORY, fp,
argv + optind, memdisk, font, config,
image_target, note);

View file

@ -41,7 +41,7 @@ usage (int status)
printf ("\
Usage: %s [OPTIONS] PATH\n\
\n\
Make a system path relative to it's root.\n\
Make a system path relative to its root.\n\
\n\
Options:\n\
-h, --help display this message and exit\n\

View file

@ -37,6 +37,7 @@ pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
rom_directory=
override_dir=
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
@ -219,7 +220,7 @@ grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${i
if test -e "${pc_dir}" ; then
echo "Enabling BIOS support ..."
core_img=`mktemp "$MKTEMP_TEMPLATE"`
$grub_mkimage -O i386-pc -d ${pc_dir}/ -O i386-pc -o ${core_img} --prefix=/boot/grub/i386-pc \
$grub_mkimage -O i386-pc -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
iso9660 biosdisk
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img

View file

@ -145,7 +145,8 @@ main (int argc, char *argv[])
char *input;
FILE *file = 0;
int verbose = 0;
struct grub_script *script;
int found_input = 0;
struct grub_script *script = NULL;
auto grub_err_t get_config_line (char **line, int cont);
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
@ -247,6 +248,7 @@ main (int argc, char *argv[])
get_config_line(&input, 0);
if (! input)
break;
found_input = 1;
script = grub_script_parse (input, get_config_line);
if (script)
@ -262,5 +264,5 @@ main (int argc, char *argv[])
grub_fini_all ();
if (file) fclose (file);
return (script == 0);
return (found_input && script == 0);
}

View file

@ -38,11 +38,29 @@ 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
if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
cat << EOF
if [ -s \$prefix/grubenv ]; then
load_env
fi
EOF
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
set default="${GRUB_DEFAULT_BUTTON}"
else
set default="${GRUB_DEFAULT}"
fi
EOF
else
cat <<EOF
set default="${GRUB_DEFAULT}"
EOF
fi
cat <<EOF
if [ \${prev_saved_entry} ]; then
set saved_entry=\${prev_saved_entry}
save_env saved_entry
@ -186,21 +204,36 @@ insmod gettext
EOF
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
cat << EOF
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
set timeout=${GRUB_TIMEOUT}
make_timeout ()
{
if [ "x${1}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
cat << EOF
if sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi
EOF
else
cat << EOF
set timeout=${GRUB_TIMEOUT}
else
cat << EOF
set timeout=${2}
EOF
fi
}
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
EOF
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
echo else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
echo fi
else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
fi
# Play an initial tune

View file

@ -35,13 +35,13 @@ all_of_them=true
# FIXME: add l4 here?
kernel=
for i in /boot/gnumach.gz /boot/gnumach ; do
for i in /boot/gnumach* ; do
if test -e $i ; then
basename=`basename $i`
dirname=`dirname $i`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
echo "Found GNU Mach: $i" >&2
kernel=${rel_dirname}/${basename}
kernels="${kernels} ${rel_dirname}/${basename}"
at_least_one=true
fi
done
@ -71,17 +71,22 @@ if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else
exit 1
fi
cat << EOF
menuentry "${OS}" ${CLASS} {
for kernel in ${kernels}
do
kernel_base="`basename "${kernel}"`"
KERNEL="using ${kernel_base}"
cat << EOF
menuentry "${OS} ${KERNEL}" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
echo '$(gettext_quoted "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
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
@ -93,17 +98,17 @@ cat << EOF
}
EOF
cat << EOF
menuentry "${OS} (recovery mode)" {
cat << EOF
menuentry "${OS} ${KERNEL} (recovery mode)" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
echo '$(gettext_quoted "Loading GNU Mach ...")'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF
echo '$(gettext_quoted "Loading the Hurd ...")'
module /hurd/${hurd_fs}.static ${hurd_fs} \\
--multiboot-command-line='\${kernel-command-line}' \\
@ -114,3 +119,5 @@ cat << EOF
module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
}
EOF
done

View file

@ -1,7 +1,7 @@
#! /bin/sh -e
# grub-mkconfig helper script.
# Copyright (C) 2008 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
@ -28,8 +28,8 @@ esac
# Try C: even if current system is on other partition.
case "$SYSTEMDRIVE" in
[Cc]:) dirlist="C:" ;;
[D-Zd-z]:) dirlist="C: $SYSTEMDRIVE" ;;
[Cc]:) drives="C:" ;;
[D-Zd-z]:) drives="C: $SYSTEMDRIVE" ;;
*) exit 0 ;;
esac
@ -51,7 +51,13 @@ get_os_name_from_boot_ini ()
}
for dir in $dirlist ; do
for drv in $drives ; do
# Convert to Cygwin path.
dir=`cygpath "$drv"`
test -n "$dir" || continue
needmap=
# Check for Vista bootmgr.
if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then
@ -60,6 +66,7 @@ for dir in $dirlist ; do
# Check for NTLDR.
elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then
OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="Windows NT/2000/XP loader"
needmap=t
else
continue
@ -68,14 +75,16 @@ for dir in $dirlist ; do
# Get boot /dev/ice.
dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue
echo "Found $OS on $dir ($dev)" >&2
echo "Found $OS on $drv ($dev)" >&2
cat << EOF
menuentry "$OS" {
EOF
save_default_entry | sed -e 's,^,\t,'
prepare_grub_to_access_device "$dev" | sed 's,^,\t,'
test -z "$needmap" || cat <<EOF
drivemap -s (hd0) \$root
EOF
cat << EOF
chainloader +1
}

View file

@ -30,9 +30,6 @@
#include <sys/time.h>
#include <unistd.h>
#include <time.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <grub/kernel.h>
#include <grub/dl.h>