From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XVj2q-0005EN-BD for mharc-grub-devel@gnu.org; Sun, 21 Sep 2014 11:27:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XVj2j-0005E0-Dn for grub-devel@gnu.org; Sun, 21 Sep 2014 11:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XVj2e-0005mt-Dv for grub-devel@gnu.org; Sun, 21 Sep 2014 11:27:17 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:52181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XVj2e-0005lo-6d for grub-devel@gnu.org; Sun, 21 Sep 2014 11:27:12 -0400 Received: by mail-wg0-f47.google.com with SMTP id y10so1824268wgg.30 for ; Sun, 21 Sep 2014 08:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=WkIV7XVxV/hIZ2Zmmz06dnW3VFrgzHo4gaq83Qsfkmg=; b=d9Oln8oxp1m1YPn7vB3o54Yvc4NkdO9Qf9SIj79PFQ+irbYzufBLh+nQzTuUwycc42 /99pLXx1MFliSmb/xI9S4mZX+nw20DgOOPI9mg5XD/z4gWZDCvp5IGVx+QhOa3Q46glr 5rcmVAt5vhrPNyyndU0UqNPFgpiKlvMHk+wHWZZAdOBp0Is4axuK4uPXkOSyAjO14g0A oUW6zRO4+b4eEsWIsDrCVKwcSnjtpZ5dbvUwK/NZaoZqNWQ6xk/3fcW5B/HAqAyIc/fC y5NqEbHpdRsVuDhla5Od55NlX2usr01gYmA0MGl4BpuwkBqHQOuojM8DzfTX8qWPpoo4 kncg== X-Received: by 10.181.11.133 with SMTP id ei5mr9878404wid.9.1411313226141; Sun, 21 Sep 2014 08:27:06 -0700 (PDT) Received: from [192.168.42.4] (160-228.197-178.cust.bluewin.ch. [178.197.228.160]) by mx.google.com with ESMTPSA id bg10sm9175087wjc.47.2014.09.21.08.27.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Sep 2014 08:27:05 -0700 (PDT) Message-ID: <541EEE46.2090500@gmail.com> Date: Sun, 21 Sep 2014 17:27:02 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] fix booting xenlinux kerenl error not on a xen domain References: <1411030716-31503-1-git-send-email-mchang@suse.com> In-Reply-To: <1411030716-31503-1-git-send-email-mchang@suse.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="h0dKEruoX6Iuc1pDRuc2r9EcDmi2LPExX" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Sep 2014 15:27:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h0dKEruoX6Iuc1pDRuc2r9EcDmi2LPExX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.09.2014 10:58, Michael Chang wrote: > There are two types of xen enabled kernel in linux, one is called > xenlinux which is older and can only boot on xen domain but not on any > real hardware without xen hypervisor. The other is called pvops which > can boot on xen domain as well as real hardware. >=20 > This patch is to prevent booting xenlinux kernel on real hardware by > filtering it out from boot menu. If not the error will show up when > attempting to boot it. >=20 > "Loading Linux xen ..." > error: invalid magic number > Loading initial ramdisk > error: you need to load the kernel first" >=20 > This patch achieves it by checking the host type, then disable xenlinux= > kernel from booting on hosts that is not xen pv domU, and meanwhile > allow xen pvops kernel to boot. > --- > util/grub.d/10_linux.in | 24 ++++++++++++++++++++++++ > 1 files changed, 24 insertions(+), 0 deletions(-) >=20 > diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in > index d2e2a8f..b055ccc 100644 > --- a/util/grub.d/10_linux.in > +++ b/util/grub.d/10_linux.in > @@ -207,6 +207,30 @@ while [ "x$list" !=3D "x" ] ; do > fi > done > =20 > + # check if host is xen pv domU > + if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ]; then > + dmi=3D/sys/class/dmi/id > + if [ -r "${dmi}/product_name" -a -r "${dmi}/sys_vendor" ]; then > + product_name=3D`cat ${dmi}/product_name` > + sys_vendor=3D`cat ${dmi}/sys_vendor` > + if test "${sys_vendor}" =3D "Xen" -a "${product_name}" =3D "HVM = domU"; then > + # host is xen HVM guest > + xen_pv_domU=3Dfalse > + fi > + fi > + else > + xen_pv_domU=3Dfalse > + fi > + Please don't determine system type at config file generation. Think of e.g. systems that can be bootable in either configuration. Use $grub_cpu and $grub_platofem runtime variables. > + if test "$xen_pv_domU" =3D "false" ; then > + # prevent xen kernel without pv_opt support from booting > + if (grep -qx "CONFIG_XEN=3Dy" "${config}" 2> /dev/null && ! grep -= qx "CONFIG_PARAVIRT=3Dy" "${config}" 2> /dev/null); then We're moving away from grepping in $config. Can you see if it can be integrated with grub_file? > + echo "Skip xenlinux kernel $linux" >&2 > + list=3D`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '= ` > + continue > + fi > + fi > + > initramfs=3D > if test -n "${config}" ; then > initramfs=3D`grep CONFIG_INITRAMFS_SOURCE=3D "${config}" | cut -= f2 -d=3D | tr -d \"` > -- 1.7.3.4 _______________________________________________ Grub-devel > mailing list Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --h0dKEruoX6Iuc1pDRuc2r9EcDmi2LPExX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EAREKAAYFAlQe7kYACgkQmBXlbbo5nOvmPAEAiOczkAkR5+9UymXFpIrCXXy8 Ah/0gk80FerunRfxToMBAIUw4AcCn+aEuF+McUMaR1ysQJOImwTcw8YdXtwxPJ8b =jBY2 -----END PGP SIGNATURE----- --h0dKEruoX6Iuc1pDRuc2r9EcDmi2LPExX--