Rebase from 1.99 to 2.00~beta2

This commit is contained in:
Peter Jones 2012-03-14 16:33:25 -04:00
parent c7429be5d2
commit 28678c2db6
8 changed files with 55 additions and 1525 deletions

View file

@ -1,16 +0,0 @@
From: Adam Williamson <awilliam@redhat.com>
Subject: call ${grub_probe} instead of grub-probe in OSXUUID line of 30_os-prober.in
Date: 2011-12-08 17:55:47 +0000
=== modified file 'util/grub.d/30_os-prober.in'
--- a/util/grub.d/30_os-prober.in 2011-12-08 09:39:52.311466000 -0800
+++ b/util/grub.d/30_os-prober.in 2011-12-08 09:41:22.984908889 -0800
@@ -168,7 +168,7 @@
done
;;
macosx)
- OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
+ OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64
;;

View file

@ -141,10 +141,10 @@ index 06d78b7..8453d5b 100644
{ {
grub_test_t test; grub_test_t test;
diff --git a/include/grub/test.h b/include/grub/test.h diff --git a/include/grub/test.h b/include/grub/test.h
index 336d3b6..77a7598 100644 index 5d1ba75..d876f57 100644
--- a/include/grub/test.h --- a/include/grub/test.h
+++ b/include/grub/test.h +++ b/include/grub/test.h
@@ -53,10 +53,14 @@ void grub_test_nonzero (int cond, const char *file, @@ -54,10 +54,14 @@ void grub_test_nonzero (int cond, const char *file,
__attribute__ ((format (printf, 5, 6))); __attribute__ ((format (printf, 5, 6)));
/* Macro to fill in location details and an optional error message. */ /* Macro to fill in location details and an optional error message. */
@ -160,8 +160,8 @@ index 336d3b6..77a7598 100644
+ grub_test_assert_helper(cond, GRUB_FILE, __FUNCTION__, __LINE__, \ + grub_test_assert_helper(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
+ #cond, ## __VA_ARGS__); + #cond, ## __VA_ARGS__);
/* Macro to define a unit test. */ void grub_unit_test_init (void);
#define GRUB_UNIT_TEST(name, funp) \ void grub_unit_test_fini (void);
-- --
1.7.3.1 1.7.3.1

View file

@ -1,501 +0,0 @@
From: Vladimir Serbinenko <phcoder@gmail.com>
Subject: Handle newer autotools. Add some missing quotes while on it.
Date: 2012-01-24 12:17:36 +0000
* Makefile.am (pkglib_DATA): Remove update-grub_lib.
(pkglib_DATA): Move grub-mkconfig_lib from here ...
(pkgdata_DATA): ... here.
* Makefile.util.def (update-grub_lib): Removed.
* conf/Makefile.common (pkglib_DATA): Removed.
(pkglib_SCRIPTS): Likewise.
(pkgdata_DATA): New variable.
* tests/util/grub-shell-tester.in: Replace pkglib with pkgdata where
needed.
Add missing quotes.
Remove unused variable while on it.
* tests/util/grub-shell.in: Likewise.
* util/grub-install.in: Likewise.
* util/grub-mkconfig.in: Likewise.
* util/grub-mknetdir.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mkstandalone.in: Likewise.
* util/grub.d/00_header.in: Likewise.
* util/grub.d/10_hurd.in: Likewise.
* util/grub.d/10_illumos.in: Likewise.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/10_netbsd.in: Likewise.
* util/grub.d/10_windows.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.
* util/grub.d/30_os-prober.in: Likewise.
* util/update-grub_lib.in: Removed.
---
Makefile.am | 3 +--
Makefile.util.def | 6 ------
conf/Makefile.common | 3 +--
tests/util/grub-shell-tester.in | 23 +++++++++++------------
tests/util/grub-shell.in | 23 +++++++++++------------
util/grub-install.in | 2 ++
util/grub-mkconfig.in | 27 ++++++++++++++-------------
util/grub-mknetdir.in | 29 ++++++++++++++---------------
util/grub-mkrescue.in | 9 +++++----
util/grub.d/00_header.in | 9 +++++----
util/grub.d/10_linux.in | 10 +++++-----
util/grub.d/20_linux_xen.in | 12 ++++++------
util/grub.d/30_os-prober.in | 9 +++++----
util/update-grub_lib.in | 23 -----------------------
14 files changed, 80 insertions(+), 108 deletions(-)
delete mode 100644 util/update-grub_lib.in
diff --git a/Makefile.am b/Makefile.am
index 9301c91..fd3848d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,8 +101,7 @@ CLEANFILES += widthspec.h
# Install config.h into platformdir
platform_HEADERS = config.h
-pkglib_DATA += grub-mkconfig_lib
-pkglib_DATA += update-grub_lib
+pkgdata_DATA += grub-mkconfig_lib
if COND_i386_coreboot
diff --git a/Makefile.util.def b/Makefile.util.def
index 058572f..6451999 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -435,12 +435,6 @@ script = {
};
script = {
- name = update-grub_lib;
- common = util/update-grub_lib.in;
- installdir = noinst;
-};
-
-script = {
name = grub-kbdcomp;
common = util/grub-kbdcomp.in;
};
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 5aa13cd..2040a2e 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -137,7 +137,7 @@ KERNEL_HEADER_FILES =
man_MANS =
noinst_DATA =
-pkglib_DATA =
+pkgdata_DATA =
bin_SCRIPTS =
sbin_SCRIPTS =
bin_PROGRAMS =
@@ -147,7 +147,6 @@ check_SCRIPTS =
grubconf_DATA =
check_PROGRAMS =
noinst_SCRIPTS =
-pkglib_SCRIPTS =
noinst_PROGRAMS =
grubconf_SCRIPTS =
noinst_LIBRARIES =
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
index 02e49d3..eaaab41 100644
--- a/tests/util/grub-shell-tester.in
+++ b/tests/util/grub-shell-tester.in
@@ -19,18 +19,17 @@
# Initialize some variables.
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-builddir=@builddir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+builddir="@builddir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
# Force build directory components
-PATH=${builddir}:$PATH
+PATH="${builddir}:$PATH"
export PATH
# Usage: usage
@@ -85,23 +84,23 @@ done
if [ "x${source}" = x ] ; then
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
while read REPLY; do
- echo $REPLY >> ${tmpfile}
+ echo $REPLY >> "${tmpfile}"
done
- source=${tmpfile}
+ source="${tmpfile}"
fi
outfile1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
-@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1}
+"@builddir@/grub-shell" --qemu-opts="${qemuopts}" --modules=${modules} ${source} >"${outfile1}"
outfile2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
-bash ${source} >${outfile2}
+bash "${source}" >"${outfile2}"
-if ! diff -q ${outfile1} ${outfile2} >/dev/null
+if ! diff -q "${outfile1}" "${outfile2}" >/dev/null
then
echo "${source}: GRUB and BASH outputs did not match (see diff -u ${outfile1} ${outfile2})"
status=1
else
- rm -f ${outfile1} ${outfile2}
+ rm -f "${outfile1}" "${outfile2}"
fi
exit $status
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 0213376..461befb 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -19,11 +19,10 @@
# Initialize some variables.
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-builddir=@builddir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+builddir="@builddir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
@@ -140,9 +139,9 @@ EOF
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
if [ x$boot != xnet ]; then
- sh @builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} --override-directory=${builddir}/grub-core \
+ sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
--rom-directory="${rom_directory}" \
- /boot/grub/grub.cfg=${cfgfile} /boot/grub/testcase.cfg=${source} \
+ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
${files} >/dev/null 2>&1
fi
if [ x$boot = xhd ]; then
@@ -173,12 +172,12 @@ fi
if [ x$boot = xnet ]; then
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
- sh @builddir@/grub-mknetdir --grub-mkimage=${builddir}/grub-mkimage --override-directory=${builddir}/grub-core --net-directory=$netdir
- cp ${cfgfile} $netdir/boot/grub/grub.cfg
- cp ${source} $netdir/boot/grub/testcase.cfg
- ${qemu} ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net user,tftp=$netdir,bootfile=/boot/grub/$target_cpu-$platform/core.0 -net nic | cat | tr -d "\r"
+ sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--override-directory=${builddir}/grub-core" "--net-directory=$netdir"
+ cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
+ cp "${source}" "$netdir/boot/grub/testcase.cfg"
+ "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/$target_cpu-$platform/core.0" -net nic | cat | tr -d "\r"
else
- ${qemu} ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"
+ "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"
fi
rm -f "${isofile}" "${imgfile}"
rm -rf "${rom_directory}"
diff --git a/util/grub-install.in b/util/grub-install.in
index ff8bea8..b18d5cc 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -21,6 +21,7 @@ transform="@program_transform_name@"
prefix="@prefix@"
exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
sbindir="@sbindir@"
bindir="@bindir@"
libdir="@libdir@"
@@ -32,6 +33,7 @@ target_cpu=@target_cpu@
platform=@platform@
host_os=@host_os@
pkglibdir="${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`"
+datadir="@datadir@"
localedir="@datadir@/locale"
self="`basename $0`"
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index afc66f8..45cc400 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -18,26 +18,27 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
-bindir=@bindir@
-libdir=@libdir@
-sysconfdir=@sysconfdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+sbindir="@sbindir@"
+bindir="@bindir@"
+sysconfdir="@sysconfdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
host_os=@host_os@
-datarootdir=@datarootdir@
-datadir=@datadir@
-pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
+datadir="@datadir@"
+pkgdatadir="${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`"
grub_cfg=""
-grub_mkconfig_dir=${sysconfdir}/grub.d
+grub_mkconfig_dir="${sysconfdir}"/grub.d
self=`basename $0`
-grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed "${transform}"`
-grub_probe=${sbindir}/`echo grub-probe | sed "${transform}"`
+grub_mkdevicemap="${sbindir}/`echo grub-mkdevicemap | sed "${transform}"`"
+grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`"
GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`
diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in
index b353e98..860fb6f 100644
--- a/util/grub-mknetdir.in
+++ b/util/grub-mknetdir.in
@@ -19,25 +19,24 @@
# Initialize some variables.
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
-bindir=@bindir@
-libdir=@libdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+bindir="@bindir@"
+libdir="@libdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
host_os=@host_os@
-pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
-localedir=@datadir@/locale
+pkglibdir="${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`"
native_platform=@platform@
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
self=`basename $0`
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
rootdir=/srv/tftp
grub_prefix=`echo /boot/grub | sed ${transform}`
modules=
@@ -48,7 +47,7 @@ recheck=no
debug=no
debug_image=
subdir=`echo /boot/grub | sed ${transform}`
-pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
+pc_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc"
# Usage: usage
# Print the usage.
@@ -170,12 +169,12 @@ process_input_dir ()
config_opt=
mkdir -p "$grubdir" || exit 1
- for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/efiemu??.o; do
- if test -f $file && [ "`basename $file`" != menu.lst ]; then
- rm -f $file || exit 1
+ for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o; do
+ if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
+ rm -f "$file" || exit 1
fi
done
- for file in ${input_dir}/*.mod; do
+ for file in "${input_dir}"/*.mod; do
if test -f "$file"; then
cp -f "$file" "$grubdir/"
fi
@@ -187,7 +186,7 @@ process_input_dir ()
done
mkdir -p "$grubdir/locale"
- for file in ${input_dir}/po/*.mo; do
+ for file in "${input_dir}"/po/*.mo; do
if test -f "$file"; then
cp -f "$file" "$grubdir/locale/"
fi
@@ -213,7 +212,7 @@ process_input_dir ()
source ${subdir}/grub.cfg
EOF
- $grub_mkimage ${config_opt} -d "${input_dir}" -O ${mkimage_target} --output=${grubdir}/core.$ext --prefix=$prefix $modules $netmodules || exit 1
+ "$grub_mkimage" ${config_opt} -d "${input_dir}" -O ${mkimage_target} "--output=${grubdir}/core.$ext" "--prefix=$prefix" $modules $netmodules || exit 1
echo "Netboot directory for ${platform} created. Configure your DHCP server to point to ${subdir}/${platform}/core.$ext"
}
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
index f7f7517..383ee7a 100644
--- a/util/grub-mkrescue.in
+++ b/util/grub-mkrescue.in
@@ -20,10 +20,11 @@ set -e
# Initialize some variables.
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+bindir="@bindir@"
+libdir="@libdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 9da1511..5c4d9db 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -19,9 +19,10 @@ set -e
transform="@program_transform_name@"
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+datarootdir="@datarootdir@"
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d . -f 1`
@@ -112,7 +113,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
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index edb1eda..8bc1180 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -17,11 +17,11 @@ set -e
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-. ${libdir}/grub/grub-mkconfig_lib
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+datarootdir="@datarootdir@"
+. "${datarootdir}/grub/grub-mkconfig_lib"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@localedir@
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index f37e365..9104667 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -17,14 +17,14 @@ set -e
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-. ${libdir}/grub/grub-mkconfig_lib
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+datarootdir="@datarootdir@"
+. "${datarootdir}/grub/grub-mkconfig_lib"
export TEXTDOMAIN=@PACKAGE@
-export TEXTDOMAINDIR=@localedir@
+export TEXTDOMAINDIR="@localedir@"
CLASS="--class gnu-linux --class gnu --class os --class xen"
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 9eb7b3e..7336000 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -17,11 +17,12 @@ set -e
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+libdir="@libdir@"
-. ${libdir}/grub/grub-mkconfig_lib
+. "${datarootdir}/grub/grub-mkconfig_lib"
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
exit 0
diff --git a/util/update-grub_lib.in b/util/update-grub_lib.in
deleted file mode 100644
index 998452e..0000000
--- a/util/update-grub_lib.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# stub for new grub-mkconfig_lib
-# Copyright (C) 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/>.
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-
-. ${libdir}/grub/grub-mkconfig_lib
-
-grub_warn "update-grub_lib is deprecated, use grub-mkconfig_lib instead"
--
1.7.7.6

View file

@ -1,575 +0,0 @@
From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
Date: Fri, 24 Feb 2012 17:26:02 -0400
Subject: [PATCH] Pull in required v2 changes for PPC
---
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index 2fbe809..9e80757 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -60,6 +60,10 @@ grub_ieee1275_find_options (void)
int is_olpc = 0;
int is_qemu = 0;
+#ifdef __sparc__
+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0);
+#endif
+
grub_ieee1275_finddevice ("/", &root);
grub_ieee1275_finddevice ("/options", &options);
grub_ieee1275_finddevice ("/openprom", &openprom);
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 682a8b5..13a160f 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -69,36 +69,45 @@ grub_translate_ieee1275_path (char *filepath)
}
void
-grub_machine_set_prefix (void)
+grub_machine_get_bootlocation (char **device, char **path)
{
char bootpath[64]; /* XXX check length */
char *filename;
- char *prefix;
-
- if (grub_prefix[0])
- {
- grub_env_set ("prefix", grub_prefix);
- /* Prefix is hardcoded in the core image. */
- return;
- }
-
+ char *type;
+
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
sizeof (bootpath), 0))
{
/* Should never happen. */
grub_printf ("/chosen/bootpath property missing!\n");
- grub_env_set ("prefix", "");
return;
}
/* Transform an OF device path to a GRUB path. */
- prefix = grub_ieee1275_encode_devname (bootpath);
+ type = grub_ieee1275_get_device_type (bootpath);
+ if (type && grub_strcmp (type, "network") == 0)
+ {
+ char *dev, *canon;
+ char *ptr;
+ dev = grub_ieee1275_get_aliasdevname (bootpath);
+ canon = grub_ieee1275_canonicalise_devname (dev);
+ ptr = canon + grub_strlen (canon) - 1;
+ while (ptr > canon && (*ptr == ',' || *ptr == ':'))
+ ptr--;
+ ptr++;
+ *ptr = 0;
+
+ grub_free (dev);
+ grub_free (canon);
+ }
+ else
+ *device = grub_ieee1275_encode_devname (bootpath);
+ grub_free (type);
filename = grub_ieee1275_get_filename (bootpath);
if (filename)
{
- char *newprefix;
char *lastslash = grub_strrchr (filename, '\\');
/* Truncate at last directory. */
@@ -107,19 +116,9 @@ grub_machine_set_prefix (void)
*lastslash = '\0';
grub_translate_ieee1275_path (filename);
- newprefix = grub_xasprintf ("%s%s", prefix, filename);
- if (newprefix)
- {
- grub_free (prefix);
- prefix = newprefix;
- }
+ *path = filename;
}
}
-
- grub_env_set ("prefix", prefix);
-
- grub_free (filename);
- grub_free (prefix);
}
/* Claim some available memory in the first /memory node. */
@@ -192,22 +191,12 @@ static void grub_claim_heap (void)
grub_machine_mmap_iterate (heap_init);
}
-static grub_uint64_t ieee1275_get_time_ms (void);
-
-void
-grub_machine_init (void)
+static void
+grub_parse_cmdline (void)
{
- char args[256];
grub_ssize_t actual;
+ char args[256];
- grub_ieee1275_init ();
-
- grub_console_init_early ();
- grub_claim_heap ();
- grub_console_init_lately ();
- grub_ofdisk_init ();
-
- /* Process commandline. */
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootargs", &args,
sizeof args, &actual) == 0
&& actual > 1)
@@ -240,6 +229,21 @@ grub_machine_init (void)
}
}
}
+}
+
+static grub_uint64_t ieee1275_get_time_ms (void);
+
+void
+grub_machine_init (void)
+{
+ grub_ieee1275_init ();
+
+ grub_console_init_early ();
+ grub_claim_heap ();
+ grub_console_init_lately ();
+ grub_ofdisk_init ();
+
+ grub_parse_cmdline ();
grub_install_get_time_ms (ieee1275_get_time_ms);
}
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index f5dc8ef..6aa57ea 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -27,6 +27,8 @@ enum grub_ieee1275_parse_type
{
GRUB_PARSE_FILENAME,
GRUB_PARSE_PARTITION,
+ GRUB_PARSE_DEVICE,
+ GRUB_PARSE_DEVICE_TYPE
};
/* Walk children of 'devpath', calling hook for each. */
@@ -317,14 +319,9 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
{
char type[64]; /* XXX check size. */
char *device = grub_ieee1275_get_devname (path);
- char *args = grub_ieee1275_get_devargs (path);
char *ret = 0;
grub_ieee1275_phandle_t dev;
- if (!args)
- /* Shouldn't happen. */
- return 0;
-
/* We need to know what type of device it is in order to parse the full
file path properly. */
if (grub_ieee1275_finddevice (device, &dev))
@@ -339,49 +336,93 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
goto fail;
}
- if (!grub_strcmp ("block", type))
+ switch (ptype)
{
- /* The syntax of the device arguments is defined in the CHRP and PReP
- IEEE1275 bindings: "[partition][,[filename]]". */
- char *comma = grub_strchr (args, ',');
+ case GRUB_PARSE_DEVICE:
+ ret = grub_strdup (device);
+ break;
+ case GRUB_PARSE_DEVICE_TYPE:
+ ret = grub_strdup (type);
+ break;
+ case GRUB_PARSE_FILENAME:
+ {
+ char *comma;
+ char *args;
+
+ if (grub_strcmp ("block", type) != 0)
+ goto unknown;
+
+ args = grub_ieee1275_get_devargs (path);
+ if (!args)
+ /* Shouldn't happen. */
+ return 0;
- if (ptype == GRUB_PARSE_FILENAME)
- {
- if (comma)
- {
- char *filepath = comma + 1;
-
- /* Make sure filepath has leading backslash. */
- if (filepath[0] != '\\')
- ret = grub_xasprintf ("\\%s", filepath);
- else
- ret = grub_strdup (filepath);
+ /* The syntax of the device arguments is defined in the CHRP and PReP
+ IEEE1275 bindings: "[partition][,[filename]]". */
+ comma = grub_strchr (args, ',');
+
+ if (comma)
+ {
+ char *filepath = comma + 1;
+
+ /* Make sure filepath has leading backslash. */
+ if (filepath[0] != '\\')
+ ret = grub_xasprintf ("\\%s", filepath);
+ else
+ ret = grub_strdup (filepath);
}
+ grub_free (args);
}
- else if (ptype == GRUB_PARSE_PARTITION)
- {
- if (!comma)
- ret = grub_strdup (args);
- else
- ret = grub_strndup (args, (grub_size_t)(comma - args));
- }
- }
- else
- {
- /* XXX Handle net devices by configuring & registering a grub_net_dev
- here, then return its name?
- Example path: "net:<server ip>,<file name>,<client ip>,<gateway
- ip>,<bootp retries>,<tftp retries>". */
+ break;
+ case GRUB_PARSE_PARTITION:
+ {
+ char *comma;
+ char *args;
+
+ if (grub_strcmp ("block", type) != 0)
+ goto unknown;
+
+ args = grub_ieee1275_get_devargs (path);
+ if (!args)
+ /* Shouldn't happen. */
+ return 0;
+
+ comma = grub_strchr (args, ',');
+ if (!comma)
+ ret = grub_strdup (args);
+ else
+ ret = grub_strndup (args, (grub_size_t)(comma - args));
+ /* Consistently provide numbered partitions to GRUB.
+ OpenBOOT traditionally uses alphabetical partition
+ specifiers. */
+ if (ret[0] >= 'a' && ret[0] <= 'z')
+ ret[0] = '1' + (ret[0] - 'a');
+ grub_free (args);
+ }
+ break;
+ default:
+ unknown:
grub_printf ("Unsupported type %s for device %s\n", type, device);
}
fail:
grub_free (device);
- grub_free (args);
return ret;
}
char *
+grub_ieee1275_get_device_type (const char *path)
+{
+ return grub_ieee1275_parse_args (path, GRUB_PARSE_DEVICE_TYPE);
+}
+
+char *
+grub_ieee1275_get_aliasdevname (const char *path)
+{
+ return grub_ieee1275_parse_args (path, GRUB_PARSE_DEVICE);
+}
+
+char *
grub_ieee1275_get_filename (const char *path)
{
return grub_ieee1275_parse_args (path, GRUB_PARSE_FILENAME);
@@ -403,10 +444,10 @@ grub_ieee1275_encode_devname (const char *path)
/* GRUB partition 1 is OF partition 0. */
partno++;
- encoding = grub_xasprintf ("(%s,%d)", device, partno);
+ encoding = grub_xasprintf ("%s,%d", device, partno);
}
else
- encoding = grub_xasprintf ("(%s)", device);
+ encoding = grub_xasprintf ("%s", device);
grub_free (partition);
grub_free (device);
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index da71232..6820f4c 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -129,27 +129,74 @@ grub_env_write_root (struct grub_env_var *var __attribute__ ((unused)),
return grub_strdup (val);
}
-/* Set the root device according to the dl prefix. */
static void
-grub_set_root_dev (void)
+grub_set_prefix_and_root (void)
{
- const char *prefix;
+ char *device = NULL;
+ char *path = NULL;
+ char *fwdevice = NULL;
+ char *fwpath = NULL;
grub_register_variable_hook ("root", 0, grub_env_write_root);
- prefix = grub_env_get ("prefix");
-
- if (prefix)
+ {
+ char *pptr = NULL;
+ if (grub_prefix[0] == '(')
+ {
+ pptr = grub_strrchr (grub_prefix, ')');
+ if (pptr)
+ {
+ device = grub_strndup (grub_prefix + 1, pptr - grub_prefix - 1);
+ pptr++;
+ }
+ }
+ if (!pptr)
+ pptr = grub_prefix;
+ if (pptr[0])
+ path = grub_strdup (pptr);
+ }
+ if ((!device || device[0] == ',' || !device[0]) || !path)
+ grub_machine_get_bootlocation (&fwdevice, &fwpath);
+
+ if (!device && fwdevice)
+ device = fwdevice;
+ else if (fwdevice && (device[0] == ',' || !device[0]))
{
- char *dev;
+ /* We have a partition, but still need to fill in the drive. */
+ char *comma, *new_device;
+
+ comma = grub_strchr (fwdevice, ',');
+ if (comma)
+ {
+ char *drive = grub_strndup (fwdevice, comma - fwdevice);
+ new_device = grub_xasprintf ("%s%s", drive, device);
+ grub_free (drive);
+ }
+ else
+ new_device = grub_xasprintf ("%s%s", fwdevice, device);
- dev = grub_file_get_device_name (prefix);
- if (dev)
+ grub_free (fwdevice);
+ grub_free (device);
+ device = new_device;
+ }
+ if (fwpath && !path)
+ path = fwpath;
+ if (device)
+ {
+ char *prefix;
+
+ prefix = grub_xasprintf ("(%s)%s", device, path ? : "");
+ if (prefix)
{
- grub_env_set ("root", dev);
- grub_free (dev);
+ grub_env_set ("prefix", prefix);
+ grub_free (prefix);
}
+ grub_env_set ("root", device);
}
+
+ grub_free (device);
+ grub_free (path);
+ grub_print_error ();
}
/* Load the normal mode module and execute the normal mode if possible. */
@@ -159,7 +206,7 @@ grub_load_normal_mode (void)
/* Load the module. */
grub_dl_load ("normal");
- /* Something went wrong. Print errors here to let user know why we're entering rescue mode. */
+ /* Print errors if any. */
grub_print_error ();
grub_errno = 0;
@@ -187,8 +234,7 @@ grub_main (void)
/* It is better to set the root device as soon as possible,
for convenience. */
- grub_machine_set_prefix ();
- grub_set_root_dev ();
+ grub_set_prefix_and_root ();
grub_env_export ("root");
grub_env_export ("prefix");
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 4c56cc2..fc977f5 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -195,7 +195,8 @@ char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
-
+char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path);
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
+char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path);
#endif /* ! GRUB_IEEE1275_HEADER */
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index 2ecc73d..09839de 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -84,7 +84,8 @@ void grub_machine_init (void);
void EXPORT_FUNC(grub_machine_fini) (void);
/* The machine-specific prefix initialization. */
-void grub_machine_set_prefix (void);
+void
+grub_machine_get_bootlocation (char **device, char **path);
/* Register all the exported symbols. This is automatically generated. */
void grub_register_exported_symbols (void);
diff --git a/util/grub-install.in b/util/grub-install.in
index ff8bea8..cbf1e1e 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -271,7 +271,8 @@ if test "x$install_device" = x && ([ "${target_cpu}-${platform}" = "i386-pc" ] \
fi
if ! ([ "${target_cpu}-${platform}" = "i386-pc" ] \
- || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]); then
+ || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] \
+ || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]); then
install_device=
fi
@@ -522,11 +523,11 @@ if [ "x${devabstraction_module}" = "x" ] ; then
# Strip partition number
grub_partition="`echo "${grub_drive}" | sed -e 's/^[^,]*[,)]//; s/)$//'`"
grub_drive="`echo "${grub_drive}" | sed -e s/,[a-z0-9,]*//g`"
- if [ "$disk_module" = ata ] || [ "x${grub_drive}" != "x${install_drive}" ] || ([ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${target_cpu}-${platform}" != x"sparc64-ieee1275" ]) ; then
+ if [ "$disk_module" = ata ] || [ "x${grub_drive}" != "x${install_drive}" ] || ([ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${platform}" != x"ieee1275" ]); then
# generic method (used on coreboot and ata mod)
uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`"
if [ "x${uuid}" = "x" ] ; then
- if [ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${target_cpu}-${platform}" != x"sparc64-ieee1275" ]; then
+ if [ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${platform}" != x"ieee1275" ]; then
echo "UUID needed with $platform, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
elif [ "$disk_module" = ata ]; then
echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
@@ -540,11 +541,12 @@ if [ "x${devabstraction_module}" = "x" ] ; then
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid"
- elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then
+ else
# we need to hardcode the partition number in the core image's prefix.
if [ x"$grub_partition" = x ]; then
prefix_drive="()"
else
+ # Comma is already there
prefix_drive="(,$grub_partition)"
fi
fi
@@ -612,6 +614,30 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
# Point boot-device at the new grub install
boot_device="$ofpath:$partno,"`"$grub_mkrelpath" "${grubdir}/core.${imgext}" | sed 's,/,\\\\,g'`
+
+ # If a install device is defined, copy the core.elf to PReP partition.
+ if [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] \
+ && [ -n "${install_device}" ]; then
+ if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then
+ echo "The chosen partition is not a PReP partition."
+ exit 1
+ fi
+
+ # Check if device is with an ELF within or is blank
+ if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || cmp -s -n $(blockdev --getsize64 ${install_device}) /dev/zero ${install_device} ; then
+ # Change boot device to the harddisk root
+ boot_device="$ofpath"
+ dd if="${grubdir}/core.${imgext}" of="${install_device}" status=noxfer || {
+ echo "Failed to copy Grub to the PReP partition."
+ exit 1
+ }
+ else
+ echo "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:"
+ echo " dd if=/dev/zero of=${install_device}"
+ exit 1
+ fi
+ fi
+
"$nvsetenv" boot-device "$boot_device" || {
echo "$nvsetenv failed."
echo "You will have to set boot-device manually. At the Open Firmware prompt, type:"
diff --git a/util/grub-probe.c b/util/grub-probe.c
index 0d5dac9..3512a79 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -54,6 +54,7 @@ enum {
PRINT_DEVICE,
PRINT_PARTMAP,
PRINT_ABSTRACTION,
+ PRINT_MSDOS_PARTTYPE
};
int print = PRINT_FS;
@@ -221,6 +222,17 @@ probe (const char *path, char *device_name)
free (list);
list = tmp;
}
+ printf ("\n");
+ goto end;
+ }
+
+ if (print == PRINT_MSDOS_PARTTYPE)
+ {
+ if (dev->disk->partition
+ && strcmp(dev->disk->partition->partmap->name, "msdos") == 0)
+ printf ("%02x", dev->disk->partition->msdostype);
+
+ printf ("\n");
goto end;
}
@@ -289,7 +301,7 @@ Probe device information for a given path (or device, if the -d option is given)
\n\
-d, --device given argument is a system device, not a path\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
- -t, --target=(fs|fs_uuid|fs_label|drive|device|partmap|abstraction)\n\
+ -t, --target=(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|msdos_parttype)\n\
print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
@@ -348,6 +360,8 @@ main (int argc, char *argv[])
print = PRINT_PARTMAP;
else if (!strcmp (optarg, "abstraction"))
print = PRINT_ABSTRACTION;
+ else if (!strcmp (optarg, "msdos_parttype"))
+ print = PRINT_MSDOS_PARTTYPE;
else
usage (1);
break;

View file

@ -1,285 +0,0 @@
From: Colin Watson <cjwatson@ubuntu.com>
Subject: Improve devmapper support
Date: 2011-05-18 07:35:47 +0000
=== modified file 'grub-core/kern/emu/getroot.c'
--- a/grub-core/kern/emu/getroot.c 2011-04-21 09:26:29 +0000
+++ b/grub-core/kern/emu/getroot.c 2011-05-18 07:35:47 +0000
@@ -34,6 +34,10 @@
#include <stdint.h>
#include <grub/util/misc.h>
+#ifdef HAVE_DEVICE_MAPPER
+# include <libdevmapper.h>
+#endif
+
#ifdef __GNU__
#include <hurd.h>
#include <hurd/lookup.h>
@@ -634,32 +638,65 @@
}
static int
-grub_util_is_dmraid (const char *os_dev)
+grub_util_is_lvm (const char *os_dev)
{
- if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
- return 1;
- else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
- return 1;
-
- return 0;
+ if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
+ return 0;
+
+#ifdef HAVE_DEVICE_MAPPER
+ {
+ struct dm_tree *tree;
+ uint32_t maj, min;
+ struct dm_tree_node *node = NULL;
+ const char *node_uuid;
+ struct stat st;
+
+ if (stat (os_dev, &st) < 0)
+ return 0;
+
+ tree = dm_tree_create ();
+ if (! tree)
+ {
+ grub_printf ("Failed to create tree\n");
+ grub_dprintf ("hostdisk", "dm_tree_create failed\n");
+ return 0;
+ }
+
+ maj = major (st.st_rdev);
+ min = minor (st.st_rdev);
+
+ if (! dm_tree_add_dev (tree, maj, min))
+ {
+ grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
+ dm_tree_free (tree);
+ return 0;
+ }
+
+ node = dm_tree_find_node (tree, maj, min);
+ if (! node)
+ {
+ grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
+ dm_tree_free (tree);
+ return 0;
+ }
+ node_uuid = dm_tree_node_get_uuid (node);
+ if (! node_uuid)
+ {
+ grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
+ dm_tree_free (tree);
+ return 0;
+ }
+ if (strncmp (node_uuid, "LVM-", 4) != 0)
+ {
+ dm_tree_free (tree);
+ return 0;
+ }
+ dm_tree_free (tree);
+ return 1;
+ }
+#else
+ return 1;
+#endif /* HAVE_DEVICE_MAPPER */
}
int
@@ -671,13 +708,11 @@
return GRUB_DEV_ABSTRACTION_NONE;
/* Check for LVM. */
- if (!strncmp (os_dev, "/dev/mapper/", 12)
- && ! grub_util_is_dmraid (os_dev)
- && strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
+ if (grub_util_is_lvm (os_dev))
return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */
- if (!strncmp (os_dev, "/dev/md", 7))
+ if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
return GRUB_DEV_ABSTRACTION_RAID;
#endif
=== modified file 'grub-core/kern/emu/hostdisk.c'
--- a/grub-core/kern/emu/hostdisk.c 2011-05-09 16:59:35 +0000
+++ b/grub-core/kern/emu/hostdisk.c 2011-05-18 07:35:47 +0000
@@ -24,6 +24,7 @@
#include <grub/err.h>
#include <grub/emu/misc.h>
#include <grub/emu/hostdisk.h>
+#include <grub/emu/getroot.h>
#include <grub/misc.h>
#include <grub/i18n.h>
#include <grub/list.h>
@@ -331,18 +332,23 @@
return GRUB_ERR_NONE;
}
+int
+grub_util_device_is_mapped (const char *dev)
+{
#ifdef HAVE_DEVICE_MAPPER
-static int
-device_is_mapped (const char *dev)
-{
struct stat st;
+ if (!grub_device_mapper_supported ())
+ return 0;
+
if (stat (dev, &st) < 0)
return 0;
return dm_is_dm_major (major (st.st_rdev));
+#else
+ return 0;
+#endif /* HAVE_DEVICE_MAPPER */
}
-#endif /* HAVE_DEVICE_MAPPER */
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
/* FIXME: geom actually gives us the whole container hierarchy.
@@ -418,7 +424,7 @@
# endif /* !defined(HAVE_DIOCGDINFO) */
# ifdef HAVE_DEVICE_MAPPER
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
+ if (grub_util_device_is_mapped (dev)) {
struct dm_task *task = NULL;
grub_uint64_t start, length;
char *target_type, *params, *space;
@@ -1149,6 +1155,54 @@
return ret;
}
+#ifdef HAVE_DEVICE_MAPPER
+static int
+grub_util_get_dm_node_linear_info (const char *dev,
+ int *maj, int *min)
+{
+ struct dm_task *dmt;
+ void *next = NULL;
+ uint64_t length, start;
+ char *target, *params;
+ char *ptr;
+ int major, minor;
+
+ dmt = dm_task_create(DM_DEVICE_TABLE);
+ if (!dmt)
+ return 0;
+
+ if (!dm_task_set_name(dmt, dev))
+ return 0;
+ dm_task_no_open_count(dmt);
+ if (!dm_task_run(dmt))
+ return 0;
+ next = dm_get_next_target(dmt, next, &start, &length,
+ &target, &params);
+ if (grub_strcmp (target, "linear") != 0)
+ return 0;
+ major = grub_strtoul (params, &ptr, 10);
+ if (grub_errno)
+ {
+ grub_errno = GRUB_ERR_NONE;
+ return 0;
+ }
+ if (*ptr != ':')
+ return 0;
+ ptr++;
+ minor = grub_strtoul (ptr, 0, 10);
+ if (grub_errno)
+ {
+ grub_errno = GRUB_ERR_NONE;
+ return 0;
+ }
+ if (maj)
+ *maj = major;
+ if (min)
+ *min = minor;
+ return 1;
+}
+#endif
+
static char *
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
{
@@ -1325,9 +1379,39 @@
node = NULL;
goto devmapper_out;
}
- else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
- {
+ if (strncmp (node_uuid, "LVM-", 4) == 0)
+ {
+ grub_dprintf ("hostdisk", "%s is an LVM\n", path);
+ node = NULL;
+ goto devmapper_out;
+ }
+ if (strncmp (node_uuid, "mpath-", 6) == 0)
+ {
+ /* Multipath partitions have partN-mpath-* UUIDs, and are
+ linear mappings so are handled by
+ grub_util_get_dm_node_linear_info. Multipath disks are not
+ linear mappings and must be handled specially. */
+ grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
+ mapper_name = dm_tree_node_get_name (node);
+ goto devmapper_out;
+ }
+ if (strncmp (node_uuid, "DMRAID-", 7) != 0)
+ {
+ int major, minor;
+ const char *node_name;
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
+
+ if ((node_name = dm_tree_node_get_name (node))
+ && grub_util_get_dm_node_linear_info (node_name,
+ &major, &minor))
+ {
+ if (tree)
+ dm_tree_free (tree);
+ free (path);
+ char *ret = grub_find_device (NULL, (major << 8) | minor);
+ return ret;
+ }
+
node = NULL;
goto devmapper_out;
}
=== modified file 'include/grub/emu/misc.h'
--- a/include/grub/emu/misc.h 2010-12-02 13:26:46 +0000
+++ b/include/grub/emu/misc.h 2011-05-18 07:35:47 +0000
@@ -54,6 +54,8 @@
char *grub_make_system_path_relative_to_its_root (const char *path)
__attribute__ ((warn_unused_result));
+int
+grub_util_device_is_mapped (const char *dev);
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));

View file

@ -1,29 +0,0 @@
From fa200c2b59c0b8346466b503cd6ac80e331c9277 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <pjones@fedoraproject.org>
Date: Thu, 8 Mar 2012 13:43:39 -0800
Subject: [GRUB2] remove serial.mod test from 00_header (#748964)
This test doesn't belong here, upstream has removed it, and it
was blocking serial installs from working.
---
util/grub.d/00_header.in | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 5c4d9db..a1a75aa 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -113,10 +113,6 @@ for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
done
if [ "x$serial" = x1 ]; then
- if ! test -e "${GRUB_PREFIX}/serial.mod" ; then
- echo "Serial terminal not available on this platform." >&2 ; exit 1
- fi
-
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
GRUB_SERIAL_COMMAND=serial
--
1.7.7.6

View file

@ -1,63 +0,0 @@
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Subject: Don't accept text modes on EFI when booting Linux.
Date: 2011-08-16 16:11:10 +0200
------------------------------------------------------------
revno: 3402
committer: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
branch nick: grub
timestamp: Tue 2011-08-16 16:11:10 +0200
message:
Don't accept text modes on EFI when booting Linux.
* grub-core/loader/i386/linux.c (ACCEPTS_PURE_TEXT): New define.
(grub_linux_boot) [!ACCEPTS_PURE_TEXT]: Restrict to graphics modes.
diff:
=== modified file 'grub-core/loader/i386/linux.c'
--- a/grub-core/loader/i386/linux.c 2011-05-18 07:56:33 +0000
+++ b/grub-core/loader/i386/linux.c 2011-08-16 14:11:10 +0000
@@ -45,15 +45,18 @@
#include <grub/efi/efi.h>
#define HAS_VGA_TEXT 0
#define DEFAULT_VIDEO_MODE "auto"
+#define ACCEPTS_PURE_TEXT 0
#elif defined (GRUB_MACHINE_IEEE1275)
#include <grub/ieee1275/ieee1275.h>
#define HAS_VGA_TEXT 0
#define DEFAULT_VIDEO_MODE "text"
+#define ACCEPTS_PURE_TEXT 1
#else
#include <grub/i386/pc/vbe.h>
#include <grub/i386/pc/console.h>
#define HAS_VGA_TEXT 1
#define DEFAULT_VIDEO_MODE "text"
+#define ACCEPTS_PURE_TEXT 1
#endif
#define GRUB_LINUX_CL_OFFSET 0x1000
@@ -483,12 +486,22 @@
tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
if (! tmp)
return grub_errno;
+#if ACCEPTS_PURE_TEXT
err = grub_video_set_mode (tmp, 0, 0);
+#else
+ err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
+#endif
grub_free (tmp);
}
else
- err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
-
+ {
+#if ACCEPTS_PURE_TEXT
+ err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
+#else
+ err = grub_video_set_mode (DEFAULT_VIDEO_MODE,
+ GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
+#endif
+ }
if (err)
{
grub_print_error ();

View file

@ -15,6 +15,10 @@
%global efi %{ix86} x86_64 ia64 %global efi %{ix86} x86_64 ia64
%endif %endif
%global tarversion 2.00~beta2
%undefine _missing_build_ids_terminate_build
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 1.99 Version: 1.99
@ -25,24 +29,15 @@ Group: System Environment/Base
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
Obsoletes: grub < 1:0.98 Obsoletes: grub < 1:0.98
Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz
Source1: 90_persistent Source1: 90_persistent
Source2: grub.default Source2: grub.default
Source3: README.Fedora Source3: README.Fedora
Patch0: grub-1.99-handle-fwrite-return.patch Patch0: grub-1.99-handle-fwrite-return.patch
Patch1: grub-1.99-grub_test_assert_printf.patch Patch1: grub-1.99-grub_test_assert_printf.patch
Patch2: grub-1.99-just-say-linux.patch Patch2: grub-1.99-just-say-linux.patch
Patch3: grub-1.99-Workaround-for-variable-set-but-not-used-issue.patch Patch3: grub2-handle-initramfs-on-xen.patch
Patch4: grub2-handle-initramfs-on-xen.patch
Patch5: grub2-1.99-handle-more-dmraid.patch
Patch6: grub2-gfxpayload-efi.patch
# https://savannah.gnu.org/bugs/index.php?35018
Patch7: grub-1.99-fix_grub-probe_call.patch
Patch8: grub-1.99-handle-newer-autotools.patch
Patch9: grub-1.99-gcc-4.7.0.patch Patch9: grub-1.99-gcc-4.7.0.patch
Patch10: grub2-1.99-remove-serial.mod-test-from-00_header-748964.patch
Patch11: grub-1.99-prep_install_v2.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -64,7 +59,7 @@ Requires(post): dracut
# TODO: ppc # TODO: ppc
# ExclusiveArch: %{ix86} x86_64 %{sparc} # ExclusiveArch: %{ix86} x86_64 %{sparc}
ExcludeArch: s390 s390x ExcludeArch: s390 s390x ppc
%description %description
The GRand Unified Bootloader (GRUB) is a highly configurable and customizable The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
@ -84,34 +79,36 @@ provides support for EFI systems.
%endif %endif
%prep %prep
%setup -T -c -n grub-%{version} %setup -T -c -n grub-%{tarversion}
%ifarch %{efi} %ifarch %{efi}
%setup -D -q -T -a 0 -n grub-%{version} echo foo
cd grub-%{version} %setup -D -q -T -a 0 -n grub-%{tarversion}
echo bar
cd grub-%{tarversion}
cp %{SOURCE3} . cp %{SOURCE3} .
git init git init
git config user.email "pjones@fedoraproject.org" git config user.email "pjones@fedoraproject.org"
git config user.name "Fedora Ninjas" git config user.name "Fedora Ninjas"
git add . git add .
git commit -a -q -m "%{version} baseline." git commit -a -q -m "%{tarversion} baseline."
git am %{patches} git am %{patches}
cd .. cd ..
mv grub-%{version} grub-efi-%{version} mv grub-%{tarversion} grub-efi-%{tarversion}
%endif %endif
%setup -D -q -T -a 0 -n grub-%{version} %setup -D -q -T -a 0 -n grub-%{tarversion}
cd grub-%{version} cd grub-%{tarversion}
cp %{SOURCE3} . cp %{SOURCE3} .
git init git init
git config user.email "pjones@fedoraproject.org" git config user.email "pjones@fedoraproject.org"
git config user.name "Fedora Ninjas" git config user.name "Fedora Ninjas"
git add . git add .
git commit -a -q -m "%{version} baseline." git commit -a -q -m "%{tarversion} baseline."
git am %{patches} git am %{patches}
%build %build
%ifarch %{efi} %ifarch %{efi}
cd grub-efi-%{version} cd grub-efi-%{tarversion}
./autogen.sh ./autogen.sh
%configure \ %configure \
CFLAGS="$(echo $RPM_OPT_FLAGS | sed \ CFLAGS="$(echo $RPM_OPT_FLAGS | sed \
@ -138,14 +135,14 @@ make %{?_smp_mflags}
cd .. cd ..
%endif %endif
cd grub-%{version} cd grub-%{tarversion}
./autogen.sh ./autogen.sh
# -static is needed so that autoconf script is able to link # -static is needed so that autoconf script is able to link
# test that looks for _start symbol on 64 bit platforms # test that looks for _start symbol on 64 bit platforms
%ifarch %{sparc} ppc ppc64 %ifarch %{sparc} ppc64
PLATFORM=ieee1275 %define platform ieee1275
%else %else
PLATFORM=pc %define platform pc
%endif %endif
%configure \ %configure \
CFLAGS="$(echo $RPM_OPT_FLAGS | sed \ CFLAGS="$(echo $RPM_OPT_FLAGS | sed \
@ -157,7 +154,7 @@ PLATFORM=pc
-e 's/-m64//g' \ -e 's/-m64//g' \
-e 's/-fasynchronous-unwind-tables//g' )" \ -e 's/-fasynchronous-unwind-tables//g' )" \
TARGET_LDFLAGS=-static \ TARGET_LDFLAGS=-static \
--with-platform=$PLATFORM \ --with-platform=%{platform} \
--program-transform-name=s,grub,%{name}, \ --program-transform-name=s,grub,%{name}, \
--disable-werror \ --disable-werror \
--sbindir=/sbin --sbindir=/sbin
@ -177,7 +174,7 @@ set -e
rm -fr $RPM_BUILD_ROOT rm -fr $RPM_BUILD_ROOT
%ifarch %{efi} %ifarch %{efi}
cd grub-efi-%{version} cd grub-efi-%{tarversion}
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
mv $RPM_BUILD_ROOT/etc/bash_completion.d/grub $RPM_BUILD_ROOT/etc/bash_completion.d/grub-efi mv $RPM_BUILD_ROOT/etc/bash_completion.d/grub $RPM_BUILD_ROOT/etc/bash_completion.d/grub-efi
sed s,grub/grub-mkconfig_lib,grub-efi/grub-mkconfig_lib, -i $RPM_BUILD_ROOT/sbin/grub2-efi-mkconfig sed s,grub/grub-mkconfig_lib,grub-efi/grub-mkconfig_lib, -i $RPM_BUILD_ROOT/sbin/grub2-efi-mkconfig
@ -205,7 +202,7 @@ install -m 755 grub.efi $RPM_BUILD_ROOT/boot/efi/EFI/redhat/%{name}-efi/grub.efi
cd .. cd ..
%endif %endif
cd grub-%{version} cd grub-%{tarversion}
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
# Script that makes part of grub.cfg persist across updates # Script that makes part of grub.cfg persist across updates
@ -286,19 +283,18 @@ fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
/etc/bash_completion.d/grub /etc/bash_completion.d/grub
%{_libdir}/%{name} %{_libdir}/grub/*-%{platform}/
%{_datarootdir}/grub/grub-mkconfig_lib %{_datarootdir}/grub/grub-mkconfig_lib
/sbin/%{name}-mkconfig /sbin/%{name}-mkconfig
/sbin/%{name}-mkdevicemap
/sbin/%{name}-mknetdir /sbin/%{name}-mknetdir
/sbin/%{name}-install /sbin/%{name}-install
/sbin/%{name}-probe /sbin/%{name}-probe
/sbin/%{name}-reboot /sbin/%{name}-reboot
/sbin/%{name}-set-default /sbin/%{name}-set-default
%ifarch %{ix86} x86_64 %{sparc} /sbin/%{name}-bios-setup
/sbin/%{name}-setup /sbin/%{name}-ofpathname
%endif /sbin/%{name}-sparc64-setup
%{_bindir}/%{name}-bin2h %{_bindir}/%{name}-mkstandalone
%{_bindir}/%{name}-editenv %{_bindir}/%{name}-editenv
%{_bindir}/%{name}-fstest %{_bindir}/%{name}-fstest
%{_bindir}/%{name}-kbdcomp %{_bindir}/%{name}-kbdcomp
@ -325,28 +321,31 @@ fi
%{_sysconfdir}/sysconfig/grub %{_sysconfdir}/sysconfig/grub
%dir /boot/%{name} %dir /boot/%{name}
%ghost %config(noreplace) /boot/%{name}/grub.cfg %ghost %config(noreplace) /boot/%{name}/grub.cfg
%doc grub-%{version}/COPYING grub-%{version}/INSTALL grub-%{version}/NEWS %doc grub-%{tarversion}/COPYING grub-%{tarversion}/INSTALL
%doc grub-%{version}/README grub-%{version}/THANKS grub-%{version}/TODO %doc grub-%{tarversion}/NEWS grub-%{tarversion}/README
%doc grub-%{version}/ChangeLog grub-%{version}/README.Fedora %doc grub-%{tarversion}/THANKS grub-%{tarversion}/TODO
%doc grub-%{tarversion}/ChangeLog grub-%{tarversion}/README.Fedora
%exclude %{_mandir} %exclude %{_mandir}
%{_infodir}/grub2* %{_infodir}/grub2*
%attr(0755,root,root)/%{_datarootdir}/grub/
%ifarch %{efi} %ifarch %{efi}
%files efi %files efi
%defattr(-,root,root,-) %defattr(-,root,root,-)
%attr(0755,root,root)/boot/efi/EFI/redhat %attr(0755,root,root)/boot/efi/EFI/redhat
/etc/bash_completion.d/grub-efi /etc/bash_completion.d/grub-efi
%{_libdir}/grub2-efi/ %{_libdir}/grub/%{_arch}-efi
%{_datarootdir}/grub/grub-mkconfig_lib %{_datarootdir}/grub/grub-mkconfig_lib
/sbin/grub2-efi-mkconfig /sbin/grub2-efi-mkconfig
/sbin/grub2-efi-mkdevicemap
/sbin/grub2-efi-mknetdir /sbin/grub2-efi-mknetdir
/sbin/grub2-efi-install /sbin/grub2-efi-install
/sbin/grub2-efi-probe /sbin/grub2-efi-probe
/sbin/grub2-efi-reboot /sbin/grub2-efi-reboot
/sbin/grub2-efi-set-default /sbin/grub2-efi-set-default
#/sbin/grub2-efi-setup /sbin/grub2-efi-bios-setup
%{_bindir}/grub2-efi-bin2h /sbin/grub2-efi-ofpathname
/sbin/grub2-efi-sparc64-setup
%{_bindir}/grub2-efi-mkstandalone
%{_bindir}/grub2-efi-editenv %{_bindir}/grub2-efi-editenv
%{_bindir}/grub2-efi-fstest %{_bindir}/grub2-efi-fstest
%{_bindir}/grub2-efi-kbdcomp %{_bindir}/grub2-efi-kbdcomp
@ -371,19 +370,19 @@ fi
%config(noreplace) %{_sysconfdir}/grub2-efi.cfg %config(noreplace) %{_sysconfdir}/grub2-efi.cfg
%config(noreplace) %{_sysconfdir}/default/grub %config(noreplace) %{_sysconfdir}/default/grub
%{_sysconfdir}/sysconfig/grub %{_sysconfdir}/sysconfig/grub
%dir /boot/efi/EFI/redhat/grub2-efi
%ghost %config(noreplace) /boot/efi/EFI/redhat/grub2-efi/grub.cfg %ghost %config(noreplace) /boot/efi/EFI/redhat/grub2-efi/grub.cfg
%doc grub-%{version}/COPYING grub-%{version}/INSTALL grub-%{version}/NEWS %doc grub-%{tarversion}/COPYING grub-%{tarversion}/INSTALL
%doc grub-%{version}/README grub-%{version}/THANKS grub-%{version}/TODO %doc grub-%{tarversion}/NEWS grub-%{tarversion}/README
%doc grub-%{version}/ChangeLog grub-%{version}/README.Fedora %doc grub-%{tarversion}/THANKS grub-%{tarversion}/TODO
%doc grub-%{tarversion}/ChangeLog grub-%{tarversion}/README.Fedora
%exclude %{_mandir} %exclude %{_mandir}
%{_infodir}/grub2* %{_infodir}/grub2*
%endif %endif
%attr(0755,root,root)/%{_datarootdir}/grub/
%changelog %changelog
* Mon Mar 12 2012 Peter Jones <pjones@redhat.com> - 1.99-18 * Wed Mar 14 2012 Peter Jones <pjones@redhat.com> - 1.99-18
- Handle some missed bits for newer autotools support (patch from khopp) - Rebase from 1.99 to 2.00~beta2
- Handle PReP installation on PPC.
* Wed Mar 07 2012 Peter Jones <pjones@redhat.com> - 1.99-17 * Wed Mar 07 2012 Peter Jones <pjones@redhat.com> - 1.99-17
- Update for newer autotools and gcc 4.7.0 - Update for newer autotools and gcc 4.7.0