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