SHA256
1
0
forked from pool/grub2

Accepting request 306321 from home:michael-chang:boo926795

- Support booting opensuse installer as PV DomU (boo#926795)
  * added grub2-xen.cfg for tracking default pvgrub2 xen configs rather than
    generating it from spec file
  * grub2-xen.cfg: from Olaf Hering <ohering@suse.com>

OBS-URL: https://build.opensuse.org/request/show/306321
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=156
This commit is contained in:
Andrei Borzenkov 2015-05-11 11:16:27 +00:00 committed by Git OBS Bridge
parent cfc8961525
commit 380eb71c90
3 changed files with 133 additions and 20 deletions

122
grub2-xen.cfg Normal file
View File

@ -0,0 +1,122 @@
insmod part_msdos
insmod part_gpt
insmod search
insmod configfile
insmod legacy_configfile
set debian_cddev=""
set debian_cdarch=""
if [ "${grub_cpu}" = "x86_64" ]; then
debian_cdarch="amd"
fi
if [ "${grub_cpu}" = "i386" ]; then
debian_cdarch="i386"
fi
if [ -n "${debian_cdarch}" ]; then
set debian_kern="/install.${debian_cdarch}/xen/vmlinuz"
set debian_initrd="/install.${debian_cdarch}/xen/initrd.gz"
search -s debian_domUcfg -f "/install.${debian_cdarch}/xen/debian.cfg"
search -s debian_cdkern -f "${debian_kern}"
search -s debian_cdinitrd -f "${debian_initrd}"
if [ -n "${debian_domUcfg}" -a -n "${debian_cdinitrd}" -a -n "${debian_cdkern}" -a "${debian_domUcfg}" = "${debian_cdinitrd}" -a "${debian_domUcfg}" = "${debian_cdkern}" ]; then
debian_cddev="${debian_domUcfg}"
fi
fi
set fedora_cddev=""
if [ "${grub_cpu}" = "x86_64" ]; then
set fedora_kern="/images/pxeboot/vmlinuz"
set fedora_initrd="/images/pxeboot/initrd.img"
search -s fedora_cdkern -f "${fedora_kern}"
search -s fedora_cdinitrd -f "${fedora_initrd}"
if [ -n "${fedora_cdkern}" -a -n "${fedora_cdinitrd}" -a "${fedora_cdkern}" = "${fedora_cdinitrd}" ]; then
set fedora_cddev="${fedora_cdkern}"
fi
fi
set suse_cddev=""
search -s suse_cddev_content -f "/content"
search -s suse_cddev_product -f "/media.1/products"
if [ -n "${suse_cddev_content}" -a -n "${suse_cddev_product}" -a "${suse_cddev_content}" = "${suse_cddev_product}" ]; then
set suse_cddev="${suse_cddev_content}"
fi
hdcfg_lst="/boot/grub2/grub.cfg \
/@/boot/grub2/grub.cfg \
/boot/grub/menu.lst \
/grub2/grub.cfg \
/grub/menu.lst"
set hdcfg=""
for c in ${hdcfg_lst}; do
if search -s hddev -f "${c}"; then
set hdcfg="${c}"
break
fi
done
set timeout=0
if [ -n "${debian_cddev}" ]; then
set timeout=8
menuentry "${debian_cddev} Debian Install" {
set root="${debian_cddev}"
linux "${debian_kern}" ignore_loglevel
initrd "${debian_initrd}"
}
fi
if [ -n "${fedora_cddev}" ]; then
set timeout=8
menuentry "${fedora_cddev} Fedora Install" {
set root="${fedora_cddev}"
linux "${fedora_kern}" ignore_loglevel
initrd "${fedora_initrd}"
}
menuentry "${fedora_cddev} Fedora Rescue" {
set root="${fedora_cddev}"
linux "${fedora_kern}" ignore_loglevel rescue
initrd "${fedora_initrd}"
}
fi
if [ -n "${suse_cddev}" ]; then
if [ "${grub_cpu}" = "i386" ]; then
set suse_cdarch="i586"
else
set suse_cdarch="${grub_cpu}"
fi
set timeout=8
set root="${suse_cddev}"
set suse_cdcfg="/boot/${suse_cdarch}/grub2-xen/grub.cfg"
set suse_cdkern="/boot/${suse_cdarch}/vmlinuz-xen"
set suse_cdinitrd="/boot/${suse_cdarch}/initrd-xen"
if [ -f "${suse_cdcfg}" ]; then
menuentry "${suse_cddev} SUSE Install menu" {
set root="${suse_cddev}"
configfile "${suse_cdcfg}"
}
elif [ -f "${suse_cdkern}" -a -f "$suse_cdinitrd" ]; then
menuentry "${suse_cddev} SUSE Install" {
linux "${suse_cdkern}" linemode=1 xencons=hvc0
initrd "${suse_cdinitrd}"
}
menuentry "${suse_cddev} SUSE Rescue" {
linux "${suse_cdkern}" linemode=1 xencons=hvc0 rescue=1
initrd "${suse_cdinitrd}"
}
menuentry "${suse_cddev} SUSE Upgrade" {
linux "${suse_cdkern}" linemode=1 xencons=hvc0 upgrade=1
initrd "${suse_cdinitrd}"
}
else
echo "the device ${suse_cddev} is not xen pv bootable"
fi
fi
if [ -n "${hddev}" ] ; then
set default="Boot From Hard Disk"
menuentry "${hddev} Boot From Hard Disk" {
set root="${hddev}"
configfile "${hdcfg}"
}
fi

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon May 11 08:50:14 UTC 2015 - mchang@suse.com
- Support booting opensuse installer as PV DomU (boo#926795)
* added grub2-xen.cfg for tracking default pvgrub2 xen configs rather than
generating it from spec file
* grub2-xen.cfg: from Olaf Hering <ohering@suse.com>
------------------------------------------------------------------- -------------------------------------------------------------------
Sun May 10 19:38:00 UTC 2015 - arvidjaar@gmail.com Sun May 10 19:38:00 UTC 2015 - arvidjaar@gmail.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package grub2 # spec file for package grub2
# #
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -146,6 +146,7 @@ Source11: SLES-UEFI-CA-Certificate.crt
Source12: grub2-snapper-plugin.sh Source12: grub2-snapper-plugin.sh
Source14: 80_suse_btrfs_snapshot Source14: 80_suse_btrfs_snapshot
Source15: grub2-once.service Source15: grub2-once.service
Source16: grub2-xen.cfg
Source1000: PATCH_POLICY Source1000: PATCH_POLICY
Patch1: rename-grub-info-file-to-grub2.patch Patch1: rename-grub-info-file-to-grub2.patch
Patch2: grub2-linux.patch Patch2: grub2-linux.patch
@ -525,25 +526,7 @@ cd build-xen
--program-transform-name=s,grub,%{name}, --program-transform-name=s,grub,%{name},
make %{?_smp_mflags} make %{?_smp_mflags}
cat > ./grub.cfg <<EOF ./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub.xen -O %{grubxenarch} -d grub-core/ "/boot/grub/grub.cfg=%{SOURCE16}"
insmod part_msdos
insmod part_gpt
insmod search
insmod configfile
insmod legacy_configfile
if search -s root -f /boot/grub2/grub.cfg ; then
configfile /boot/grub2/grub.cfg
elif search -s root -f /@/boot/grub2/grub.cfg ; then
configfile /@/boot/grub2/grub.cfg
elif search -s root -f /boot/grub/menu.lst ; then
legacy_configfile /boot/grub/menu.lst
elif search -s root -f /grub2/grub.cfg ; then
configfile /grub2/grub.cfg
elif search -s root -f /grub/menu.lst ; then
legacy_configfile /grub/menu.lst
fi
EOF
./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub.xen -O %{grubxenarch} -d grub-core/ "/boot/grub/grub.cfg=./grub.cfg"
cd .. cd ..
%endif %endif