0e50f1f
# Modules always contain just 32-bit code
0e50f1f
%define _libdir %{_exec_prefix}/lib
0e50f1f
e046631
# 64bit intel 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
e046631
#sparc is always compile 64 bit
e046631
%ifarch %{sparc}
e046631
%define _target_platform sparc64-%{_vendor}-%{_target_os}%{?_gnu}
e046631
%endif
0e50f1f
0e50f1f
Name:           grub2
e98789b
Epoch:          1
e98789b
Version:        1.97.1
a72f2be
Release:        2%{?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/
e98789b
Source0:        ftp://alpha.gnu.org/gnu/grub/grub-%{version}.tar.gz
0e50f1f
Source1:        90_persistent
0e50f1f
Source2:        grub.default
ca74990
Source3:        README.Fedora
e046631
Patch0:         grub-1.95-grubdir.patch
e046631
Patch1:        http://fedorapeople.org/~lkundrak/grub2/grub2-dlsym-v4.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
5e0037e
BuildRequires:  freetype-devel libusb-devel
e046631
%ifarch %{sparc}
e046631
BuildRequires:  /usr/lib64/crt1.o glibc-static
e046631
%else
b95f802
BuildRequires:  /usr/lib/crt1.o glibc-static
e046631
%endif
e046631
BuildRequires:  autoconf automake
0e50f1f
0e50f1f
# grubby
0e50f1f
Requires(pre):  mkinitrd
0e50f1f
Requires(post): mkinitrd
0e50f1f
0e50f1f
# TODO: ppc and sparc
e046631
ExclusiveArch:  %{ix86} x86_64 %{sparc}
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
e98789b
%setup -q -n grub-%{version}
0e50f1f
e046631
%patch0 -p1 -b .grubdir
e046631
%patch1 -p1 -b .dlsym
0e50f1f
ca74990
# README.Fedora
ca74990
cp %{SOURCE3} .
ca74990
0e50f1f
0e50f1f
%build
e046631
sh autogen.sh
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       \
e046631
%ifarch %{sparc}
e046631
        --with-platform=ieee1275        \
e046631
%else
0e50f1f
        --with-platform=pc              \
e046631
%endif
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
e046631
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
e046631
#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,")
e046631
#        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
e046631
%{name}-mkconfig
0e50f1f
0e50f1f
0e50f1f
%triggerun -- kernel, kernel-PAE
0e50f1f
exec >/dev/null 2>&1
0e50f1f
# Generate grub.cfg
e046631
%{name}-mkconfig
0e50f1f
0e50f1f
0e50f1f
%files
0e50f1f
%defattr(-,root,root,-)
0e50f1f
%{_libdir}/%{name}
e046631
%{_libdir}/grub/
0e50f1f
%{_sbindir}/%{name}-mkdevicemap
0e50f1f
%{_sbindir}/%{name}-install
0e50f1f
%{_sbindir}/%{name}-emu
0e50f1f
%{_sbindir}/%{name}-probe
0e50f1f
%{_sbindir}/%{name}-setup
e046631
%{_sbindir}/%{name}-mkconfig
0e50f1f
%{_bindir}/%{name}-mkimage
ca74990
%{_bindir}/%{name}-mkelfimage
0e50f1f
%{_bindir}/%{name}-editenv
a72f2be
%{_bindir}/%{name}-fstest
a72f2be
%{_bindir}/%{name}-mkfont
a72f2be
%{_bindir}/%{name}-mkrescue
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
e046631
0e50f1f
0e50f1f
%changelog
a72f2be
* Tue Nov 10 2009 Dennis Gilmore <dennis@ausil.us> - 1:1.97.1-2
a72f2be
- update filelists
a72f2be
e98789b
* Tue Nov 10 2009 Dennis Gilmore <dennis@ausil.us> - 1:1.97.1-1
e98789b
- update to 1.97.1 release
e98789b
- introduce epoch for upgrades
e98789b
5e0037e
* Tue Nov 10 2009 Dennis Gilmore <dennis@ausil.us> - 1.98-0.7.20090911svn
5e0037e
- fix BR
5e0037e
5e0037e
* Fri Sep 11 2009 Dennis Gilmore <dennis@ausil.us> - 1.98-0.6.20090911svn
e046631
- update to new svn snapshot
e046631
- add sparc support
e046631
b08b867
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.98-0.6.20080827svn
b08b867
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
b08b867
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