sys-boot/egrub: add legacy grub with efi patches (grub-fedora)

(Portage version: 2.2.0_alpha4/svn/Linux x86_64)

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2739 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2010-11-13 17:03:41 +00:00
parent 1c013783d2
commit 5edc959ce8
6 changed files with 363 additions and 12 deletions

View File

@ -1,7 +1,14 @@
# ChangeLog for sys-boot/grub-efi
# ChangeLog for sys-boot/egrub
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
*egrub-0.97 (13 Nov 2010)
13 Nov 2010; Mario Fetka <mario.fetka@gmail.com> +egrub-0.97.ebuild,
+files/grub-0.97-egrub-gentoo-1.patch, egrub-1.98.ebuild,
+files/grub.conf.gentoo:
add legacy grub with efi patches (grub-fedora)
12 Nov 2010; Mario Fetka <mario.fetka@gmail.com> grub-efi-1.98.ebuild:
add proper depndencies

View File

@ -1,6 +1,12 @@
AUX grub-0.97-egrub-gentoo-1.patch 1970 RMD160 3be5062e48586a46306a20c1af4253d7db5ac895 SHA1 77a2ea66029f2676162fbb4a7b3b334a01b47942 SHA256 1ab8977a85d17769f96afa3386698b19a8eca5ca4276155f82ecf5efcde9c4d9
AUX grub-1.96-genkernel.patch 634 RMD160 bc1fdaa51e3f0e3b777a303e0f1c76987c7e69e5 SHA1 e79384a3ac32bfd74c884ead8133b1691a743316 SHA256 8ee327465d9b6d704a78b0c7b31cfdee7c6e7e9f9897e8d0a86198430f0c6ea0
AUX grub-1.98-efi_std_dir-1.patch 1257 RMD160 46f3fff434fee54f05adbad09a2bdfcc73320b5d SHA1 f45fd2f7d2f2c25e922b35cee3d06b7d59f07dcd SHA256 c348128612cc9d39be80a3f4fa4663fa1ed8dd27672494f3c9fcaabc045500c9
AUX grub.conf.gentoo 627 RMD160 d90fb4373bad476f98ec9c5065d6cdfd9e3b706f SHA1 004f2fc04605ec9190de0a87e7df8bbc33daff89 SHA256 914b15af252210a32776196437cd8013e10e57d5780e66877ef3fe9a2b4b9776
DIST egrub-0.97-patches-1.0.tar.bz2 257780 RMD160 c5a13239d0c8d828a8281a41ceda348989a103a7 SHA1 778a2f303131d4dcb041b095aac66175a3e6df5f SHA256 266a633035aba8461d31b5b20b8fa1b07d7fc774119fad1102bb232e710bbcb8
DIST grub-0.97.tar.gz 971783 RMD160 7fb5674edf0c950bd38e94f85ff1e2909aa741f0 SHA1 2580626c4579bd99336d3af4482c346c95dac4fb SHA256 4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b
DIST grub-1.98.tar.gz 2449386 RMD160 197fb8d7c673bd67ae81eda53a2baa2968cc1e69 SHA1 e83a2c438f4773a2e272c225983c0145e1ffd641 SHA256 bef2c1892e052967b65aab6aa62ac702c0e50ef8848506eacf3c0b2f5007c614
EBUILD grub-efi-1.98.ebuild 3158 RMD160 4a63d61acd117b5ef7b3d775390b5f58bc88227c SHA1 2422ff3fb69f06bf9d610b0a31d1e520075fdb67 SHA256 0d17281ef0be6fa0a8c0a9ae5929989e0835b2e80ac6e7a5356fdc2e1e82bc15
MISC ChangeLog 331 RMD160 2391c581ea93bda9b099f413baa368b156e95752 SHA1 9fd7482b6c5774ead2822eba6cebe97ee0dc5645 SHA256 da25f8658b461c61d4e2a13838a71b335c8c186b4933f1ec1e4fa1ed2f8edcd5
DIST splash.xpm.gz 33856 RMD160 2fead61f91c368429e80936248bb02af2bdf15ff SHA1 98e679f9698be43426f971f89a088c053e8c804a SHA256 b95600f777331b0dd31d51c68f60f0e846e4c8b628857a41165f4e6b30e6acaf
EBUILD egrub-0.97.ebuild 8313 RMD160 246d68d3fee060144339c594e2b093870c5a842c SHA1 e4b91d1318c3b1213c7a755f4db83d0414146fc7 SHA256 0c49064f38448a2cdf3f6c3c86db07b8b6600e168114223a2fea9c1ae351e36f
EBUILD egrub-1.98.ebuild 3362 RMD160 8b2239b69bcad1cbb517ed26badc84289c3825e3 SHA1 0cc96fc568054450709c91006a18d83fb469f703 SHA256 6576964e1469d54990e44bbe9d44e3a84b3402ec61bad83140a0841d054eadb7
MISC ChangeLog 563 RMD160 f880d297e0f3635078f84a38fd814f44dd83eef1 SHA1 79306f1cb3574f0c3b15ce52e8fb419494918c27 SHA256 2c2cccceeac60289326d84c6987f36e6ae40c7f5218cda2dc0156c9041e1799c
MISC metadata.xml 262 RMD160 afabce9377772aefb54102e9ef237de6bb1561f5 SHA1 c38f9b99d8a84beb40c114283d8d7ddd4ac43d9e SHA256 35a9c56d9c8418806062854a360c27690d25159524df71f28bbd4d644e8706f3

View File

@ -0,0 +1,258 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r10.ebuild,v 1.6 2010/09/02 21:19:37 robbat2 Exp $
# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
# all systems to grub.conf (and symlinking menu.lst to grub.conf), but
# we never updated any of the source code (it still all wants menu.lst),
# and there is no indication that upstream is making the transition.
EAPI=2
inherit mount-efi eutils flag-o-matic toolchain-funcs autotools linux-info pax-utils
PATCHVER="1.0" # Should match the revision ideally
DESCRIPTION="GNU GRUB Legacy boot loader EFI Edition"
HOMEPAGE="http://www.gnu.org/software/grub/"
SRC_URI="mirror://gentoo/grub-${PV}.tar.gz
ftp://alpha.gnu.org/gnu/${PN}/grub-${PV}.tar.gz
mirror://gentoo/splash.xpm.gz
mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2
http://ftp.disconnected-by-peer.at/efi/${P}-patches-${PATCHVER}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="custom-cflags"
DEPEND="sys-boot/gnu-efi"
RDEPEND="sys-boot/efibootmgr
sys-fs/dosfstools"
PROVIDE="virtual/bootloader"
S="${WORKDIR}"/grub-${PV}
#pkg_setup() {
# local arch="$(tc-arch)"
# case ${arch} in
# amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
# esac
#}
src_prepare() {
# patch breaks booting for some people #111885
# rm "${WORKDIR}"/patch/400_*reiser4*
if [[ -n ${PATCHVER} ]] ; then
EPATCH_SUFFIX="patch"
EPATCH_FORCE="yes" epatch "${WORKDIR}"/patch
fi
sed -e "s/^gnuefi_path=.*$/gnuefi_path=\/usr\/$(get_libdir)/g" \
-e "s/^LIBGNUEFI=.*$/LIBGNUEFI=\/usr\/$(get_libdir)\/libgnuefi.a/g" \
-i "${S}"/configure.in || die "failed to hack gnu-efi patch"
# rename grub tools to not interfer with grub
epatch "${FILESDIR}"/grub-0.97-egrub-gentoo-1.patch
# Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
# discovered in bug 160801. We can change this, however, using larger values
# for this variable means that Grub needs more memory to run and boot. For a
# kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
# value in make.conf, it is possible to make kernels ~16Mb in size, but it
# needs the kitchen sink built-in.
local t="custom"
if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
case $(tc-arch) in
amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
x86) GRUB_MAX_KERNEL_SIZE=5 ;;
esac
t="default"
fi
einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
sed -i \
-e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
"${S}"/grub/asmstub.c \
|| die "Failed to hack memory size"
eautoreconf
}
src_configure() {
filter-flags -fPIE #168834
unset BLOCK_SIZE #73499
### i686-specific code in the boot loader is a bad idea; disabling to ensure
### at least some compatibility if the hard drive is moved to an older or
### incompatible system.
# grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
# but the objcopy's (faulty) test fails if -fstack-protector is default.
# create a cache telling configure that objcopy is ok, and add -C to econf
# to make use of the cache.
#
# CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
# STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
# -fno-stack-protector detected by configure, removed from netboot's emake.
use custom-cflags || unset CFLAGS
export grub_cv_prog_objcopy_absolute=yes #79734
# Now build the regular grub
# Note that FFS and UFS2 support are broken for now - stage1_5 files too big
econf \
--libdir=/lib \
--datadir=/usr/lib/grub \
--exec-prefix=/ \
--disable-auto-linux-mem-opt \
--with-platform=efi \
--without-curses \
|| die "econf failed"
}
src_compile() {
emake || die "making regular stuff"
}
src_test() {
# non-default block size also give false pass/fails.
unset BLOCK_SIZE
make check || die "make check failed"
}
src_install() {
emake DESTDIR="${D}" install || die
# bug 330745
pax-mark -m "${D}"/sbin/egrub
# dont install nit needed files
rm -rf "${D}"/usr/lib
rm -rf "${D}"/usr/share/man/man1
rm -rf "${D}"/usr/share/info
rm "${D}"/usr/share/man/man8/grub-install.8
# rename man pages so they dont interfer with the one from grub
mv "${D}"/usr/share/man/man8/{,e}grub-crypt.8
mv "${D}"/usr/share/man/man8/{,e}grub-md5-crypt.8
mv "${D}"/usr/share/man/man8/{,e}grub-terminfo.8
mv "${D}"/usr/share/man/man8/{,e}grub.8
dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
newdoc docs/menu.lst grub.conf.sample
dodoc "${FILESDIR}"/grub.conf.gentoo
prepalldocs
insinto /usr/share/egrub
doins "${DISTDIR}"/splash.xpm.gz
insinto /boot/efi/EFI/grub
doins efi/grub.efi
}
setup_boot_dir() {
local boot_dir=$1
local dir=${boot_dir}
mkdir -p "${dir}"
#[[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
dir="${dir}/grub"
if [[ ! -e ${dir} ]] ; then
mkdir "${dir}" || die "${dir} does not exist!"
fi
# change menu.lst to grub.conf
if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
mv -f "${dir}"/menu.lst "${dir}"/grub.conf
ewarn
ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
ewarn
fi
#if [[ ! -e ${dir}/menu.lst ]]; then
# einfo "Linking from new grub.conf name to menu.lst"
# ln -snf grub.conf "${dir}"/menu.lst
#fi
#if [[ -e ${dir}/stage2 ]] ; then
# mv "${dir}"/stage2{,.old}
# ewarn "*** IMPORTANT NOTE: you must run grub and install"
# ewarn "the new version's stage1 to your MBR. Until you do,"
# ewarn "stage1 and stage2 will still be the old version, but"
# ewarn "later stages will be the new version, which could"
# ewarn "cause problems such as an unbootable system."
# ewarn "This means you must use either grub-install or perform"
# ewarn "root/setup manually! For more help, see the handbook:"
# ewarn "http://www.gentoo.org/doc/en/handbook/handbook-${ARCH}.xml?part=1&chap=10#grub-install-auto"
# ebeep
#fi
#einfo "Copying files from /lib/grub, /usr/lib/grub and /usr/share/grub to ${dir}"
einfo "Copying files from /usr/share/egrub to ${dir}"
for x in \
"${ROOT}"/usr/share/egrub/* ; do
[[ -f ${x} ]] && cp -p "${x}" "${dir}"/
done
# "${ROOT}"/lib*/grub/*/* \
# "${ROOT}"/usr/lib*/grub/*/* \
if [[ ! -e ${dir}/grub.conf ]] ; then
s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
[[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
[[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
[[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
fi
# Per bug 218599, we support grub.conf.install for users that want to run a
# specific set of Grub setup commands rather than the default ones.
grub_config=${dir}/grub.conf.install
[[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
if [[ -e ${grub_config} ]] ; then
egrep \
-v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
"${grub_config}" | \
/sbin/egrub --batch \
--device-map="${dir}"/device.map \
> /dev/null
fi
# the grub default commands silently piss themselves if
# the default file does not exist ahead of time
if [[ ! -e ${dir}/default ]] ; then
egrub-set-default --root-directory="${boot_dir}" default
fi
einfo "Grub has been installed to ${boot_dir} successfully."
}
pkg_postinst() {
if [[ -n ${DONT_MOUNT_BOOT} ]]; then
elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
elog "the following instructions for your /boot!"
elog "Neglecting to do so may cause your system to fail to boot!"
elog
else
setup_boot_dir "${ROOT}"/boot/efi/EFI
# Trailing output because if this is run from pkg_postinst, it gets mixed into
# the other output.
einfo ""
fi
elog "To interactively install grub files to another device such as a USB"
elog "stick, just run the following and specify the directory as prompted:"
elog " emerge --config =${PF}"
elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
elog "grub where to install in a non-interactive way."
}
pkg_config() {
local dir
if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
einfo "Enter the directory where you want to setup grub:"
read dir
else
dir="${GRUB_ALT_INSTALLDIR}"
fi
setup_boot_dir "${dir}"
}

View File

@ -20,14 +20,14 @@ HOMEPAGE="http://www.gnu.org/software/grub/"
LICENSE="GPL-3"
use multislot && SLOT="2" || SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="custom-cflags debug truetype multislot static"
KEYWORDS=""
IUSE="custom-cflags debug truetype multislot"
RDEPEND=">=sys-libs/ncurses-5.2-r5
dev-libs/lzo
truetype? ( media-libs/freetype media-fonts/unifont )
sys-boot/efibootmgr
sys-fs/dosfstools"
sys-fs/dosfstools"
DEPEND="${RDEPEND}
dev-lang/ruby"
PROVIDE="virtual/bootloader"
@ -61,7 +61,6 @@ src_unpack() {
src_compile() {
use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
use static && append-ldflags -static
econf \
--disable-werror \
@ -82,12 +81,18 @@ src_install() {
cat <<-EOF >> "${D}"/lib*/grub/grub-mkconfig_lib
GRUB_DISTRIBUTOR="Gentoo"
EOF
sed -i "s:grub-install:egrub-install:" "${D}"/sbin/grub-install || die
mv "${D}"/sbin/{,e}grub-install || die
mv "${D}"/sbin/{,e}grub-set-default || die
mv "${D}"/usr/share/man/man8/{,e}grub-install.8 || die
mv "${D}"/usr/share/info/{,e}grub.info || die
if use multislot ; then
sed -i "s:grub-install:grub2-install:" "${D}"/sbin/grub-install || die
mv "${D}"/sbin/grub{,2}-install || die
mv "${D}"/sbin/grub{,2}-set-default || die
mv "${D}"/usr/share/man/man8/grub{,2}-install.8 || die
mv "${D}"/usr/share/info/grub{,2}.info || die
sed -i "s:egrub-install:egrub2-install:" "${D}"/sbin/egrub-install || die
mv "${D}"/sbin/egrub{,2}-install || die
mv "${D}"/sbin/egrub{,2}-set-default || die
mv "${D}"/usr/share/man/man8/egrub{,2}-install.8 || die
mv "${D}"/usr/share/info/egrub{,2}.info || die
fi
}

View File

@ -0,0 +1,59 @@
diff -uNr grub-0.97.orig//configure.in grub-0.97/configure.in
--- grub-0.97.orig//configure.in 2010-11-13 15:40:39.000000000 +0100
+++ grub-0.97/configure.in 2010-11-13 16:17:10.000000000 +0100
@@ -755,5 +755,5 @@
docs/Makefile lib/Makefile util/Makefile \
grub/Makefile netboot/Makefile util/grub-crypt \
util/grub-image util/grub-install util/grub-md5-crypt \
- util/grub-terminfo])
+ util/grub-terminfo util/grub-set-default ])
AC_OUTPUT
diff -uNr grub-0.97.orig//grub/Makefile.am grub-0.97/grub/Makefile.am
--- grub-0.97.orig//grub/Makefile.am 2010-11-13 15:40:39.000000000 +0100
+++ grub-0.97/grub/Makefile.am 2010-11-13 15:41:30.000000000 +0100
@@ -1,4 +1,4 @@
-sbin_PROGRAMS = grub
+sbin_PROGRAMS = egrub
if SERIAL_SPEED_SIMULATION
SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1
@@ -15,5 +15,5 @@
AM_CFLAGS = $(GRUB_CFLAGS)
-grub_SOURCES = main.c asmstub.c efitftp.c
-grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)
+egrub_SOURCES = main.c asmstub.c efitftp.c
+egrub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)
diff -uNr grub-0.97.orig//util/Makefile.am grub-0.97/util/Makefile.am
--- grub-0.97.orig//util/Makefile.am 2010-11-13 15:40:39.000000000 +0100
+++ grub-0.97/util/Makefile.am 2010-11-13 16:16:30.000000000 +0100
@@ -1,7 +1,7 @@
if !PLATFORM_EFI
bin_PROGRAMS = mbchk
-sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo grub-crypt
+sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo grub-crypt grub-set-default
noinst_SCRIPTS = grub-image mkbimage
EXTRA_DIST = mkbimage
@@ -14,6 +14,18 @@
else
-sbin_SCRIPTS = grub-md5-crypt grub-terminfo grub-crypt
+sbin_SCRIPTS = egrub-md5-crypt egrub-terminfo egrub-crypt egrub-set-default
+
+egrub-md5-crypt:
+ cp grub-md5-crypt egrub-md5-crypt
+
+egrub-terminfo:
+ cp grub-terminfo egrub-terminfo
+
+egrub-crypt:
+ cp grub-crypt egrub-crypt
+
+egrub-set-default:
+ cp grub-set-default egrub-set-default
endif

View File

@ -0,0 +1,16 @@
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
# If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.
default 0
timeout 30
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
#title Gentoo Linux 2.6.24-r5
#root (hd0,0)
#kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 real_root=/dev/sda3
#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5
# vim:ft=conf: