* util/grub-mkconfig.in: Capitalise and export GRUB_PREFIX. Stop

setting GRUB_VIDEO_BACKEND.  Make it available as a user override
	instead.  Replace the gfxterm backend check with a check that
	${GRUB_PREFIX}/video.lst is non-empty.
	* util/grub.d/00_header.in: Use GRUB_PREFIX rather than computing it
	again.
	(load_video): New generated function.  Call it before loading
	gfxterm rather than loading ${GRUB_VIDEO_BACKEND}.
	* util/grub.d/10_linux.in (linux_entry): Call load_video.
	* util/grub.d/30_os-prober.in (osx_entry): Likewise.
	* docs/grub.texi (Simple configuration): Document
	GRUB_VIDEO_BACKEND.

	Use video functions in linux and xnu loaders.

	* conf/i386-pc.rmk (xnu_mod_SOURCES): Remove loader/i386/pc/xnu.c.
	* conf/x86-efi.rmk (xnu_mod_SOURCES): Remove loader/i386/efi/xnu.c.
	* include/grub/i386/xnu.h (grub_xnu_set_video): Removed.
	* loader/i386/efi/linux.c (grub_linux_setup_video): Copied from
	loader/i386/pc/linux.c.
	(grub_linux_boot): Resynced with loader/i386/pc/linux.c.
	(find_line_len): Removed.
	(find_framebuf): Likewise.
	(grub_cmd_linux): Declare grub_linux_boot as possibly returning.
	* loader/i386/efi/xnu.c: Removed.
	* loader/i386/pc/xnu.c: Moved from here...
	* loader/i386/xnu.c: ...here.

	Enable priorities in video drivers.

	* include/grub/video.h (grub_video_adapter_prio_t): New type.
	(grub_video_adapter): New field prio.
	(grub_video_register): Respect prio when inserting.
	* video/efi_gop.c (grub_video_gop_adapter): Add prio.
	* video/efi_uga.c (grub_video_uga_adapter): Likewise.
	* video/emu/sdl.c (grub_video_sdl_adapter): Likewise.
	* video/i386/pc/vbe.c (grub_video_vbe_adapter): Likewise.
	* video/i386/pc/vga.c (grub_video_vga_adapter): Likewise.
	* video/ieee1275.c (grub_video_ieee1275_adapter): Likewise.
	* video/sm712.c (grub_video_sm712_adapter): Likewise.

	Fix SDL driver ID.

	* include/grub/video.h (grub_video_driver_id_t): New value
	GRUB_VIDEO_DRIVER_SDL.
	* video/emu/sdl.c (grub_video_sdl_adapter): Add id.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Colin Watson 2010-06-20 13:37:18 +02:00 committed by Vladimir 'phcoder' Serbinenko
commit 4321c64aff
21 changed files with 325 additions and 497 deletions

View file

@ -96,11 +96,11 @@ 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}`
GRUB_PREFIX=`echo /grub | sed ${transform}`
;;
*)
# Use /boot/grub by default.
grub_prefix=`echo /boot/grub | sed ${transform}`
GRUB_PREFIX=`echo /boot/grub | sed ${transform}`
;;
esac
@ -141,9 +141,9 @@ else
exit 1
fi
mkdir -p ${grub_prefix}
mkdir -p ${GRUB_PREFIX}
if test -e ${grub_prefix}/device.map ; then : ; else
if test -e ${GRUB_PREFIX}/device.map ; then : ; else
${grub_mkdevicemap}
fi
@ -178,17 +178,14 @@ fi
for x in ${GRUB_TERMINAL_OUTPUT}; do
if [ "x${x}" = "xgfxterm" ]; then
# If this platform supports gfxterm, try to use it.
if ! test -e ${grub_prefix}/gfxterm.mod ; then
if ! test -e ${GRUB_PREFIX}/gfxterm.mod ; then
if [ "x$termoutdefault" != "x1" ]; then
echo "gfxterm isn't available on your platform" >&2 ; exit 1
fi
GRUB_TERMINAL_OUTPUT=
break;
fi
# FIXME: this should do something smarter than just loading first
# video backend.
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
if [ -z "${GRUB_VIDEO_BACKEND}" ] ; then
if [ ! -s "${GRUB_PREFIX}/video.lst" ] ; then
if [ "x$termoutdefault" != "x1" ]; then
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
fi
@ -246,7 +243,7 @@ export GRUB_DEVICE \
GRUB_FS \
GRUB_FONT_PATH \
GRUB_PRELOAD_MODULES \
GRUB_VIDEO_BACKEND
GRUB_PREFIX
# These are optional, user-defined variables.
export GRUB_DEFAULT \
@ -268,6 +265,7 @@ export GRUB_DEFAULT \
GRUB_DISABLE_LINUX_UUID \
GRUB_DISABLE_LINUX_RECOVERY \
GRUB_DISABLE_NETBSD_RECOVERY \
GRUB_VIDEO_BACKEND \
GRUB_GFXMODE \
GRUB_BACKGROUND \
GRUB_THEME \

View file

@ -21,8 +21,7 @@ transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
locale_dir=`echo /boot/grub/locale | sed ${transform}`
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
. ${libdir}/grub/grub-mkconfig_lib
@ -75,6 +74,24 @@ function savedefault {
save_env saved_entry
fi
}
function load_video {
EOF
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
cat <<EOF
insmod ${GRUB_VIDEO_BACKEND}
EOF
else
# Insert all available backends; GRUB will use the most appropriate.
for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
cat <<EOF
insmod ${backend}
EOF
done
fi
cat <<EOF
}
EOF
serial=0;
@ -89,7 +106,7 @@ for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
done
if [ "x$serial" = x1 ]; then
if ! test -e ${grub_prefix}/serial.mod ; then
if ! test -e ${GRUB_PREFIX}/serial.mod ; then
echo "Serial terminal not available on this platform." >&2 ; exit 1
fi
@ -107,8 +124,8 @@ if [ "x$gfxterm" = x1 ]; then
cat << EOF
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
load_video
insmod gfxterm
insmod ${GRUB_VIDEO_BACKEND}
EOF
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
&& is_path_readable_by_grub "$GRUB_THEME"; then

View file

@ -66,6 +66,9 @@ linux_entry ()
# Use ELILO's generic "efifb" when it's known to be available.
# FIXME: We need an interface to select vesafb in case efifb can't be used.
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
cat << EOF
load_video
EOF
if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then
cat << EOF

View file

@ -44,7 +44,7 @@ EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
cat << EOF
insmod ${GRUB_VIDEO_BACKEND}
load_video
set do_resume=0
if [ /var/vm/sleepimage -nt10 / ]; then
if xnu_resume /var/vm/sleepimage; then