%undefine _hardened_build %undefine _debugsource_template # Modules always contain just 32-bit code %define _libdir %{_exec_prefix}/lib # 64bit intel 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 # sparc is always compiled 64 bit %ifarch %{sparc} %define _target_platform sparc64-%{_vendor}-%{_target_os}%{?_gnu} %endif %define grb_extra %{?_without_grbextra: 0} %{?!_without_grbextra: 1} #if ! 0{?efi} %global efi_only aarch64 %global efiarchs x86_64 ia64 %{efi_only} %ifarch x86_64 %global grubefiarch %{_arch}-efi %global grubefiname grubx64.efi %global grubeficdname gcdx64.efi %endif %ifarch aarch64 %global grubefiarch arm64-efi %global grubefiname grubaa64.efi %global grubeficdname gcdaa64.efi %endif %if 0%{?rhel} %global efidir redhat %endif %if 0%{?fedora} %global efidir fedora %endif %if 0%{?centos} %global efidir centos %endif %if 0%{?almalinux} %global efidir almalinux %endif #endif %global tarversion 2.12 %define scm_git %{?_with_scmgit: 0} %{?!_with_scmgit: 1} # when build completed, but we stopped on package errors: '--with reuse' %define install_only %{?_with_reuse: 1} %{?!_with_reuse: 0} # must use this since build_ids are almost none existant %undefine _missing_build_ids_terminate_build %global debug_package %{nil} %global gnulibver 9f48fb992a3d7e96610c4ce8be969cff2d61a01b Summary: Grub release build, version 2.12 Name: grub2 Epoch: 1 Version: 2.12 Release: 6%{?dist} License: GPL Group: System/Boot URL: http://git.savannah.gnu.org/cgit/grub.git Source0: https://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz #Source26: gnulib-fixes.tar.xz Source26: gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz Source1: centos.cer #Source2: fdebug.macro #Source3: git_am.macro #Source4: refigure.macro Source5: grub.macros #Source6: imgplat.macro #Source7: bldplat.macro #Source15: cfgplat.macro #Source17: update_grub.macro Source8: http://unifoundry.com/unifont-5.1.20080820.pcf.gz Source9: README.dbg Source10: etc-default-grub Source11: theme.tar.bz2 Source12: fireworks.png Source13: grub-extras-master.tar.gz #Source13: gitignore.up Source14: grub-firmware-qemu_grub.cfg Source16: grub_grub.cfg Source18: grub_user_mk_xen_image.sh Source19: cmdline # coreboot Source20: cb_README.cb Source21: cb_grub.cfg Source22: dbgsrc.list Source23: config.rpath Source24: 99-grub-mkconfig.install Source25: 20-grub.install #Source26: macros.reuse Source27: bootstrap Source28: bootstrap.conf %global buildtree %{_builddir}/grub-%{tarversion} ####### # macros from _srcdir ####### %include %{SOURCE5} # __debug_install_post (handle missing build-id) %if 1==1 %global __debug_install_post %fdebug %endif # inline dynamic patch writer (prep) %{lua: flist= posix.files(rpm.expand("%{_sourcedir}/")) tp={} for f in flist do -- only patches with gb prefix and patch suffix g = string.match(f,'^g[ab].*%.patch$') -- g = string.match(f,'%.patch$') if g ~= nil then table.insert(tp, f ) end end table.sort(tp) for i,p in ipairs(tp) do print(string.format("Patch%03u: %s\n", i, p)) end } ### end macro definitions ### default value for BR BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %define _binary_payload w5.xzdio %define _source_payload w5.xzdio ### build requires # BuildRequires: flex bison binutils python3 BuildRequires: ncurses-devel xz-devel bzip2-devel BuildRequires: freetype-devel # libusb-devel #ifarch {ix86} x86_64 # stubs-32.h # ^ provided by glibc32 in fc40 #BuildRequires: glibc-devel(x86-32) #%endif BuildRequires: pkgconfig(rpm) BuildRequires: ncurses libusb %if %grb_extra BuildRequires: SDL-devel SDL %endif BuildRequires: /usr/lib64/crt1.o glibc-static BuildRequires: /usr/lib/crt1.o glibc-static BuildRequires: autoconf automake device-mapper-devel make gcc gcc-c++ glibc-devel BuildRequires: freetype-devel gettext-devel %if %scm_git BuildRequires: git perl-Git %endif BuildRequires: texinfo BuildRequires: dejavu-sans-fonts BuildRequires: help2man BuildRequires: rpm-devel BuildRequires: fuse3-devel #BuildRequires: xen-devel >= 4.5.0-1.el7 %ifarch %{efiarchs} %ifnarch aarch64 BuildRequires: pesign >= 0.109-3.el7 %endif %endif ### # package metadata ### %description This package contains the Grub bootloader and associated tools, built from a source tree. It is not a fully packaged and supported Grub, just the output of "make dist" wrapped in an .rpm to make it easy to uninstall. %ifarch %{efiarchs} %package efi Summary: GRUB for EFI systems. Group: System Environment/Base Requires: %{name}-tools = %{epoch}:%{version}-%{release} Obsoletes: grub2-efi <= 1:2.00-20%{?dist} %description efi The GRand Unified Bootloader (GRUB) is a highly configurable and customizable bootloader with modular architecture. It support rich varietyof kernel formats, file systems, computer architectures and hardware devices. This subpackage provides support for EFI systems. %package efi-modules Summary: Modules used to build custom grub.efi images Group: System Environment/Base Requires: %{name}-tools = %{epoch}:%{version}-%{release} Obsoletes: grub2-efi <= 1:2.00-20%{?dist} %description efi-modules The GRand Unified Bootloader (GRUB) is a highly configurable and customizable bootloader with modular architecture. It support rich varietyof kernel formats, file systems, computer architectures and hardware devices. This subpackage provides support for rebuilding your own grub.efi on EFI systems. %endif %package tools Summary: Support tools for GRUB. Group: System Environment/Base Requires: gettext os-prober which file device-mapper-libs %description tools The GRand Unified Bootloader (GRUB) is a highly configurable and customizable bootloader with modular architecture. It support rich varietyof kernel formats, file systems, computer architectures and hardware devices. This subpackage provides tools for support of all platforms. %package dbg Summary: debug modules for grub Group: Development/Libraries %description dbg This package provides the modules needed when debugging the *.mod elf files %if %{defined _with_cbfs} %package cbfs Summary: Coreboot filesys for GRUB. Group: System Environment/Base #Requires: %description cbfs Adds the grub2 cbfs support %endif %if %grb_extra %package xen Summary: Support tools for GRUB. Group: System Environment/Base #Requires: %description xen Adds the elf modules/mods for the x86_64 & i386 xen platforms. Allow admins to create pvgrub2 blobs to boot xen VM. # define debug_package {nil} %if 1 == 0 %package emu Summary: Support tools for GRUB. Group: System Environment/Base #Requires: %description emu Adds the grub2 emulator with SDL support %endif %package grbextra-dbg Summary: debug modules for grub extras Group: Development/Libraries %description grbextra-dbg This package provides the modules needed when debugging the *.mod elf files %package firmware-qemu Summary: grub bios blob for kvm/qemu Group: Development/Libraries %description firmware-qemu This package has the grub.bin bios blob which can be imported on the qemu cmdline. %endif %package starfield-theme Summary: An example theme for GRUB. Group: System Environment/Base #Requires: centos-logos Obsoletes: grub2 <= 1:2.00-20%{?dist} Obsoletes: grub2-efi <= 1:2.00-20%{?dist} %description starfield-theme The GRand Unified Bootloader (GRUB) is a highly configurable and customizable bootloader with modular architecture. It support rich varietyof kernel formats, file systems, computer architectures and hardware devices. This subpackage provides an example theme for the grub screen. %prep #{echo: now in actual prep body} %if 1==0 %global __debug_install_post %(cat %{SOURCE2}) %endif %if %{defined _with_reuse} # no-op setup, leaves builddir as is %setup -T -D -n grub-%{tarversion} exit 0 %endif # new builddir %setup -q -n grub-%{tarversion} #tar -xf {SOURCE26} -C grub-core/lib cp -p %{SOURCE27} ./ cp -p %{SOURCE28} ./ # grub-extras.git additional export GRUB_CONTRIB=${PWD}/grub-extras-master tar -xf %{SOURCE13} rm -rf ${GRUB_CONTRIB}/{lua,disabled} tar -xf %{SOURCE26} mv gnulib-%gnulibver gnulib #tar -xf %{SOURCE13} -C po sed -i -e '/^AC_PREREQ/ s|AC_PREREQ(2\.63|AC_PREREQ(2.65|' configure.ac sed -i -e 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu-sans-fonts|' configure.ac #rm grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch #sed -i -e 's|fix-regcomp-uninit-token \\$|\\|' bootstrap.conf sed -i -e 's|fix-width||' bootstrap.conf sed -i -e 's|fix-base64||' bootstrap.conf sed -i -e 's|fix-null-deref||' bootstrap.conf sed -i -e 's|no-abort; do|; do|' bootstrap.conf sed -i -e 's|fix-uninit-structure||' bootstrap.conf %{!?pchcnt: %global pchcnt %{lua: if patches == nil then print("0") else print(#patches) end}} echo "count=%{pchcnt}" > /dev/null sed -i -e 's|\=python|=python3|' ./autogen.sh # #cp -p {SOURCE13} .gitignore cp -p %{SOURCE8} ./unifont.pcf.gz %if %scm_git %git_am %else %autopatch -p1 %endif #sed -i -e "/^AUTOPOINT=true/i cp -p gnulib/build-aux/config.rpath build-aux" bootstrap export GRUB_CONTRIB=${PWD}/grub-extras-master #./autogen.sh ./bootstrap %build %if %{defined _with_reuse} exit 0 %endif export GRUB_CONTRIB=${PWD}/grub-extras-master ### # build for 3 platforms, efi, pc & xen, and 2 arch, i386 & x86_64 # basic `make dist` approach, but done via bldplat macro, not makefile ### #export DI=%{buildtree}/dist/install export OLDDIR=$PWD export DI=$OLDDIR/dist/install mkdir -p dist/install/etc/default/ mkdir -p dist/install/usr/share/locale # works since we use automake %define _configure $OLDDIR/configure # tmp dir to cache util objects (same for all cfg's) bkutil=$(mktemp -u XXXXXXXX-util) mkdir -p $bkutil ### # only once ## #./autogen.sh %if %{defined _with_cbfs} mkdir -p ${DI}/usr/share/cbfs ; \ install -m 644 %{SOURCE20} ${DI}/usr/share/cbfs/README.cb ; \ install -m 644 %{SOURCE21} ${DI}/usr/share/cbfs/cb_grub.cfg ; \ # make -j 2 ; \ # make default_payload.elf ; \ tout=$(mktemp -u XXXXXX-coreboot) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz cp -p %{SOURCE21} ./coreboot.cfg CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "; \ %cfgplat i386 coreboot TARGET_LDFLAGS=-static $'--silent' $'--disable-grub-themes' sed -i -e '/^[[:space:]]pkgdata/ s|i386\-coreboot|i386-coreboot --compress=xz|' Makefile ; make install DESTDIR=$DI if [ $? -ne 0 ];then echo "make failed";return 1 ;fi #imgplat i386 coreboot %{SOURCE16} make default_payload.elf ; install -m 755 default_payload.elf ${DI}/usr/share/cbfs/default_payload.elf ; echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null popd # reuse util objects cp -a $tout/util/. $bkutil/ rm -rf $tout %endif %if 1==1 %ifarch %{efiarchs} ### efi on amd64 tout=$(mktemp -u XXXXXX-efi) mkdir $tout pushd $tout mkdir -p util/ cp -a %{buildtree}/$bkutil/. util/ cp -p %{SOURCE8} ./unifont.pcf.gz xxflags="$(echo $RPM_OPT_FLAGS | sed \ -e 's/-O.//g' \ -e 's/-fstack-protector[[:alpha:]-]\+//g' \ -e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\+//g' \ -e 's/\-\-param=ssp-buffer-size=4//g' \ -e 's/-mregparm=3/-mregparm=4/g' \ -e 's/-fexceptions//g' \ -e 's/-fcf-protection//g' \ -e 's/-fasynchronous-unwind-tables//g' \ -e 's/^/-fno-strict-aliasing -std=gnu99/' )" CFLAGS="$xxflags"; export CFLAGS ; \ %bldplat x86_64 efi TARGET_LDFLAGS=-static $'--silent' $'--enable-grub-themes' $'--disable-werror' #$'--disable-grub-mount' GRUB_MODULES=" all_video boot btrfs cat chain configfile echo efifwsetup \ efinet ext2 fat font gfxmenu gfxterm gzio halt hfsplus iso9660 \ jpeg loadenv lvm mdraid09 mdraid1x minicmd normal part_apple \ part_msdos part_gpt password_pbkdf2 png reboot search \ search_fs_uuid search_fs_file search_label sleep syslinuxcfg \ test tftp regexp video xfs" %ifarch aarch64 GRUB_MODULES="${GRUB_MODULES} linux" %else GRUB_MODULES+=" usb usbserial_common " GRUB_MODULES+=" usbserial_pl2303 usbserial_ftdi usbserial_usbdebug " #GRUB_MODULES+=" linuxefi" GRUB_MODULES+=" multiboot multiboot2" # %endif ./grub-mkimage -O %{grubefiarch} -o %{grubefiname}.orig -p /EFI/%{efidir} \ -d grub-core ${GRUB_MODULES} ./grub-mkimage -O %{grubefiarch} -o %{grubeficdname}.orig -p /EFI/BOOT \ -d grub-core ${GRUB_MODULES} %ifarch aarch64 mv %{grubefiname}.orig %{grubefiname} mv %{grubeficdname}.orig %{grubeficdname} %else %pesign -s -i %{grubefiname}.orig -o %{grubefiname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301 %pesign -s -i %{grubeficdname}.orig -o %{grubeficdname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301 %endif # Ghost config file install -m 755 -d $DI/boot/efi/EFI/%{efidir}/ touch $DI/boot/efi/EFI/%{efidir}/grub.cfg ln -s ../boot/efi/EFI/%{efidir}/grub.cfg $DI/%{_sysconfdir}/%{name}-efi.cfg # Install ELF files modules and images were created from into # the shadow root, where debuginfo generator will grab them from install -m 755 %{grubefiname} $DI/boot/efi/EFI/%{efidir}/%{grubefiname} install -m 755 %{grubeficdname} $DI/boot/efi/EFI/%{efidir}/%{grubeficdname} install -D -m 644 unicode.pf2 $DI/boot/efi/EFI/%{efidir}/fonts/unicode.pf2 # unset GRUB_MODULES rm %{grubefiname}* rm %{grubeficdname}* # was it reused? echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null popd rm -rf $tout %endif %endif %if %grb_extra %if 1==1 ### xen on amd64 tout=$(mktemp -u XXXXXX-xen) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz # reuse util objects mkdir -p util cp -a %{buildtree}/$bkutil/. util/ CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "; \ # configure can translate amd64, but nothing else does. use fedora arch convention %bldplat x86_64 xen TARGET_LDFLAGS=-static $'--silent' $'--disable-grub-themes' mkdir -p boot/grub cp -p %{SOURCE16} boot/grub/grub.cfg %imgplat x86_64 xen %{SOURCE16} #exit 1;set echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null popd rm -rf $tout ### xen_pvh on i386 # tout=$(mktemp -u XXXXXX-xen) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz # reuse util objects mkdir -p util cp -a %{buildtree}/$bkutil/. util/ CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "; \ %bldplat i386 xen_pvh TARGET_LDFLAGS=-static $'--silent' $'--disable-grub-themes' mkdir -p boot/grub cp -p %{SOURCE16} boot/grub/grub.cfg %imgplat i386 xen_pvh %{SOURCE16} echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null popd rm -rf $tout # %endif %if 1==1 ### qemu on i386 tout=$(mktemp -u XXXXXX-qemu) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz # reuse util objects mkdir -p util cp -a %{buildtree}/$bkutil/. util/ #./autogen.sh CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "; \ %bldplat i386 qemu TARGET_LDFLAGS=-static $'--silent' $'--disable-grub-themes' mkdir -p boot/grub cp -p %{SOURCE14} boot/grub/grub.cfg %imgplat i386 qemu %{SOURCE14} echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null popd rm -rf $tout # %endif ### xen on i386 # tout=$(mktemp -u XXXXXX-xen) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz # reuse util objects mkdir -p util cp -a %{buildtree}/$bkutil/. util/ CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "; \ %bldplat i386 xen TARGET_LDFLAGS=-static $'--silent' $'--disable-grub-themes' mkdir -p boot/grub cp -p %{SOURCE16} boot/grub/grub.cfg %imgplat i386 xen %{SOURCE16} popd rm -rf $tout pvdir=$DI/%{_datarootdir}/xen/pvgrub2/tools if [ ! -d $pvdir ]; then install -m 755 -d $pvdir fi install -m 755 %{SOURCE18} $pvdir/grub_user_mk_xen_image.sh install -m 755 %{SOURCE16} $pvdir/boot-grub-grub.cfg ### emu # %if 1 == 0 tout=$(mktemp -u XXXXXX-emu) mkdir $tout pushd $tout cp -p %{SOURCE8} ./unifont.pcf.gz # reuse util objects mkdir -p util cp -a %{buildtree}/$bkutil/. util/ CFLAGS="-fno-stack-protector -O2"; \ %bldplat amd64 emu $'--silent' $'--enable-grub-emu-sdl' $'--disable-grub-themes' popd rm -rf $tout %endif %endif # reuse util objects #mkdir -p util #cp -a $bkutil/. util/ ### pc # xxflags="$(echo $RPM_OPT_FLAGS | sed \ -e 's/-O.//g' \ -e 's/-fstack-protector[[:alpha:]-]\+//g' \ -e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\+//g' \ -e 's/--param=ssp-buffer-size=4//g' \ -e 's/-mregparm=3/-mregparm=4/g' \ -e 's/-fexceptions//g' \ -e 's/-m64//g' \ -e 's/-fasynchronous-unwind-tables//g' \ -e 's/-mcpu=power7/-mcpu=power6/g' \ -e 's/^/ -fno-strict-aliasing -std=gnu99/' )" CFLAGS="$xxflags"; export CFLAGS ; \ export GRUB_CONTRIB=${PWD}/grub-extras-master ; \ %bldplat i386 pc TARGET_LDFLAGS=-static $'--silent' $'--enable-grub-themes' sed -i -e 's,(grub),(%{name}),g' \ -e 's,grub.info,%{name}.info,g' \ -e 's,\* GRUB:,* GRUB2:,g' \ -e 's,/boot/grub/,/boot/%{name}/,g' \ -e 's,\([^-]\)grub-\([a-z]\),\1%{name}-\2,g' \ docs/grub.info sed -i -e 's,grub-dev,%{name}-dev,g' docs/grub-dev.info /usr/bin/makeinfo --html --no-split -I docs -o grub-dev.html docs/grub-dev.texi /usr/bin/makeinfo --html --no-split -I docs -o grub.html docs/grub.texi sed -i -e 's,/boot/grub/,/boot/%{name}/,g' \ -e 's,\([^-]\)grub-\([a-z]\),\1%{name}-\2,g' \ grub.html # install for pc platform PC_MODULES="all_video boot btrfs cat chain configfile echo ext2 fat font gettext \ gfxmenu gfxterm gfxterm_background gzio halt hfsplus iso9660 jpeg keystatus \ loadenv loopback linux memdisk minicmd normal part_apple part_msdos part_gpt \ password_pbkdf2 png reboot search search_fs_uuid search_fs_file search_label \ sleep squash4 test true video zfs zfscrypt zfsinfo biosdisk echo linux linux16" %imgplat i386 pc %{SOURCE14} echo $(ls -al util/grub_mkstandalone-mkimage.o) > /dev/null mkdir -p $DI/boot/grub2 touch $DI/boot/grub2/grub.cfg unset DI cp -p %{SOURCE9} README.dbg %define platform pc ## install ## %install rm -rf $RPM_BUILD_ROOT # the cp will recreate the full RPM_BUILD_ROOT, so don't remake it #mkdir -p $RPM_BUILD_ROOT # send the installable tree from BUILD->BUILDROOT cp -ra dist/install/. $RPM_BUILD_ROOT %if 1==1 touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg %endif %find_lang grub install -d -m 0755 %{buildroot}%{_prefix}/lib/kernel/install.d/ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE24} install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE25} install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/ # Fedora theme in /boot/grub2/themes/system/ pushd $RPM_BUILD_ROOT tar xjf %{SOURCE11} $RPM_BUILD_ROOT%{_bindir}/%{name}-mkfont -o boot/grub2/themes/system/DejaVuSans-10.pf2 -s 10 /usr/share/fonts/dejavu/DejaVuSans.ttf # "DejaVu Sans Regul$ $RPM_BUILD_ROOT%{_bindir}/%{name}-mkfont -o boot/grub2/themes/system/DejaVuSans-12.pf2 -s 12 /usr/share/fonts/dejavu/DejaVuSans.ttf # "DejaVu Sans Regul$ $RPM_BUILD_ROOT%{_bindir}/%{name}-mkfont -o boot/grub2/themes/system/DejaVuSans-Bold-14.pf2 -s 14 /usr/share/fonts/dejavu/DejaVuSans-Bold.ttf # "DejaVu Sans $ # missing image from fedora-logos cp -p %{SOURCE12} boot/grub2/themes/system/ ln -s %{_datadir}/grub/themes/starfield boot/%{name}/themes/starfield mkdir -p boot/%{name}/fonts/ ln -s %{_datadir}/grub/unicode.pf2 boot/%{name}/fonts/unicode.pf2 # Make selinux happy with exec stack binaries. mkdir ${RPM_BUILD_ROOT}%{_sysconfdir}/prelink.conf.d/ cat << EOF > ${RPM_BUILD_ROOT}%{_sysconfdir}/prelink.conf.d/grub2.conf # these have execstack, and break under selinux -b /usr/bin/grub2-script-check -b /usr/bin/grub2-mkrelpath -b /usr/bin/grub2-fstest -b /usr/sbin/grub2-bios-setup -b /usr/sbin/grub2-probe -b /usr/sbin/grub2-sparc64-setup EOF #mkdir $RPM_BUILD_ROOT%{_sysconfdir}/default/ install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ install -m 755 -D %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub # we are in BUILDROOT ln -s %{_sysconfdir}/default/grub \ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub #ln -sf /etc/default/grub etc/sysconfig/grub %ifarch %{efiarchs} mkdir -p boot/efi/EFI/%{efidir}/ ln -s /boot/efi/EFI/%{efidir}/grubenv boot/grub2/grubenv %endif # back to buildtree popd %if 1==0 echo "%%defattr(-, root, root)" > filelist.lst # first get the files (cd %{buildroot}; find . -type f -or -type l | sed -e s/^.// -e /^$/d -e '/usr\/share\/man/d' -e '/usr\/share\/info/d') >> filelist.lst # now get the empty folders (cd %{buildroot}; find . -type d -empty | sed -e s/^.// -e 's/^\//%dir \//' ) >> filelist.lst #echo "%{_sysconfdir}/default/grub" >> filelist.lst echo "%attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub" >> filelist.lst #grep 'module$' filelist.lst >> dbg.lst sed -i -e '/module$/d' filelist.lst %endif echo "%%defattr(0755, root, root)" > dbg.lst echo "%%defattr(0755, root, root)" > grbextra-dbg.lst (cd %{buildroot};find ./usr/lib -name "*.module" -or -name "*.exec" -or -name "*.image" | sed -e s/^\.// ) >> tmp.lst #grep 'module$' filelist.lst| sort -u >> tmp.lst #grep 'exec$' filelist.lst| sort -u >> tmp.lst grep '\-xen\/' tmp.lst | sort -u >> grbextra-dbg.lst sed -i -e '/\-xen\//d' tmp.lst grep '\-emu\/' tmp.lst | sort -u >> grbextra-dbg.lst sed -i -e '/\-emu\//d' tmp.lst grep '\-efi\/' tmp.lst | sort -u >> dbg.lst sed -i -e '/\-efi\//d' tmp.lst grep '\-pc\/' tmp.lst | sort -u >> dbg.lst rm tmp.lst #grep '%{_includedir}' filelist.lst > devel_list.lst #sed -i -e '/^\/usr\/include/ d' -e 's/\.h$//g' filelist.lst %post %clean rm -rf $RPM_BUILD_ROOT %if %grb_extra %post starfield-theme if [ "$1" -ne 0 ]; then echo GRUB_THEME="/boot/grub2/themes/starfield/theme.txt" >> /etc/default/grub sed -i -e '/^GRUB_TERMINAL_OUTPUT/ s/^/#/' /etc/default/grub %update_grub fi %postun starfield-theme if [ "$1" = 0 ]; then sed -i -e '/^#GRUB_TERM/ s/^#//' -e '/theme.txt$/d' /etc/default/grub %update_grub fi %endif %pre tools if [ $1 -gt 1 ]; then if [ -f /etc/grub.d/01_users ] && \ grep -c -q '^password_pbkdf2 root' /etc/grub.d/01_users ; then if [ -f /boot/efi/EFI/%{efidir}/grub.cfg ]; then # on EFI we don't get permissions on the file, but # the directory is protected. grep '^password_pbkdf2 root' /etc/grub.d/01_users | \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB_PASSWORD=\1/' \ > /boot/efi/EFI/%{efidir}/user.cfg fi if [ -f /boot/grub2/grub.cfg ]; then install -m 0600 /dev/null /boot/grub2/user.cfg chmod 0600 /boot/grub2/user.cfg grep '^password_pbkdf2 root' /etc/grub.d/01_users | \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB_PASSWORD=\1/' \ > /boot/grub2/user.cfg fi fi fi %post tools if [ "$1" = 1 ]; then /sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub.info.gz || : /sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub-dev.info.gz || : fi %triggerun -- grub2 < 1:1.99-4 # grub2 < 1.99-4 removed a number of essential files in postun. To fix upgrades # from the affected grub2 packages, we first back up the files in triggerun and # later restore them in triggerpostun. # https://bugzilla.redhat.com/show_bug.cgi?id=735259 # Back up the files before uninstalling old grub2 mkdir -p /boot/grub2.tmp && mv -f /boot/grub2/*.mod \ /boot/grub2/*.img \ /boot/grub2/*.lst \ /boot/grub2/device.map \ /boot/grub2.tmp/ || : %triggerpostun -- grub2 < 1:1.99-4 # ... and restore the files. test ! -f /boot/grub2/device.map && test -d /boot/grub2.tmp && mv -f /boot/grub2.tmp/*.mod \ /boot/grub2.tmp/*.img \ /boot/grub2.tmp/*.lst \ /boot/grub2.tmp/device.map \ /boot/grub2/ && rm -r /boot/grub2.tmp/ || : %preun tools if [ "$1" = 0 ]; then /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub.info.gz || : /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub-dev.info.gz || : fi %files %defattr(-,root,root,-) %{_libdir}/grub/*-%{platform}/ %exclude %{_libdir}/grub/*-%{platform}/*.module %exclude %{_libdir}/grub/*-%{platform}/*.exec %exclude %{_libdir}/grub/*-%{platform}/*.image %config(noreplace) %{_sysconfdir}/%{name}.cfg %config(noreplace) %ghost /boot/%{name}/grub.cfg #/boot/grub2/grubenv %config(noreplace) %ghost /boot/grub2/grubenv %files tools -f grub.lang %defattr(-,root,root,-) %dir %{_libdir}/grub/ %dir %{_datadir}/grub/ %{_datadir}/grub/* %{_sbindir}/%{name}-bios-setup %{_sbindir}/%{name}-install %{_sbindir}/%{name}-macbless %{_sbindir}/%{name}-mkconfig %{_sbindir}/%{name}-ofpathname %{_sbindir}/%{name}-probe %{_sbindir}/%{name}-reboot #{_sbindir}/{name}-rpm-sort %{_sbindir}/%{name}-set-default %{_sbindir}/%{name}-sparc64-setup #{_sbindir}/{name}-setpassword %{_bindir}/%{name}-editenv %{_bindir}/%{name}-file %{_bindir}/%{name}-fstest %{_bindir}/%{name}-glue-efi %{_bindir}/%{name}-kbdcomp %{_bindir}/%{name}-ntldr-img %{_bindir}/%{name}-menulst2cfg %{_bindir}/%{name}-mkfont %{_bindir}/%{name}-mkimage %{_bindir}/%{name}-mklayout %{_bindir}/%{name}-mknetdir %{_bindir}/%{name}-mount %{_bindir}/%{name}-mkpasswd-pbkdf2 %{_bindir}/%{name}-mkrelpath %ifnarch %{sparc} %{_bindir}/%{name}-mkrescue %endif %{_bindir}/%{name}-mkstandalone %{_bindir}/%{name}-render-label %{_bindir}/%{name}-script-check %{_bindir}/%{name}-syslinux2cfg #{_datadir}/bash-completion/completions/grub %{_sysconfdir}/bash_completion.d/grub %{_sysconfdir}/prelink.conf.d/grub2.conf %attr(0700,root,root) %dir %{_sysconfdir}/grub.d %{_prefix}/lib/kernel/install.d/20-grub.install %{_prefix}/lib/kernel/install.d/99-grub-mkconfig.install %config %{_sysconfdir}/grub.d/??_* %{_sysconfdir}/grub.d/README %attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub %{_sysconfdir}/sysconfig/grub #dir /boot/{name} %dir /boot/%{name}/themes/ #exclude /boot/{name}/themes/ #exclude /boot/{name}/fonts %exclude %{_datadir}/grub/themes/ %{_infodir}/grub* %license COPYING %doc INSTALL NEWS README THANKS TODO %doc grub.html %doc grub-dev.html docs/font_char_metrics.png %doc %{_mandir}/man1/* %doc %{_mandir}/man8/* %exclude %{_infodir}/dir %{_datadir}/pc/pvgrub2/grub2-i386-pc.bin #files debuginfo -f dbgsrc.list %files dbg -f dbg.lst %doc README.dbg %if %grb_extra %files grbextra-dbg -f grbextra-dbg.lst %doc README.dbg %endif %ifarch %{efiarchs} %files efi %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/%{name}-efi.cfg %attr(0755,root,root)/boot/efi/EFI/%{efidir} %attr(0755,root,root)/boot/efi/EFI/%{efidir}/fonts %ghost %config(noreplace) /boot/efi/EFI/%{efidir}/grub.cfg %license COPYING /boot/grub2/grubenv # I know 0700 seems strange, but it lives on FAT so that's what it'll # get no matter what we do. %config(noreplace) %ghost %attr(0700,root,root)/boot/efi/EFI/%{efidir}/grubenv %files efi-modules %defattr(-,root,root,-) %license COPYING %doc INSTALL NEWS README THANKS TODO %{_libdir}/grub/%{grubefiarch} %exclude %{_libdir}/grub/%{grubefiarch}/*.module %exclude %{_libdir}/grub/%{grubefiarch}/*.exec %endif %if %{defined _with_cbfs} %files cbfs %defattr(-,root,root,-) %{_libdir}/grub/*-coreboot/ %exclude %{_libdir}/grub/*-coreboot/*.module %exclude %{_libdir}/grub/*-coreboot/*.exec %defattr(0755,root,root,-) #{_bindir}/{name}-coreboot* %{_libdir}/grub/*-coreboot/modinfo.sh %{_datadir}/cbfs/* %endif %if %grb_extra %files xen %defattr(-,root,root,-) %{_libdir}/grub/*-xen*/ %exclude %{_libdir}/grub/*-xen*/*.module %{_datadir}/locale/en@quot/* %defattr(0755,root,root,-) %{_datadir}/xen*/pvgrub2/* %if 1 == 0 %files emu %defattr(-,root,root,-) %{_libdir}/grub/*-emu/ %exclude %{_libdir}/grub/*-emu/*.module %exclude %{_libdir}/grub/*-emu/*.exec %defattr(0755,root,root,-) %{_bindir}/%{name}-emu* %{_libdir}/grub/*-emu/modinfo.sh %endif %files firmware-qemu %defattr(-,root,root,-) %{_libdir}/grub/*-qemu/* %{_libdir}/grub/i386-qemu/gdb_grub #{_libdir}/grub/i386-qemu/gmodule.pl %license COPYING %doc INSTALL NEWS README THANKS TODO %exclude %{_libdir}/grub/*-qemu/*.module %exclude %{_libdir}/grub/*-qemu/*.exec %exclude %{_libdir}/grub/*-qemu/*.image %defattr(0755,root,root,-) %{_libdir}/grub/i386-qemu/modinfo.sh %{_datadir}/qemu/pvgrub2/grub2-i386-qemu.bin %endif %files starfield-theme /boot/%{name}/themes/* #/boot/{name}/themes/ #dir #{_datadir}/grub/themes %{_datadir}/grub/themes/starfield /boot/%{name}/fonts/unicode.pf2 %changelog * Fri Oct 11 2024 Mark Pryor - 1:2.12-6.el9 - use latest bootstrap from fc42 - grub.macros: move all parametered macros into a single grub.macros and include it * Sat Sep 14 2024 Mark Pryor - 1:2.12-5.el9 - remove gmodule.pl from i386-qemu - initial build for v2.12 - add the grub2-i386-pc.bin pvgrub2 kernel from Shaun Reitan to the main package * Sun Aug 04 2024 Mark Pryor - 1:2.06-5.fc40 - rebuild for latest source * Tue Aug 23 2022 Mark Pryor - 1:2.06-4.el9.alma - rebuilt for AL 9.0 puma - remove depends on autospec - configure.ac: sed edit to expand the font path for dejavu, needed for themes - build with cbfs * Sat Oct 23 2021 Mark Pryor - 1:2.06-3.el8.alma - skip 2.el8 since that was built with fc33 spec/macros - rebuilt for AL 8.4 Cheetah * Mon Jun 14 2021 "Mark Pryor " - 1:2.06-1.el8.alma - HEAD @ ae94b97be2b81b6 Release 2.06-2021-06-08 16:28 - using fedora rawhide sources, tarball & gnulib fixes - import grub-extras.git for `i386 pc` build (last one) * Thu Mar 25 2021 "Mark Pryor " - 1:2.06~rc1-1.el8.centos - HEAD @ a53e530f8ad3770c3 GRUB 2.06 release candidate 1-2021-03-12 16:09 * Sat Feb 27 2021 "Mark Pryor " - 1:2.04-26.26.el8.centos - HEAD @ 635ef55ed1252f92fe3bf docs: Add documentation of disk size limitations-2020-12-18 23:18 - grb_extra macro, now default 1 * Thu Nov 19 2020 "Mark Pryor " - 1:2.04-24.24.el8.centos - HEAD @ d7cac52eb21b866ffec Makefile: Remove unused GRUB_PKGLIBDIR definition-2020-10-30 21:53 * Tue Jul 28 2020 "Mark Pryor " - 1:2.04-22.22.el8.centos - HEAD @ e7b8856f8be3292 linux: Fix integer overflows in initrd size handling-Sat Jul 25 12:15 - bootstrap: run at end of prep time stamps same as grub2-2.04 tarball sed edit: copy config.rpath before running autoconf - tarball is checked out grub-2.04 tag from git, at 11MB - patch to head of grub-master from git - cbfs: new package adding coreboot filesys support * Fri Apr 26 2019 "Mark Pryor " - 1:2.04~rc1-0.10.el7.centos - grub-master from git on 7.6.1810 - new release candidate * Wed Dec 12 2018 "Mark Pryor " - 1:2.03-0.11.el7.centos - grub-master from git on 7.6.1810 - HEAD @ a791dc0e3501e2932321a verifiers: Add TPM documentation-2018-12-12 14:51 - first built with grub2 pvh support - new target: i386-xen_pvh * Mon Sep 10 2018 Mark Pryor - 2.03-0.10.el7.centos - grub-master from git on 7.5.1804 - HEAD @ c79ebcd18cf3e208e i386: Dont include lib/i386/reset.c in EFI builds-2018-07-25 14:18 * Thu Aug 24 2017 Mark Pryor - 0.67.el7.centos - rebuilt against CR repo in prep for 7.4.1708 * Tue Jun 27 2017 Mark Pryor - 0.48.el7.centos - efi-modules: add multiboot multiboot2 modules - binary rebuild for glibc update * Fri May 05 2017 Mark Pryor - 0.47.el7.centos - first build of 2.02 * Wed Mar 01 2017 Mark Pryor - 0.46.el7.centos - first build of 2.02~rc1 patched to @ with 10 patches - 529818738fb2aa: xen: Fix parsing of XZ kernel - removed revert of 15aee573d23 (Xen payload fix) * Sat Dec 24 2016 Mark Pryor - 0.45.el7.centos - 2.02~beta3 tarball patched to head of grub.git - ce95549cc54b5d-efi: properly terminate filepath .. - lua script dynamically writes patch declares for ga* gb* - 1st build with 7.3.1611 * Fri Jul 01 2016 Mark Pryor - 0.37.el7.centos - binary rebuild * Mon Apr 11 2016 Mark Pryor - 0.37.el7.centos - 8th build with 2.02~beta3 for Centos 7.2.1511 - xen package has 2 pvgrub2 kernels in /usr/share/xen/pvgrub2 - added 63 patches from f24 grub2.git - split the dbg RPM, with grbextra-dbg separate - imgplat macro handles 3 mkimage calls * Wed Apr 06 2016 Mark Pryor - 0.36.el7.centos - 7th build with 2.02~beta3 for Centos 7.2.1511 - add firmware-qemu * Wed Mar 30 2016 Mark Pryor - 0.31.el7.centos - 6th build with 2.02~beta3 for Centos 7.2.1511 - added less than 40 patches from f24 grub2.git * Mon Mar 28 2016 Mark Pryor - 0.36.el7.centos.1 - 5th build with 2.02~beta3 for Centos 7.2.1511 - tested 93 patches from f24 grub2.git - removed gb-rh-0076-Make-grub_fatal-also-backtrace.patch (jan 2016) * Mon Mar 28 2016 Mark Pryor - 36.el7.centos - 4th build with 2.02~beta3 for Centos 7.2.1511 - removed (15aee573d2312ebf4aa) 0304-xen_file-Fix-invalid-payload-size.patch, it broke pvgrub2 kernel - added fedora system themes * Tue Mar 22 2016 Mark Pryor - 4.el7.centos - 3rd build with 2.02~beta3 for Centos 7.2.1511 - added bldplat macro (reuse build code for all 4 runs) - 3 new patches from grub.git - split off the new dbg RPM * Thu Mar 17 2016 Mark Pryor - 3.el7 - 2nd build of 2.02~beta3 for Centos 7.2.1511 - 7 patches (30x) from grub.git * Wed Mar 16 2016 Mark Pryor - 2.el7 - 1st build of 2.02~beta3 for Centos 7.2.1511 * Thu Oct 29 2015 Mark Pryor - 1.0 - Initial rpm build