Commit 95eade3c authored by philm's avatar philm

add grub2 with efi support

parent e5031c47
#
# Core Packages for Chakra, part of chakra-project.org
#
# maintainer: Phil Miller <philm[at]chakra-project[dot]org
## This PKGBUILD has the same structure as the main grub2 split PKGBUILD for grub2-common, grub2-bios and grub2-efi-i386 .
# _grub2_rev=3238
_grub2_lua_ver=20
_grub2_gpxe_ver=12
pkgname="grub2-efi-x86_64"
pkgver='1.99'
pkgrel=1
pkgdesc="The GNU GRand Unified Bootloader version 2 - x86_64 UEFI version"
url="http://www.gnu.org/software/grub/"
arch=('any')
license=('GPL3')
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
optdepends=('mtools')
makedepends=('python2' 'xz' 'autogen' 'texinfo' 'help2man' 'gettext')
options=(strip purge docs zipman !emptydirs)
replaces=('grub2-efi-x64')
# "http://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
source=("ftp://ftp.gnu.org/gnu/grub/grub-1.99.tar.xz"
"http://chakra-project.org/sources/grub2/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"http://chakra-project.org/sources/grub2/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz")
noextract=("grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz")
sha1sums=('a5ae9558f30ce7757a76aa130088b053a87e2fb6'
'd21ca5033f7069cbb36934cdb71f57a1c7829234'
'6c58eee654fa4eb7f057275b330710ffd4a9e989')
build() {
if [ "${CARCH}" = 'i686' ]; then
echo "This package can be built only in a x86_64 system. Exiting."
exit 1
fi
# add grub-extras
export GRUB_CONTRIB=${srcdir}/grub-${pkgver}/grub2-extras/
install -d ${srcdir}/grub-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz \
-C ${srcdir}/grub-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz \
-C ${srcdir}/grub-${pkgver}/grub2-extras
## need to use python2
sed -i 's|python|python2|' ${srcdir}/grub-${pkgver}/autogen.sh
# start the actual build process
cd ${srcdir}/grub-${pkgver}
./autogen.sh
CFLAGS="" ./configure --with-platform=efi \
--target=x86_64 --host=${CARCH}-unknown-linux-gnu \
--program-transform-name=s,grub,grub, \
--enable-mm-debug --disable-efiemu \
--enable-grub-mkfont --enable-nls \
--prefix=/usr --bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info \
--sysconfdir=/etc
CFLAGS="" make
}
package() {
cd ${srcdir}/grub-${pkgver}
make DESTDIR=${pkgdir} install
## remove non platform-specific files
rm -rf ${pkgdir}/{boot,bin,sbin,etc,usr/share}
rm ${pkgdir}/usr/lib/grub/{grub-mkconfig_lib,update-grub_lib}
}
#!/bin/bash -e
cat << EOF
set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue
EOF
#
# Core Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
# maintainer: Phil Miller <philm[at]chakra-project[dot]org
# include global config
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
# _grub2_rev=3238
pkgname=grub2
pkgver=1.98
_grub2_lua_ver=20
_grub2_gpxe_ver=12
_grub2_ntldr_ver=17
_grub2_915_ver=7
pkgname=('grub2-common' 'grub2-bios' 'grub2-efi-i386')
pkgbase="grub2"
pkgver='1.99'
pkgrel=1
pkgdesc="The GNU GRand Unified Bootloader"
url="http://www.gnu.org/software/grub/"
arch=('i686' 'x86_64')
license=('GPL3')
depends=('sh' 'lzo2' 'freetype2')
optdepends=('ruby:usr/share/grub/genmk.rb script' 'libusb: /sbin/grub-emu' 'gettext: /sbin/grub-mkconfig')
makedepends=('bdf-unifont' 'ruby')
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
conflicts=('grub')
provides=('grub')
source=(ftp://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.gz
'chakralinux-script-fixes.patch'
'gfxmenu-dependencies.patch'
'menucolors-in-mkconfig.patch'
'background-image-in-mkconfig.patch'
'hidden-timeout-fix.patch'
'grub.default'
'grub.cfg'
'20_memtest86+'
'lvm-detection.patch')
md5sums=('c0bcf60e524739bb64e3a2d4e3732a59'
'0910da120700a6928cd0290211acc79f'
'897f8af2fc83fcdaf7329da39f06d3dc'
'00ae9ff8991b8f00ab90739859af2921'
'fa14d3feabe17ac11dd3163501a66155'
'81bcdf26aa01b08b9925d72cbc4c3dab'
'6cdfe6bbe7e8fd0d6079d404d810f1bd'
'43cf74b91918e3bdec6dee0acc1c7032'
'5a07e04c4ecb8ed145d54fec3043e0d5'
'60b0157ed87041541ad0f62e3c7c0577')
makedepends=('bdf-unifont' 'python2' 'xz' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper')
options=(strip purge docs zipman !emptydirs)
# "http://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
source=("ftp://ftp.gnu.org/gnu/grub/grub-1.99.tar.xz"
"http://chakra-project.org/sources/${pkgname}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"http://chakra-project.org/sources/${pkgname}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"http://chakra-project.org/sources/${pkgname}/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"http://chakra-project.org/sources/${pkgname}/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz"
'chakra_grub2_mkconfig_fixes.patch'
'grub.default'
'grub.cfg'
'20_memtest86+')
noextract=("grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz")
sha1sums=('a5ae9558f30ce7757a76aa130088b053a87e2fb6'
'd21ca5033f7069cbb36934cdb71f57a1c7829234'
'6c58eee654fa4eb7f057275b330710ffd4a9e989'
'0e50955141a45918fcf56f3a5e15fb477f0448a7'
'f2a5f1d5b75bd3286b63aefaf5e6553aa03e772b'
'9334c23b9d5525e24c204ab45f9de253809d8fbc'
'717bba46ea5c9903ccbb9b1486ff594b66dbe359'
'6d4f4a3899a0a343771e258cfb3f86172791e7e9'
'82a27eca5277218cf57c6c5767e0b17a72f62229')
build() {
cd $srcdir/grub-${pkgver}
# some random patches to facilitate automatic creation of grub.cfg
patch -Np1 -i ${srcdir}/chakralinux-script-fixes.patch
patch -Np1 -i ${srcdir}/gfxmenu-dependencies.patch
patch -Np1 -i ${srcdir}/menucolors-in-mkconfig.patch
patch -Np1 -i ${srcdir}/background-image-in-mkconfig.patch
patch -Np1 -i ${srcdir}/hidden-timeout-fix.patch
# fix lvm symlink detection
patch -Np0 -i ${srcdir}/lvm-detection.patch
# run autogen.sh to create configure files
./autogen.sh
# fix unifont.bdf location
sed -i 's|/usr/src/unifont.bdf|/usr/share/fonts/misc/unifont.bdf|' configure
CFLAGS= ./configure --prefix=/usr --enable-grub-mkfont --bindir=/bin \
--sbindir=/sbin --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc
# set architecture dependent variables
if [ "${CARCH}" = "x86_64" ] ; then
_EFIEMU="--enable-efiemu"
else
_EFIEMU="--disable-efiemu"
fi
_HOST="${CARCH}"
CFLAGS= make
build_grub2-common_and_bios
build_grub2-efi
}
package() {
cd $srcdir/grub-${pkgver}
make DESTDIR=${pkgdir} install
build_grub2-common_and_bios() {
# copy the source for building the common/bios package
cp -r ${srcdir}/grub-${pkgver} ${srcdir}/grub2_bios-${pkgver}
## Apply Archlinux specific fixes to enable grub2-mkconfig detect Arch kernels and initramfs
cd ${srcdir}/grub2_bios-${pkgver}
patch -Np1 -i ${srcdir}/chakra_grub2_mkconfig_fixes.patch
# install /etc/default/grub
install -Dm644 ${srcdir}/grub.default ${pkgdir}/etc/default/grub
# add the grub-extra sources
export GRUB_CONTRIB=${srcdir}/grub2_bios-${pkgver}/grub2-extras/
install -d ${srcdir}/grub2_bios-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz \
-C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz \
-C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz \
-C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz \
-C ${srcdir}/grub2_bios-${pkgver}/grub2-extras
## Need to use python2
sed -i 's|python|python2|' ${srcdir}/grub2_bios-${pkgver}/autogen.sh
# install grub.cfg (needed so it doesn't get removed on upgrading because it was previously here)
install -Dm644 ${srcdir}/grub.cfg ${pkgdir}/boot/grub/grub.cfg
# start the actual build process
cd ${srcdir}/grub2_bios-${pkgver}
./autogen.sh
## fix unifont.bdf location so grub-mkfont can create *.pf2 files
sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' ${srcdir}/grub2_bios-${pkgver}/configure
# mkdir ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
# cd ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
CFLAGS="" ./configure \
--with-platform=pc --enable-mm-debug \
${_EFIEMU} --host=${CARCH}-unknown-linux-gnu \
--enable-grub-mkfont --prefix=/usr \
--bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info \
--sysconfdir=/etc --enable-nls \
--program-transform-name=s,grub,grub,
CFLAGS="" make
}
# install memtest config detection
install -Dm755 ${srcdir}/20_memtest86+ ${pkgdir}/etc/grub.d/20_memtest86+
build_grub2-efi() {
# copy the source for building the efi package
cp -r ${srcdir}/grub-${pkgver} ${srcdir}/grub2_efi-${pkgver}
# add the grub-extra sources
export GRUB_CONTRIB=${srcdir}/grub2_efi-${pkgver}/grub2-extras/
install -d ${srcdir}/grub2_efi-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz \
-C ${srcdir}/grub2_efi-${pkgver}/grub2-extras
bsdtar xf ${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz \
-C ${srcdir}/grub2_efi-${pkgver}/grub2-extras
## Need to use python2
sed -i 's|python|python2|' ${srcdir}/grub2_efi-${pkgver}/autogen.sh
# start the actual build process
cd ${srcdir}/grub2_efi-${pkgver}
./autogen.sh
CFLAGS="" ./configure \
--with-platform=efi --target=i386 \
--enable-mm-debug --disable-efiemu \
--host=${CARCH}-unknown-linux-gnu \
--prefix=/usr --bindir=/bin \
--sbindir=/sbin --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc \
--enable-nls --program-transform-name=s,grub,grub,
CFLAGS="" make
}
package_grub2-common() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Files common for all platforms"
install="grub2.install"
depends=('xz' 'freetype2' 'device-mapper' 'gettext' 'texinfo')
conflicts=('grub')
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
cd ${srcdir}/grub2_bios-${pkgver}
make DESTDIR=${pkgdir} install
install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_bios-install
install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_efi_x86_64-install
install -Dm755 ${pkgdir}/sbin/grub-install ${pkgdir}/sbin/grub_efi_i386-install
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=pc|" \
${pkgdir}/sbin/grub_bios-install
sed -i "s|^\(target_cpu\)=.*|\1=x86_64|; \
s|^\(platform\)=.*|\1=efi|" \
${pkgdir}/sbin/grub_efi_x86_64-install
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=efi|" \
${pkgdir}/sbin/grub_efi_i386-install
## install extra /etc/grub.d/ files
install -Dm755 ${srcdir}/20_memtest86+ ${pkgdir}/etc/grub.d/20_memtest86+
## install /etc/default/grub (used by grub-mkconfig)
install -Dm644 ${srcdir}/grub.default ${pkgdir}/etc/default/grub
## install grub.cfg (needed so it doesn't get removed on upgrading because it was previously here)
install -Dm644 ${srcdir}/grub.cfg ${pkgdir}/boot/grub/grub.cfg
# remove platform specific files
rm -rf ${pkgdir}/usr/lib/grub/i386-pc/
}
package_grub2-bios() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Built for PC BIOS"
depends=(grub2-common=${pkgver})
replaces=('grub2')
provides=('grub2')
cd ${srcdir}/grub2_bios-${pkgver}
make DESTDIR=${pkgdir} install
## remove non platform-specific files
rm -rf ${pkgdir}/{boot,bin,sbin,etc,usr/share}
rm ${pkgdir}/usr/lib/grub/{grub-mkconfig_lib,update-grub_lib}
}
package_grub2-efi-i386() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI version"
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
optdepends=('mtools')
cd ${srcdir}/grub2_efi-${pkgver}
make DESTDIR=${pkgdir} install
## remove non platform-specific files
rm -rf ${pkgdir}/{boot,bin,sbin,etc,usr/share}
rm ${pkgdir}/usr/lib/grub/{grub-mkconfig_lib,update-grub_lib}
}
diff -urN grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-10 20:30:56.319608325 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-10 23:01:20.856612701 -0400
@@ -104,6 +104,20 @@
terminal gfxterm
fi
EOF
+if [ x$GRUB_BACKGROUND != x ] && [ -f $GRUB_BACKGROUND ] \
+ && is_path_readable_by_grub $GRUB_BACKGROUND; then
+ echo "Found background: $GRUB_BACKGROUND" >&2
+ case $GRUB_BACKGROUND in
+ *.png) reader=png ;;
+ *.tga) reader=tga ;;
+ *.jpg|*.jpeg) reader=jpeg ;;
+ esac
+ prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_BACKGROUND` | sed -e "s/^/ /"
+ cat << EOF
+ insmod $reader
+ background_image (\$root)`make_system_path_relative_to_its_root $GRUB_BACKGROUND`
+EOF
+fi
if [ x$GRUB_THEME != x ] && [ -f $GRUB_THEME ] \
&& is_path_readable_by_grub $GRUB_THEME; then
echo "Found theme: $GRUB_THEME" >&2
diff -urN grub-1.98.orig/util/grub-mkconfig.in grub-1.98/util/grub-mkconfig.in
--- grub-1.98.orig/util/grub-mkconfig.in 2010-03-10 20:30:56.319608325 -0400
+++ grub-1.98/util/grub-mkconfig.in 2010-03-10 20:34:00.689582261 -0400
@@ -220,6 +220,7 @@
GRUB_DISABLE_LINUX_UUID \
GRUB_DISABLE_LINUX_RECOVERY \
GRUB_GFXMODE \
+ GRUB_BACKGROUND \
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \
diff -Nur a/util/grub.d/00_header.in b/util/grub.d/00_header.in
--- a/util/grub.d/00_header.in 2011-04-06 13:14:27.000000000 +0200
+++ b/util/grub.d/00_header.in 2011-04-26 09:23:02.371574484 +0200
@@ -100,6 +100,14 @@
EOF
+if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
+ cat << EOF
+set menu_color_normal=$GRUB_COLOR_NORMAL
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
+
+EOF
+fi
+
serial=0;
gfxterm=0;
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
diff -Nur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
--- a/util/grub.d/10_linux.in 2011-04-18 23:18:49.000000000 +0200
+++ b/util/grub.d/10_linux.in 2011-04-26 10:16:54.397538449 +0200
@@ -48,7 +48,7 @@
|| uses_abstraction "${GRUB_DEVICE}" lvm; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
+ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
fi
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
@@ -65,7 +65,9 @@
version="$2"
recovery="$3"
args="$4"
- if ${recovery} ; then
+ if [ -n "$5" ] ; then
+ title="$(gettext_quoted "%s, with Linux %s") $5"
+ elif ${recovery} ; then
title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
else
title="$(gettext_quoted "%s, with Linux %s")"
@@ -121,11 +123,11 @@
case x`uname -m` in
xi?86 | xx86_64)
- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ list=`for i in /boot/vmlinuz* /vmlinuz* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
*)
- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ list=`for i in /boot/vmlinuz* /boot/vmlinux* /vmlinuz* /vmlinux* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
esac
@@ -148,7 +150,8 @@
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
"initramfs-genkernel-${version}" \
- "initramfs-genkernel-${alt_version}"; do
+ "initramfs-genkernel-${alt_version}" \
+ "${basename/vmlinuz/kernel}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
@@ -178,6 +181,11 @@
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ if test -e "${dirname}/${basename/vmlinuz/kernel}-fallback.img"; then
+ initrd="${basename/vmlinuz/kernel}-fallback.img"
+ linux_entry "${OS}" "${version}" true \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" Fallback
+ fi
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"
diff -Nur a/util/grub-mkconfig.in b/util/grub-mkconfig.in
--- a/util/grub-mkconfig.in 2011-04-06 17:45:53.000000000 +0200
+++ b/util/grub-mkconfig.in 2011-04-26 09:23:02.371574484 +0200
@@ -33,6 +33,7 @@ datadir=@datadir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_cfg=""
grub_mkconfig_dir=${sysconfdir}/grub.d
+resume_hook=1
self=`basename $0`
@@ -52,6 +53,7 @@ Generate a grub config file
-o, --output=FILE output generated config to FILE [default=stdout]
-h, --help print this message and exit
-v, --version print the version information and exit
+ -s, --skip-resume disable resume hook setup
Report bugs to <bug-grub@gnu.org>.
EOF
@@ -86,6 +88,9 @@ do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
+ -s | --skip-resume)
+ resume_hook=0
+ ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@@ -252,6 +252,8 @@
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \
+ GRUB_COLOR_NORMAL \
+ GRUB_COLOR_HIGHLIGHT \
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT \
GRUB_BADRAM
@@ -293,6 +298,18 @@ for i in ${grub_mkconfig_dir}/* ; do
esac
done
+if [ "${resume_hook}" == 1 ]; then
+ echo "Setup resume hook" >&2
+ SWAP=`swapon -a | cat /proc/swaps | grep /dev | cut -d" " -f1`
+ if [ -z "${SWAP}" ]; then
+ echo "No swap partition found. Create one to enable hibernation..." >&2
+ else
+ echo "Adding swap partition $SWAP" >&2
+ SWAPUUID=`blkid $SWAP -s UUID -o value`
+ sed -i -e "s~root=/dev~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev~g" ${grub_cfg}.new
+ fi
+fi
+
if test "x${grub_cfg}" != "x" ; then
if ! ${grub_script_check} ${grub_cfg}.new; then
echo "Syntax errors are detected in generated GRUB config file." >&2
diff -ur grub-1.98.orig/util/grub.d/10_linux.in grub-1.98/util/grub.d/10_linux.in
--- grub-1.98.orig/util/grub.d/10_linux.in 2010-03-13 22:10:15.953099258 -0400
+++ grub-1.98/util/grub.d/10_linux.in 2010-03-13 22:10:44.217896122 -0400
@@ -30,8 +30,8 @@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
+ OS="${GRUB_DISTRIBUTOR}"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | tr -d ' ') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -46,7 +46,7 @@
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
+ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
fi
linux_entry ()
@@ -97,7 +97,7 @@
EOF
}
-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+list=`for i in /boot/vmlinu[xz]* /vmlinu[xz]* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
@@ -109,13 +109,12 @@
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
- alt_version=`echo $version | sed -e "s,\.old$,,g"`
+ base_init=`echo $basename | sed -e "s,vmlinuz,kernel,g"`
+ alt_version="${base_init}-fallback"
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
- for i in "initrd.img-${version}" "initrd-${version}.img" \
- "initrd-${version}" "initrd.img-${alt_version}" \
- "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+ for i in "${base_init}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
@@ -130,6 +129,9 @@
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ initrd="${alt_version}.img"
+ linux_entry "${OS}" "${version} Fallback" false \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"
diff --git a/grub-core/lib/i386/relocator16.S b/grub-core/lib/i386/relocator16.S
index c3768f4..982415d 100644
--- a/grub-core/lib/i386/relocator16.S
+++ b/grub-core/lib/i386/relocator16.S
@@ -130,7 +130,7 @@ VARIABLE(grub_relocator16_ss)
.byte 0xb8
VARIABLE(grub_relocator16_sp)
.word 0
- movw %ax, %ss
+ movzwl %ax, %esp
/* movw imm32, %edx. */
.byte 0x66, 0xba
diff -ur grub-1.98.orig/util/grub.d/00_header.in grub-1.98/util/grub.d/00_header.in
--- grub-1.98.orig/util/grub.d/00_header.in 2010-03-12 12:54:12.686589681 -0400
+++ grub-1.98/util/grub.d/00_header.in 2010-03-13 01:55:04.425437673 -0400
@@ -108,6 +108,28 @@
&& is_path_readable_by_grub $GRUB_THEME; then
echo "Found theme: $GRUB_THEME" >&2
prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /"
+ theme_dir=`dirname $GRUB_THEME`
+ old_reader="null"
+ # add any font dependency
+ for f in ${theme_dir}/*.pf2 ; do
+ if [ -e $f ] ; then
+ echo " loadfont (\$root)`make_system_path_relative_to_its_root $f`"
+ fi
+ done
+ # adding insmod dependencies for images
+ for f in ${theme_dir}/*.{jpg,jpeg,png,tga} ; do
+ if [ -e $f ] ; then
+ case $f in
+ *.png) reader=png ;;
+ *.tga) reader=tga ;;
+ *.jpg|*.jpeg) reader=jpeg ;;
+ esac
+ if [ $old_reader != $reader ] ; then
+ echo " insmod ${reader}"
+ old_reader=$reader
+ fi
+ fi
+ done
cat << EOF
insmod gfxmenu
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
diff -Nru grub-1.96.orig/kern/i386/pc/startup.S grub-1.96/kern/i386/pc/startup.S
--- grub-1.96.orig/kern/i386/pc/startup.S 2008-02-03 14:11:32.000000000 +0100
+++ grub-1.96_20081229/kern/i386/pc/startup.S 2008-02-17 06:22:54.000000000 +0100
@@ -594,15 +594,15 @@
call EXT_C(grub_dl_unload_all)
+ /* Turn off Gate A20 */
+ xorl %eax, %eax
+ call EXT_C(grub_gate_a20)
+
/* set up to pass boot drive */
popl %edx
/* ESI must point to a partition table entry */
popl %esi
-
- /* Turn off Gate A20 */
- xorl %eax, %eax
- call EXT_C(grub_gate_a20)
call prot_to_real
.code16
# Config file for GRUB2 - The GNU GRand Unified Bootloader
# /boot/grub/grub.cfg
# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/sda (hd0)
# /dev/sdb2 (hd1,2)
# /dev/sda3 (hd0,3)
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
# Timeout for menu
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}
insmod part_msdos
insmod ext2