Initial import

This commit is contained in:
Lubomir Rintel 2008-08-27 08:07:28 +00:00
parent c8e11958aa
commit 0e50f1f9a3
16 changed files with 821 additions and 0 deletions

View file

@ -0,0 +1 @@
grub2.tar.gz

36
90_persistent Normal file
View file

@ -0,0 +1,36 @@
#! /bin/sh -e
# update-grub helper script.
# Copyright (C) 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/>.
# The output of this script is copied from part of grub.cfg
# that correspond to itself. The achievement is that user can
# modify that part of grub.cfg directly, and it will be persistent
# across update-grub runs.
transform="s&^&&;s,grub,grub2,"
ME=$(echo $0 |sed 's,/,\\/,g')
GRUBCFG=/boot/`echo grub | sed ${transform}`/grub.cfg
# Exit gracefully if there's no configuration file yet
[ -f ${GRUBCFG} ] || exit 0
awk "
BEGIN {echo = 0}
/### BEGIN $ME ###/ {echo = 1; next}
/### END $ME ###/ {echo = 0; next}
{if (echo) print}
" ${GRUBCFG}

17
grub-1.95-grubdir.patch Normal file
View file

@ -0,0 +1,17 @@
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"

52
grub-1.96-garbage.patch Normal file
View file

@ -0,0 +1,52 @@
http://lists.gnu.org/archive/html/grub-devel/2008-04/msg00079.html
Self-explainable. Make update-grub ignore rpm leftover files and VIM
swap files.
2008-04-15 Lubomir Kundrak <lkundrak@redhat.com>
* util/update-grub.in: replace the junk file switch with
unconditional call to grub_file_is_not_garbage
* util/update-grub_lib.in (grub_file_is_not_garbage): ignore
also rpm leftover files and editor backup files
diff -urp grub-1.96.orig/util/update-grub.in grub-1.96/util/update-grub.in
--- grub-1.96.orig/util/update-grub.in 2008-04-15 00:16:12.000000000 +0200
+++ grub-1.96/util/update-grub.in 2008-04-15 00:17:06.000000000 +0200
@@ -145,18 +145,12 @@ cat << EOF
EOF
for i in ${update_grub_dir}/* ; do
- case "$i" in
- # emacsen backup files. FIXME: support other editors
- *~) ;;
- *)
- if grub_file_is_not_garbage "$i" && test -x "$i" ; then
- echo
- echo "### BEGIN $i ###"
- "$i"
- echo "### END $i ###"
- fi
- ;;
- esac
+ if grub_file_is_not_garbage "$i" && test -x "$i" ; then
+ echo
+ echo "### BEGIN $i ###"
+ "$i"
+ echo "### END $i ###"
+ fi
done
# none of the children aborted with error, install the new grub.cfg
diff -urp grub-1.96.orig/util/update-grub_lib.in grub-1.96/util/update-grub_lib.in
--- grub-1.96.orig/util/update-grub_lib.in 2008-04-15 00:16:12.000000000 +0200
+++ grub-1.96/util/update-grub_lib.in 2008-04-15 00:15:04.000000000 +0200
@@ -115,6 +115,8 @@ grub_file_is_not_garbage ()
if test -f "$1" ; then
case "$1" in
*.dpkg-dist|*.dpkg-old|*.dpkg-tmp) return 1 ;; # debian dpkg
+ *.rpmnew|*.rpmsave) return 1 ;; # Fedora rpm
+ *.bak|*~|.*.swp) return 1 ;; # backup and swap files from editors
esac
else
return 1

17
grub-1.97-cfgmode.patch Normal file
View file

@ -0,0 +1,17 @@
The configuration file can potentially contain sensitive data, ...
well, passwords are not yet implemented.
Lubomir Rintel <lkundrak@v3.sk>
diff -urp grub2.orig/util/update-grub.in grub2/util/update-grub.in
--- grub2.orig/util/update-grub.in 2008-08-07 21:58:17.000000000 +0200
+++ grub2/util/update-grub.in 2008-08-07 22:01:44.000000000 +0200
@@ -170,7 +170,7 @@ exec > ${grub_cfg}.new
# Allow this to fail, since /boot/grub/ might need to be fatfs to support some
# firmware implementations (e.g. OFW or EFI).
-chmod 444 ${grub_cfg}.new || true
+chmod 600 ${grub_cfg}.new || true
echo "Updating ${grub_cfg} ..." >&2

36
grub-1.98-linuxsort.patch Normal file
View file

@ -0,0 +1,36 @@
Until we're able to decide which kernel to make default (e.g with grubby),
pick the most recent one.
Lubomir Rintel <lkundrak@v3.sk>
Index: util/grub.d/10_linux.in
===================================================================
--- util/grub.d/10_linux.in (revision 1797)
+++ util/grub.d/10_linux.in (working copy)
@@ -82,23 +82,9 @@
return $?
}
-find_latest ()
-{
- local a=""
- for i in $@ ; do
- if test_gt "$i" "$a" ; then
- a="$i"
- fi
- done
- echo "$a"
-}
-
-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
- done`
-
-while [ "x$list" != "x" ] ; do
- linux=`find_latest $list`
+ls -c /boot/vmlinu[xz]-* /vmlinu[xz]-* 2>/dev/null |while read linux
+do
+ grub_file_is_not_garbage "$linux" || continue
echo "Found linux image: $linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`

22
grub-1.98-os.patch Normal file
View file

@ -0,0 +1,22 @@
We're not GNU/Linux. Tell them.
Lubomir Rintel <lkundrak@v3.sk>
diff -urp grub2.orig/util/grub.d/10_linux.in grub2/util/grub.d/10_linux.in
--- grub2.orig/util/grub.d/10_linux.in 2008-08-08 07:12:30.000000000 +0200
+++ grub2/util/grub.d/10_linux.in 2008-08-08 07:12:53.000000000 +0200
@@ -23,11 +23,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
-if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
- OS=GNU/Linux
-else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
-fi
+OS=$(sed 's/ release.*//' /etc/redhat-release)
+[ -z "$OS" ] && OS=$(uname -o)
+[ -z "$OS" ] && OS=Linux
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.

View file

@ -0,0 +1,82 @@
This adds a section to the configuration file that persists the updates,
so that it's not only grub2-update itself that decides what's in the
configuration.
Lubomir Rintel <lkundrak@v3.sk>
diff -Nurp grub2.orig/conf/common.rmk grub2/conf/common.rmk
--- grub2.orig/conf/common.rmk 2008-08-07 21:37:16.000000000 +0200
+++ grub2/conf/common.rmk 2008-08-08 07:14:01.000000000 +0200
@@ -123,6 +123,12 @@ CLEANFILES += update-grub_lib
update-grub_SCRIPTS = 00_header 10_linux 10_hurd 10_windows 30_os-prober 40_custom
CLEANFILES += $(update-grub_SCRIPTS)
+90_persistent: util/grub.d/90_persistent.in config.status
+ ./config.status --file=$@:$<
+ chmod +x $@
+update-grub_SCRIPTS += 90_persistent
+CLEANFILES += 90_persistent
+
update-grub_DATA += util/grub.d/README
diff -Nurp grub2.orig/util/grub.d/90_persistent.in grub2/util/grub.d/90_persistent.in
--- grub2.orig/util/grub.d/90_persistent.in 1970-01-01 01:00:00.000000000 +0100
+++ grub2/util/grub.d/90_persistent.in 2008-08-08 07:14:01.000000000 +0200
@@ -0,0 +1,37 @@
+#! /bin/sh -e
+
+# update-grub helper script.
+# Copyright (C) 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/>.
+
+# The output of this script is copied from part of grub.cfg
+# that correspond to itself. The achievement is that user can
+# modify that part of grub.cfg directly, and it will be persistent
+# across update-grub runs.
+
+transform="@program_transform_name@"
+
+ME=$(echo $0 |sed 's,/,\\/,g')
+GRUBCFG=/boot/`echo grub | sed ${transform}`/grub.cfg
+
+# Exit gracefully if there's no configuration file yet
+[ -f ${GRUBCFG} ] || exit 0
+
+awk "
+ BEGIN {echo = 0}
+ /### BEGIN $ME ###/ {echo = 1; next}
+ /### END $ME ###/ {echo = 0; next}
+ {if (echo) print}
+" ${GRUBCFG}
diff -Nurp grub2.orig/util/update-grub.in grub2/util/update-grub.in
--- grub2.orig/util/update-grub.in 2008-08-08 07:13:41.000000000 +0200
+++ grub2/util/update-grub.in 2008-08-08 07:14:01.000000000 +0200
@@ -176,11 +176,12 @@ echo "Updating ${grub_cfg} ..." >&2
cat << EOF
#
-# DO NOT EDIT THIS FILE
-#
-# It is automatically generated by $0 using templates
+# This is automatically generated by $0 using templates
# from ${update_grub_dir} and settings from ${sysconfdir}/default/grub
#
+# If you want your changes to persist across updates, add them
+# to 90_persistent section
+#
EOF
for i in ${update_grub_dir}/* ; do

View file

@ -0,0 +1,59 @@
According to POSIX memmove and memcpy can actually be macros or whatever
(IIRC). We'd better not play with those in code that uses libc's headers
and is to be linked with libc.
2008-08-08 Lubomir Rintel <lkundrak@fedoraproject.org>
* include/grub/misc.h: Surround memmove and memcpy prototypes with
#ifndef GRUB_UTIL
* kern/misc.c: Surround memmove, memcpy and memset prototypes with
#ifndef GRUB_UTIL
Index: kern/misc.c
===================================================================
--- kern/misc.c (revision 1797)
+++ kern/misc.c (working copy)
@@ -44,11 +44,15 @@
return dest;
}
+#ifdef GRUB_UTIL
+#include <string.h>
+#else
void *memmove (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
/* GCC emits references to memcpy() for struct copies etc. */
void *memcpy (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
+#endif
char *
grub_strcpy (char *dest, const char *src)
@@ -514,8 +518,10 @@
return s;
}
+#ifndef GRUB_UTIL
void *memset (void *s, int c, grub_size_t n)
__attribute__ ((alias ("grub_memset")));
+#endif
grub_size_t
grub_strlen (const char *s)
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h (revision 1797)
+++ include/grub/misc.h (working copy)
@@ -39,8 +39,12 @@
char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);
/* Prototypes for aliases. */
+#ifdef GRUB_UTIL
+#include <string.h>
+#else
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
+#endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);

162
grub-1.98-transform.patch Normal file
View file

@ -0,0 +1,162 @@
Transformations. Anyone, please tell upstream it's useful not to have
them half-baked. This is so that we do not conflict with grub.
Lubomir Rintel <lkundrak@v3.sk>
diff -urp grub2.orig/Makefile.in grub2/Makefile.in
--- grub2.orig/Makefile.in 2008-08-07 21:37:29.000000000 +0200
+++ grub2/Makefile.in 2008-08-08 07:43:10.000000000 +0200
@@ -215,12 +215,12 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
done
- $(mkinstalldirs) $(DESTDIR)$(libdir)/grub
+ $(mkinstalldirs) $(DESTDIR)$(libdir)/`echo grub | sed '$(transform)'`
@list='$(lib_DATA)'; \
for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,'`"; \
- $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
+ $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/`echo grub | sed '$(transform)'`/$$dest; \
done
install-strip:
diff -urp grub2.orig/util/grub.d/00_header.in grub2/util/grub.d/00_header.in
--- grub2.orig/util/grub.d/00_header.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/grub.d/00_header.in 2008-08-08 07:43:10.000000000 +0200
@@ -23,7 +23,7 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
# Do this as early as possible, since other commands might depend on it.
# (e.g. the `font' command might need lvm or raid modules)
diff -urp grub2.orig/util/grub.d/10_hurd.in grub2/util/grub.d/10_hurd.in
--- grub2.orig/util/grub.d/10_hurd.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/grub.d/10_hurd.in 2008-08-08 07:44:29.000000000 +0200
@@ -16,10 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+transform="@program_transform_name@"
+
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub |sed ${transform}`/update-grub_lib
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU
diff -urp grub2.orig/util/grub.d/10_linux.in grub2/util/grub.d/10_linux.in
--- grub2.orig/util/grub.d/10_linux.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/grub.d/10_linux.in 2008-08-08 07:43:10.000000000 +0200
@@ -16,10 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+transform="@program_transform_name@"
+
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
diff -urp grub2.orig/util/grub.d/10_windows.in grub2/util/grub.d/10_windows.in
--- grub2.orig/util/grub.d/10_windows.in 2008-08-07 21:37:27.000000000 +0200
+++ grub2/util/grub.d/10_windows.in 2008-08-08 07:44:13.000000000 +0200
@@ -16,10 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+transform="@program_transform_name@"
+
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub |sed ${transform}`/update-grub_lib
case "`uname 2>/dev/null`" in
CYGWIN*) ;;
diff -urp grub2.orig/util/i386/pc/grub-install.in grub2/util/i386/pc/grub-install.in
--- grub2.orig/util/i386/pc/grub-install.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/i386/pc/grub-install.in 2008-08-08 07:43:10.000000000 +0200
@@ -36,7 +36,7 @@ grub_mkimage=${bindir}/`echo grub-mkimag
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
rootdir=
-grub_prefix=`echo /boot/grub | sed ${transform}`
+grub_prefix=/boot/`echo grub | sed ${transform}`
modules=
install_device=
@@ -118,7 +118,7 @@ for option in "$@"; do
done
# for make_system_path_relative_to_its_root()
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
if test "x$install_device" = x; then
echo "install_device not specified." 1>&2
diff -urp grub2.orig/util/powerpc/ieee1275/grub-mkrescue.in grub2/util/powerpc/ieee1275/grub-mkrescue.in
--- grub2.orig/util/powerpc/ieee1275/grub-mkrescue.in 2008-08-07 21:37:27.000000000 +0200
+++ grub2/util/powerpc/ieee1275/grub-mkrescue.in 2008-08-08 07:43:10.000000000 +0200
@@ -100,7 +100,7 @@ grub.img Raw 'UNIX' 'tbxi'
EOF
iso_dir=`mktemp -d`
-boot_dir=${iso_dir}/boot/grub
+boot_dir=${iso_dir}/boot/`echo grub | sed ${transform}`
mkdir ${iso_dir}/boot
mkdir ${boot_dir}
core_img=${boot_dir}/grub.img
diff -urp grub2.orig/util/update-grub.in grub2/util/update-grub.in
--- grub2.orig/util/update-grub.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/update-grub.in 2008-08-08 07:43:10.000000000 +0200
@@ -23,7 +23,7 @@ exec_prefix=@exec_prefix@
sbindir=@sbindir@
libdir=@libdir@
sysconfdir=@sysconfdir@
-grub_prefix=`echo /boot/grub | sed ${transform}`
+grub_prefix=/boot/`echo /grub | sed ${transform}`
grub_cfg=${grub_prefix}/grub.cfg
update_grub_dir=${sysconfdir}/grub.d
@@ -65,7 +65,7 @@ for option in "$@"; do
esac
done
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
if [ "x$EUID" = "x" ] ; then
EUID=`id -u`
@@ -107,7 +107,7 @@ fi
mkdir -p ${grub_prefix}
if test -e ${grub_prefix}/device.map ; then : ; else
- grub-mkdevicemap
+ ${grub_mkdevicemap}
fi
# Device containing our userland. Typically used for root= parameter.
diff -urp grub2.orig/util/update-grub_lib.in grub2/util/update-grub_lib.in
--- grub2.orig/util/update-grub_lib.in 2008-08-07 21:37:28.000000000 +0200
+++ grub2/util/update-grub_lib.in 2008-08-08 07:43:10.000000000 +0200
@@ -145,7 +145,8 @@ prepare_grub_to_access_device ()
font_path ()
{
- for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
+ for dir in ${pkgdatadir} ${pkgdatadir}/`echo grub | sed ${transform}` \
+ /boot/`echo grub | sed ${transform}`; do
# FIXME: We prefer ascii because loading complete fonts is too slow (and
# we don't yet provide the gettext magic that would make unicode useful).
for basename in ascii unicode unifont ; do

1
grub.default Normal file
View file

@ -0,0 +1 @@
GRUB_CMDLINE_LINUX="quiet rhgb"

30
grub2-dlsym-v4.patch Normal file
View file

@ -0,0 +1,30 @@
2008-05-07: Lubomir Rintel <lkundrak@fedoraproject.org>
* kern/dl.c (grub_dl_resolve_symbols): Let the
grub_gdb_trapvec symbol be resolved correctly (instead of 0).
--- grub2/kern/dl.c 2008-01-26 21:34:58.000000000 +0100
+++ grub2-gdb/kern/dl.c 2008-05-07 09:27:08.000000000 +0200
@@ -352,16 +352,18 @@ grub_dl_resolve_symbols (grub_dl_t mod,
{
case STT_NOTYPE:
/* Resolve a global symbol. */
- if (sym->st_name != 0 && sym->st_shndx == 0)
+ if (sym->st_name == 0)
+ break;
+
+ if (sym->st_shndx == 0) /* external */
{
sym->st_value = (Elf_Addr) grub_dl_resolve_symbol (name);
if (! sym->st_value)
return grub_error (GRUB_ERR_BAD_MODULE,
"the symbol `%s' not found", name);
- }
- else
- sym->st_value = 0;
break;
+ }
+ /* nonexternal, same as STT_OBJECT */
case STT_OBJECT:
sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod,

View file

@ -0,0 +1,38 @@
2008-05-07: Lubomir Rintel <lkundrak@fedoraproject.org>
* genmk.rb: replace strip with objcopy, so unstripped files are
left untouched for debugging purposes.
diff -urp grub2.orig/genmk.rb grub2/genmk.rb
--- grub2.orig/genmk.rb 2008-08-07 21:37:29.000000000 +0200
+++ grub2/genmk.rb 2008-08-07 23:31:19.000000000 +0200
@@ -101,10 +101,11 @@ class PModule
mod_obj = mod_src.suffix('o')
defsym = 'def-' + @name.suffix('lst')
undsym = 'und-' + @name.suffix('lst')
+ exec = @name.suffix('elf')
mod_name = File.basename(@name, '.mod')
symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
- "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
+ "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} #{exec}
ifneq ($(#{prefix}_EXPORTS),no)
CLEANFILES += #{defsym}
DEFSYMFILES += #{defsym}
@@ -112,11 +113,14 @@ endif
MOSTLYCLEANFILES += #{deps_str}
UNDSYMFILES += #{undsym}
-#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
+#{@name}: #{exec}
+ -rm -f $@
+ $(OBJCOPY) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $^ $@
+
+#{exec}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
-rm -f $@
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
- $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
-rm -f $@

266
grub2.spec Normal file
View file

@ -0,0 +1,266 @@
# Modules always contain just 32-bit code
%define _libdir %{_exec_prefix}/lib
# 64bit machines use 32bit boot loader
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then)
%ifarch x86_64
%define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu}
%endif
# Hack to include debuginfo for files, that find-debuginfo.sh wouldn't
# have spot, because they're either no longer ELF images, such as
# boot images, or are brutally and insensitively stripped, such as
# modules. See %%install.
# It's certainly not the nicest thing you've ever seen.
# THAT IS NOT MY FAULT.
# We do not use find-debuginfo.sh -o here, as it's not supported in RHEL5
%define __debug_install_post \
\
# Gather debuginfo as usual \
/usr/lib/rpm/find-debuginfo.sh \\\
%{_builddir}/%{?buildsubdir} \
mv debugfiles.list debug1.list \
\
# Gather debuginfo of modules from shadow build root \
RPM_BUILD_ROOT=%{_builddir}/%{?buildsubdir}/.debugroot \\\
/usr/lib/rpm/find-debuginfo.sh \\\
%{_builddir}/%{?buildsubdir} \
mv debugfiles.list debug2.list \
\
# Merge debuginfos \
cp -a %{_builddir}/%{?buildsubdir}/.debugroot/usr/lib/debug \\\
$RPM_BUILD_ROOT/usr/lib \
cp -a %{_builddir}/%{?buildsubdir}/.debugroot/usr/src/debug \\\
$RPM_BUILD_ROOT/usr/src \
sort debug1.list debug2.list |uniq >debugfiles.list \
\
%{nil}
Name: grub2
Version: 1.98
Release: 0.2.20080807svn%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
License: GPLv3+
URL: http://www.gnu.org/software/grub/
#Source0: http://alpha.gnu.org/pub/gnu/grub/grub-%{version}.tar.gz
# svn -r1797 co svn://svn.sv.gnu.org/grub/trunk/grub2
# tar czf grub2.tar.gz --exclude .svn grub2
Source0: grub2.tar.gz
Source1: 90_persistent
Source2: grub.default
Patch1: grub-1.98-prototypes.patch
Patch2: grub-1.98-transform.patch
Patch4: grub-1.95-grubdir.patch
Patch5: grub-1.98-os.patch
Patch6: grub-1.97-cfgmode.patch
Patch7: grub-1.96-garbage.patch
Patch8: grub-1.98-persistent.patch
Patch9: grub-1.98-linuxsort.patch
Patch10: http://fedorapeople.org/~lkundrak/grub2/grub2-dlsym-v4.patch
#Patch13: http://fedorapeople.org/~lkundrak/grub2/grub2-preserve-symbols-v4.patch
Patch13: grub2-preserve-symbols-v4.1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: flex bison ruby binutils
BuildRequires: ncurses-devel lzo-devel
BuildRequires: /usr/lib/crt1.o
# grubby
Requires(pre): mkinitrd
Requires(post): mkinitrd
# TODO: ppc and sparc
ExclusiveArch: %{ix86} x86_64
%description
This is the second version of the GRUB (Grand Unified Bootloader),
a highly configurable and customizable bootloader with modular
architecture. It support rich scale of kernel formats, file systems,
computer architectures and hardware devices.
%prep
%setup -q -n grub2
%patch1 -p0 -b .prototypes
%patch2 -p1 -b .transform
%patch4 -p1 -b .grubdir
%patch5 -p1 -b .os
%patch6 -p1 -b .cfgmode
%patch7 -p1 -b .garbage
%patch8 -p1 -b .persistent
%patch9 -p0 -b .linuxsort
%patch10 -p1 -b .dlsym
%patch13 -p1 -b .preserve-symbols
%build
# -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 \
--with-platform=pc \
--enable-grub-emu \
--program-transform-name=s,grub,%{name},
# TODO: Other platforms. Use alternatives system?
# --with-platform=ieee1275 \
# --with-platform=efi \
# --with-platform=i386-pc \
#make %{?_smp_mflags}
#gcc -Inormal -I./normal -I. -Iinclude -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/lib/`echo grub/i386-pc | sed 's&^&&;s,grub,grub2,'`\" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DGRUB_UTIL=1 -MD -c -o grub_emu-normal_lexer.o normal/lexer.c
#In file included from normal/lexer.c:23:
#include/grub/script.h:26:29: error: grub_script.tab.h: No such file or directory
make
%install
set -e
rm -fr $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
# Script that makes part of grub.cfg persist across updates
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/
# Ghost config file
install -d $RPM_BUILD_ROOT/boot/%{name}
touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg
# Install ELF files modules and images were created from into
# the shadow root, where debuginfo generator will grab them from
find $RPM_BUILD_ROOT -name '*.mod' -o -name '*.img' |
while read MODULE
do
BASE=$(echo $MODULE |sed -r "s,.*/([^/]*)\.(mod|img),\1,")
# Symbols from .img files are in .exec files, while .mod
# modules store symbols in .elf. This is just because we
# have both boot.img and boot.mod ...
EXT=$(echo $MODULE |grep -q '.mod' && echo '.elf' || echo '.exec')
TGT=$(echo $MODULE |sed "s,$RPM_BUILD_ROOT,.debugroot,")
install -m 755 -D $BASE$EXT $TGT
done
# Defaults
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub
%clean
rm -rf $RPM_BUILD_ROOT
%post
exec >/dev/null 2>&1
# Create device.map or reuse one from GRUB Legacy
cp -u /boot/grub/device.map /boot/%{name}/device.map 2>/dev/null ||
%{name}-mkdevicemap
# Determine the partition with /boot
BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
# Generate core.img, but don't let it be installed in boot sector
%{name}-install --grub-setup=/bin/true $BOOT_PARTITION
# Remove stale menu.lst entries
/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})"
%preun
exec >/dev/null
/sbin/grubby --remove-kernel=/boot/%{name}/core.img
# XXX Ugly
rm -f /boot/%{name}/*.mod
rm -f /boot/%{name}/*.img
rm -f /boot/%{name}/*.lst
rm -f /boot/%{name}/device.map
%triggerin -- kernel, kernel-PAE
exec >/dev/null 2>&1
# Generate grub.cfg
update-%{name}
%triggerun -- kernel, kernel-PAE
exec >/dev/null 2>&1
# Generate grub.cfg
update-%{name}
%files
%defattr(-,root,root,-)
%{_libdir}/%{name}
%{_sbindir}/%{name}-mkdevicemap
%{_sbindir}/%{name}-install
%{_sbindir}/%{name}-emu
%{_sbindir}/%{name}-probe
%{_sbindir}/%{name}-setup
%{_sbindir}/update-%{name}
%{_bindir}/%{name}-mkimage
%{_bindir}/%{name}-mkrescue
%{_bindir}/%{name}-editenv
%{_bindir}/%{name}-pe2elf
%dir %{_sysconfdir}/grub.d
%config %{_sysconfdir}/grub.d/??_*
%{_sysconfdir}/grub.d/README
%{_sysconfdir}/%{name}.cfg
%{_sysconfdir}/default/grub
%dir /boot/%{name}
# Actually, this is replaced by update-grub from scriptlets,
# but it takes care of modified persistent part
%config(noreplace) /boot/%{name}/grub.cfg
%doc COPYING INSTALL NEWS README THANKS TODO ChangeLog
%exclude %{_mandir}
%changelog
* Fri Aug 08 2008 Lubomir Rintel <lkundrak@v3.sk> - 1.98-0.2.20080807svn
- Correct scriptlet dependencies, trigger on kernel-PAE (thanks to Till Maas)
- Fix build on x86_64 (thanks to Marek Mahut)
* Thu Aug 07 2008 Lubomir Rintel <lkundrak@v3.sk> 1.98-0.1.20080807svn
- Another snapshot
- And much more!
* Mon May 12 2008 Lubomir Kundrak <lkundrak@redhat.com> 1.97-0.1.20080512cvs
- CVS snapshot
- buildid patch upstreamed
* Sat Apr 12 2008 Lubomir Kundrak <lkundrak@redhat.com> 1.96-2
- Pull in 32 bit glibc
- Fix builds on 64 bit
* Sun Mar 16 2008 Lubomir Kundrak <lkundrak@redhat.com> 1.96-1
- New upstream release
- More transformation fixes
- Generate -debuginfo from modules again. This time for real.
- grubby stub
- Make it possible to do configuration changes directly in grub.cfg
- grub.cfg symlink in /etc
* Thu Feb 14 2008 Lubomir Kundrak <lkundrak@redhat.com> 1.95.cvs20080214-3
- Update to latest trunk
- Manual pages
- Add pci.c to DISTLIST
* Mon Nov 26 2007 Lubomir Kundrak <lkundrak@redhat.com> 1.95.cvs20071119-2
- Fix program name transformation in utils
- Moved the modules to /lib
- Generate -debuginfo from modules again
* Sun Nov 18 2007 Lubomir Kundrak <lkundrak@redhat.com> 1.95.cvs20071119-1
- Synchronized with CVS, major specfile cleanup
* Mon Jan 30 2007 Lubomir Kundrak <lkundrak@skosi.org> 1.95-lkundrak1
- Removed redundant filelist entries
* Mon Jan 29 2007 Lubomir Kundrak <lkundrak@skosi.org> 1.95-lkundrak0
- Program name transformation
- Bump to 1.95
- grub-probefs -> grub-probe
- Add modules to -debuginfo
* Tue Sep 12 2006 Lubomir Kundrak <lkundrak@skosi.org> 1.94-lkundrak0
- built the package

1
import.log Normal file
View file

@ -0,0 +1 @@
grub2-1_98-0_2_20080807svn_el5:HEAD:grub2-1.98-0.2.20080807svn.el5.src.rpm:1219824412

View file

@ -0,0 +1 @@
e900ada389acd04b579583cb2179ef61 grub2.tar.gz