Make 1.99~rc1 build on i686...

This commit is contained in:
Peter Jones 2011-03-03 17:08:24 -05:00
parent b2860346f4
commit 1fcd613638
9 changed files with 306 additions and 117 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
grub-1.98.tar.gz
/grub-1.99~rc1.tar.gz

View File

@ -1,17 +0,0 @@
This should ideally be done using transformations.
Alternatively, /boot/grub may be used, no grub's files there should conflict
with grub2 and they both can share the same device.map.
Lubomir Rintel <lkundrak@v3.sk>
--- grub2.orig/include/grub/util/misc.h 2007-11-28 14:10:01.000000000 +0100
+++ grub2/include/grub/util/misc.h 2007-11-28 14:10:20.000000000 +0100
@@ -28,7 +28,7 @@
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub"
#else
-# define DEFAULT_DIRECTORY "/boot/grub"
+# define DEFAULT_DIRECTORY "/boot/grub2"
#endif
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"

View File

@ -1,13 +0,0 @@
diff -uNr grub-1.97.1-orig/util/grub.d/10_linux.in grub-1.97.1/util/grub.d/10_linux.in
--- grub-1.97.1-orig/util/grub.d/10_linux.in 2009-11-09 09:48:16.000000000 -0600
+++ grub-1.97.1/util/grub.d/10_linux.in 2009-12-01 15:28:16.000000000 -0600
@@ -78,7 +78,8 @@
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initrd.img-${alt_version}" \
- "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+ "initrd-${alt_version}.img" "initrd-${alt_version}" \
+ "initramfs-${version}.img" ; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break

View File

@ -1,60 +0,0 @@
--- a/util/getroot.c 2010-03-06 20:51:37.000000000 +0000
+++ b/util/getroot.c 2010-05-28 18:23:19.892788564 +0100
@@ -180,7 +180,8 @@ grub_get_prefix (const char *dir)
static char *
find_root_device (const char *dir __attribute__ ((unused)),
- dev_t dev __attribute__ ((unused)))
+ dev_t dev __attribute__ ((unused))
+ int depth __attribute__ ((unused)))
{
return 0;
}
@@ -188,7 +189,7 @@ find_root_device (const char *dir __attr
#elif ! defined(__CYGWIN__)
static char *
-find_root_device (const char *dir, dev_t dev)
+find_root_device (const char *dir, dev_t dev, int depth)
{
DIR *dp;
char *saved_cwd;
@@ -222,16 +223,27 @@ find_root_device (const char *dir, dev_t
/* Ignore any error. */
continue;
- if (S_ISLNK (st.st_mode))
+ if (S_ISLNK (st.st_mode)) {
+#ifdef __linux__
+ /* If we're in /dev/mapper, follow symbolic links. */
+ if (depth == 1 && strcmp(dir, "mapper") == 0) {
+ if (stat(ent->d_name, &st) == -1)
+ continue;
+ if (S_ISDIR (st.st_mode))
+ continue;
+ }
+#else
/* Don't follow symbolic links. */
continue;
+#endif
+ }
if (S_ISDIR (st.st_mode))
{
/* Find it recursively. */
char *res;
- res = find_root_device (ent->d_name, dev);
+ res = find_root_device (ent->d_name, dev, depth + 1);
if (res)
{
@@ -454,7 +466,7 @@ grub_guess_root_device (const char *dir)
#else
/* This might be truly slow, but is there any better way? */
- os_dev = find_root_device ("/dev", st.st_dev);
+ os_dev = find_root_device ("/dev", st.st_dev, 0);
#endif
#endif /* !__GNU__ */

View File

@ -0,0 +1,167 @@
From e51968bcd089db5efd5e33043e6e23592f696371 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 2 Mar 2011 13:13:44 -0500
Subject: [PATCH] Make get_test_assert() correctly format its output.
The old code gives arguments to a printf function which can't work
correctly, and the compiler complains.
---
grub-core/tests/example_functional_test.c | 2 +-
grub-core/tests/lib/test.c | 88 +++++++++++++++++++++++++++--
include/grub/test.h | 10 ++-
3 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/grub-core/tests/example_functional_test.c b/grub-core/tests/example_functional_test.c
index 5259881..0c69749 100644
--- a/grub-core/tests/example_functional_test.c
+++ b/grub-core/tests/example_functional_test.c
@@ -24,7 +24,7 @@ static void
example_test (void)
{
/* Check if 1st argument is true and report with default error message. */
- grub_test_assert (1 == 1);
+ grub_test_assert (1 == 1, "1 equal 1 expected");
/* Check if 1st argument is true and report with custom error message. */
grub_test_assert (2 == 2, "2 equal 2 expected");
diff --git a/grub-core/tests/lib/test.c b/grub-core/tests/lib/test.c
index 06d78b7..8453d5b 100644
--- a/grub-core/tests/lib/test.c
+++ b/grub-core/tests/lib/test.c
@@ -42,22 +42,75 @@ typedef struct grub_test_failure *grub_test_failure_t;
grub_test_t grub_test_list;
static grub_test_failure_t failure_list;
-static void
-add_failure (const char *file,
- const char *funp,
- grub_uint32_t line, const char *fmt, va_list args)
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line);
+static grub_test_failure_t
+failure_start(const char *file, const char *funp, grub_uint32_t line)
{
grub_test_failure_t failure;
failure = (grub_test_failure_t) grub_malloc (sizeof (*failure));
if (!failure)
- return;
+ return NULL;
failure->file = grub_strdup (file ? : "<unknown_file>");
+ if (!failure->file)
+ {
+ grub_free(failure);
+ return NULL;
+ }
+
failure->funp = grub_strdup (funp ? : "<unknown_function>");
+ if (!failure->funp)
+ {
+ grub_free(failure->file);
+ grub_free(failure);
+ return NULL;
+ }
+
failure->line = line;
- failure->message = grub_xvasprintf (fmt, args);
+ failure->message = NULL;
+
+ return failure;
+}
+
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args);
+static void
+failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args)
+{
+ char *msg = grub_xvasprintf(fmt, args);
+ if (failure->message)
+ {
+ char *oldmsg = failure->message;
+
+ failure->message = grub_xasprintf("%s%s", oldmsg, msg);
+ grub_free(oldmsg);
+ }
+ else
+ {
+ failure->message = msg;
+ }
+}
+
+static void
+failure_append_text(grub_test_failure_t failure, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ failure_append_vtext(failure, fmt, args);
+ va_end(args);
+}
+
+static void
+add_failure (const char *file,
+ const char *funp,
+ grub_uint32_t line, const char *fmt, va_list args)
+{
+ grub_test_failure_t failure = failure_start(file, funp, line);
+ failure_append_text(failure, fmt, args);
grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
}
@@ -100,6 +153,29 @@ grub_test_nonzero (int cond,
}
void
+grub_test_assert_helper (int cond, const char *file, const char *funp,
+ grub_uint32_t line, const char *condstr,
+ const char *fmt, ...)
+{
+ va_list ap;
+ grub_test_failure_t failure;
+
+ if (cond)
+ return;
+
+ failure = failure_start(file, funp, line);
+ failure_append_text(failure, "assert failed: %s ", condstr);
+
+ va_start(ap, fmt);
+
+ failure_append_vtext(failure, fmt, ap);
+
+ va_end(ap);
+
+ grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
+}
+
+void
grub_test_register (const char *name, void (*test_main) (void))
{
grub_test_t test;
diff --git a/include/grub/test.h b/include/grub/test.h
index 336d3b6..77a7598 100644
--- a/include/grub/test.h
+++ b/include/grub/test.h
@@ -53,10 +53,14 @@ void grub_test_nonzero (int cond, const char *file,
__attribute__ ((format (printf, 5, 6)));
/* Macro to fill in location details and an optional error message. */
+void grub_test_assert_helper (int cond, const char *file,
+ const char *func, grub_uint32_t line,
+ const char *condstr, const char *fmt, ...)
+ __attribute__ ((format (printf, 6, 7)));
+
#define grub_test_assert(cond, ...) \
- grub_test_nonzero(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
- ## __VA_ARGS__, \
- "assert failed: %s", #cond)
+ grub_test_assert_helper(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
+ #cond, ## __VA_ARGS__);
/* Macro to define a unit test. */
#define GRUB_UNIT_TEST(name, funp) \
--
1.7.3.1

View File

@ -0,0 +1,59 @@
From de1c35857ee803653d3ffd94eb5d3f3b45ab000e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 2 Mar 2011 11:29:28 -0500
Subject: [PATCH] Don't ignore fwrite's return since we build with -Wno-unused.
---
util/grub-mklayout.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c
index 04501cb..beea3eb 100644
--- a/util/grub-mklayout.c
+++ b/util/grub-mklayout.c
@@ -324,6 +324,7 @@ write_file (FILE *out, struct grub_keyboard_layout *layout)
{
grub_uint32_t version;
unsigned i;
+ int rc;
version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION);
@@ -342,10 +343,10 @@ write_file (FILE *out, struct grub_keyboard_layout *layout)
layout->keyboard_map_shift_l3[i]
= grub_cpu_to_le32(layout->keyboard_map_shift_l3[i]);
- fwrite (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC, 1,
+ rc = fwrite (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC, 1,
GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE, out);
- fwrite (&version, sizeof (version), 1, out);
- fwrite (layout, 1, sizeof (*layout), out);
+ rc = fwrite (&version, sizeof (version), 1, out);
+ rc = fwrite (layout, 1, sizeof (*layout), out);
}
static void
--
1.7.3.1
diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c
index 513af47..308f8e9 100644
--- a/util/grub-menulst2cfg.c
+++ b/util/grub-menulst2cfg.c
@@ -34,6 +34,7 @@ main (int argc, char **argv)
size_t bufsize = 0;
char *suffix = xstrdup ("");
int suffixlen = 0;
+ int rc;
if (argc >= 2 && argv[1][0] == '-')
{
@@ -111,7 +112,7 @@ main (int argc, char **argv)
if (entryname)
fprintf (out, "}\n\n");
- fwrite (suffix, 1, suffixlen, out);
+ rc = fwrite (suffix, 1, suffixlen, out);
free (buf);
free (suffix);

View File

@ -0,0 +1,31 @@
From 755da11214d4695fbf8245d6d591ae633cadc791 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 2 Mar 2011 13:47:04 -0500
Subject: [PATCH] Get rid of unused variable in zfs.
---
grub-core/fs/zfs/zfs.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index 5b575f3..3a94d88 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -837,14 +837,12 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian,
name))
{
struct zap_leaf_array *la;
- grub_uint8_t *ip;
if (le->le_int_size != 8 || le->le_value_length != 1)
return grub_error (GRUB_ERR_BAD_FS, "invalid leaf chunk entry");
/* get the uint64_t property value */
la = &ZAP_LEAF_CHUNK (l, blksft, le->le_value_chunk).l_array;
- ip = la->la_array;
*value = grub_be_to_cpu64 (la->la_array64);
--
1.7.3.1

View File

@ -13,20 +13,21 @@
Name: grub2
Epoch: 1
Version: 1.98
Release: 4%{?dist}
Version: 1.99
%define filever 1.99~rc1
Release: 0.1%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
License: GPLv3+
URL: http://www.gnu.org/software/grub/
Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{version}.tar.gz
Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{filever}.tar.gz
Source1: 90_persistent
Source2: grub.default
Source3: README.Fedora
Patch0: grub-1.95-grubdir.patch
Patch1: grub-1.97.1-initramfs.patch
Patch2: grub-1.98-follow-dev-mapper-symlinks.patch
Patch0: grub-1.99-handle-fwrite-return.patch
Patch1: grub-1.99-unused-variable.patch
Patch2: grub-1.99-grub_test_assert_printf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -38,14 +39,15 @@ BuildRequires: /usr/lib64/crt1.o glibc-static
%else
BuildRequires: /usr/lib/crt1.o glibc-static
%endif
BuildRequires: autoconf automake gettext-devel
BuildRequires: autoconf automake autogen device-mapper-devel
BuildRequires: freetype-devel gettext-devel git
# grubby
Requires: gettext
Requires(pre): dracut
Requires(post): dracut
# TODO: ppc
ExclusiveArch: %{ix86} x86_64 %{sparc}
# ExclusiveArch: %{ix86} x86_64 %{sparc}
%description
This is the second version of the GRUB (Grand Unified Bootloader),
@ -61,11 +63,13 @@ file that is part of this package's documentation for more information.
%prep
%setup -q -n grub-%{version}
%patch0 -p1 -b .grubdir
%patch1 -p1 -b .initramfs
%patch2 -p1 -b .follow-symlinks
%setup -q -n grub-%{filever}
git init
git config user.email "pjones@fedoraproject.org"
git config user.name "Fedora Ninjas"
git add .
git commit -a -q -m "%{version} baseline."
git am %{patches}
# README.Fedora
cp %{SOURCE3} .
@ -75,7 +79,12 @@ cp %{SOURCE3} .
sh autogen.sh
# -static is needed so that autoconf script is able to link
# test that looks for _start symbol on 64 bit platforms
%configure TARGET_LDFLAGS=-static \
%configure CFLAGS="$(echo $RPM_OPT_FLAGS | sed \
-e 's/-fstack-protector//g' \
-e 's/--param=ssp-buffer-size=4//g' \
-e 's/-mregparm=3/-mregparm=4//g' \
-e 's/-fasynchronous-unwind-tables//g' )" \
TARGET_LDFLAGS=-static \
%ifarch %{sparc}
--with-platform=ieee1275 \
%else
@ -121,11 +130,12 @@ do
# install -m 755 -D $BASE$EXT $TGT
done
mv $RPM_BUILD_ROOT%{_infodir}/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info
rm $RPM_BUILD_ROOT%{_infodir}/dir
# Defaults
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub
%find_lang grub
%clean
rm -rf $RPM_BUILD_ROOT
@ -143,9 +153,15 @@ BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
/sbin/grubby --remove-kernel=/boot/%{name}/core.img
# Add core.img as multiboot kernel to GRUB Legacy menu
/sbin/grubby --add-kernel=/boot/%{name}/core.img --title="GNU GRUB 2, (%{version})"
if [ "$1" = 1 ]; then
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || :
fi
%preun
if [ "$1" = 0 ]; then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || :
fi
exec >/dev/null
/sbin/grubby --remove-kernel=/boot/%{name}/core.img
# XXX Ugly
@ -167,33 +183,38 @@ exec >/dev/null 2>&1
%{name}-mkconfig -o /boot/grub2/grub.cfg
%files -f grub.lang
%files
%defattr(-,root,root,-)
/etc/bash_completion.d/grub
%{_libdir}/%{name}
%{_libdir}/grub/
%{_sbindir}/%{name}-mkconfig
%{_sbindir}/%{name}-mkdevicemap
%{_sbindir}/%{name}-mknetdir
%{_sbindir}/%{name}-install
%{_sbindir}/%{name}-probe
%{_sbindir}/%{name}-setup
%{_sbindir}/%{name}-mkconfig
%{_sbindir}/%{name}-reboot
%{_sbindir}/%{name}-set-default
%{_bindir}/%{name}-mkimage
%{_bindir}/%{name}-mkelfimage
%{_sbindir}/%{name}-setup
%{_bindir}/%{name}-bin2h
%{_bindir}/%{name}-editenv
%{_bindir}/%{name}-fstest
%{_bindir}/%{name}-kbdcomp
%{_bindir}/%{name}-menulst2cfg
# %{_bindir}/%{name}-mkelfimage
%{_bindir}/%{name}-mkfont
%{_bindir}/%{name}-bin2h
%{_bindir}/%{name}-mkisofs
%{_bindir}/%{name}-mklayout
%{_bindir}/%{name}-mkimage
# %{_bindir}/%{name}-mkisofs
%{_bindir}/%{name}-mkpasswd-pbkdf2
%{_bindir}/%{name}-mkrelpath
%{_bindir}/%{name}-script-check
%ifnarch %{sparc}
%{_bindir}/%{name}-mkrescue
%endif
%ifarch %{sparc}
%{_sbindir}/%{name}-ofpathname
%endif
%{_bindir}/%{name}-script-check
%dir %{_sysconfdir}/grub.d
%config %{_sysconfdir}/grub.d/??_*
%{_sysconfdir}/grub.d/README
@ -205,8 +226,7 @@ exec >/dev/null 2>&1
%config(noreplace) /boot/%{name}/grub.cfg
%doc COPYING INSTALL NEWS README THANKS TODO ChangeLog README.Fedora
%exclude %{_mandir}
%{_infodir}/grub2*
%changelog
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.98-4

View File

@ -1 +1,2 @@
c0bcf60e524739bb64e3a2d4e3732a59 grub-1.98.tar.gz
fd602ffaada5ba7939d0ea47091841a5 grub-1.99~rc1.tar.gz