From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OFFYg-0004tl-Jm for mharc-grub-devel@gnu.org; Thu, 20 May 2010 19:53:46 -0400 Received: from [140.186.70.92] (port=58541 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFFYe-0004tg-7r for grub-devel@gnu.org; Thu, 20 May 2010 19:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFFYb-0004i9-O9 for grub-devel@gnu.org; Thu, 20 May 2010 19:53:44 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:50018) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFFYb-0004i1-Cx for grub-devel@gnu.org; Thu, 20 May 2010 19:53:41 -0400 Received: by ewy8 with SMTP id 8so93700ewy.8 for ; Thu, 20 May 2010 16:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=b8tTjmTLcjHYVXJhNhEKAlEWvz79WqzhlaRAj0SuYEg=; b=WmrPExsMd+j5bXO6I8ZcgCM+OGn2adO1Jy/Lv+iH74aixCDtaWs3kTJI95oPqZnZz+ gKJEP0tmTsEBdmSgbJ+pPdObS28zT7Z49zDKfSAjk+uaF28oAeKp2PNKk3gZf+A9dUD2 p42FWw6HkPBJIyEG9f3P4IwBYNEPZdwRsSKXo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=N99SK0nQ4vtfq4BMmvtlmI4RPLF8Imw5484s/LUqBuZsIXK1Sf4xt7Kp58/eydI/ej nTFtilj52Y8EDtrlNfxLf2pO2qjXEJEXHD8rZAjfk/9fAV1eeKEMBV9orOhskJFWJ3PE to7GEKu6F4YX8JNLakqTqdQdnRWUNKHDTg484= Received: by 10.213.55.8 with SMTP id s8mr256485ebg.57.1274399619343; Thu, 20 May 2010 16:53:39 -0700 (PDT) Received: from debian.bg45.phnet (gprs35.swisscom-mobile.ch [193.247.250.35]) by mx.google.com with ESMTPS id 16sm211062ewy.11.2010.05.20.16.53.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 May 2010 16:53:38 -0700 (PDT) Message-ID: <4BF5CB75.20101@gmail.com> Date: Fri, 21 May 2010 01:53:25 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GNU GRUB References: In-Reply-To: X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig09C0BBB4BD307538ABC6DE15" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: update-grub & Xen boot stanza generation X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 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: Thu, 20 May 2010 23:53:45 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig09C0BBB4BD307538ABC6DE15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Bruce Edge wrote: > Hi > Apologies in advance if this is already in the works. > > I wanted to provide an etc/grub.d rule for generating boot stanzas for > Xen based systems such that it would end up in the upstream grub releas= e. > If this conforms to the appropriate conventions, could someone > possibly add it ? > > It's basically a copy of etc/grub.d/10_linux and adds checks for dom0 > capable kernels. I picked "09_" as I assumed that one would want to > default to the Xen boot entry, but that may be a matter of some debate.= > This is aready worked on but the problem is that it generates too much entries. If you have 5 different versions of hypervisor and 10 different kernels you have 100 entries. > Thanks > > -Bruce > > > #!/bin/bash -e > #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > # > # FILE: 09_xen > #=20 > # USAGE: update-grub ... with this in /etc/grub.d > #=20 > # DESCRIPTION: Generate grub2 boot stanza for Xen systems > # Xen boot entries are automatically > added to grub.cfg > # The 09-... name prefix puts the Xen > boot entries before=20 > # the linux kernel entries > #=20 > # OPTIONS: --- > # REQUIREMENTS: --- grub2, Xen hypervisor > # BUGS: --- probably > # NOTES: --- Copied from 10_linux with a few hacks to make ir > work for Xen. > # Incorporated suggestions to > only do this for valid dom0 kernels > # AUTHOR: Bruce Edge (BRE), bruce.edge@lsi.com > =20 > # COMPANY: LSI > # VERSION: 1.0 > # CREATED: 05/19/2010 02:32:34 PM PDT > # REVISION: --- > #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > prefix=3D/usr > exec_prefix=3D${prefix} > libdir=3D${exec_prefix}/lib > . ${libdir}/grub/update-grub_lib > > if [ "x${GRUB_DISTRIBUTOR}" =3D "x" ] ; then > OS=3DGNU/Linux > else > OS=3D"${GRUB_DISTRIBUTOR}" > fi > > # Source grub defaults > . /etc/default/grub > > # loop-AES arranges things so that /dev/loop/X can be our root device, = but > # the initrds that Linux uses don't like that. > case ${GRUB_DEVICE} in > /dev/loop/*|/dev/loop[0-9]) > GRUB_DEVICE=3D`losetup ${GRUB_DEVICE} | sed -e > "s/^[^(]*(\([^)]\+\)).*/\1/"` > ;; > esac > > if [ "x${GRUB_DEVICE_UUID}" =3D "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}= " > =3D "xtrue" ] \ > || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then > LINUX_ROOT_DEVICE=3D${GRUB_DEVICE} > else > LINUX_ROOT_DEVICE=3DUUID=3D${GRUB_DEVICE_UUID} > fi > > test_gt () > { > local a=3D`echo $1 | sed -e > "s,.*/vmlinu[zx]-,,g;s/[._-]\(pre\|rc\|test\|git\|old\)/~\1/g"` > local b=3D`echo $2 | sed -e > "s,.*/vmlinu[zx]-,,g;s/[._-]\(pre\|rc\|test\|git\|old\)/~\1/g"` > if [ "x$b" =3D "x" ] ; then > return 0 > fi > dpkg --compare-versions "$a" gt "$b" > return $? > } > > find_latest () > { > local a=3D"" > for i in $@ ; do > if test_gt "$i" "$a" ; then > a=3D"$i" > fi > done > echo "$a" > } > > list=3D`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do > if grub_file_is_not_garbage "$i" && grep -q 'DOM0=3Dy' > ${i/vmlinu[xz]/config} ; then echo -n "$i " ; fi > done` > > while [ "x$list" !=3D "x" ] ; do > linux=3D`find_latest $list` > echo "Found linux image: $linux" >&2 > basename=3D`basename $linux` > dirname=3D`dirname $linux` > rel_dirname=3D`make_system_path_relative_to_its_root $dirname` > version=3D`echo $basename | sed -e "s,^[^0-9]*-,,g"` > alt_version=3D`echo $version | sed -e "s,\.old$,,g"` > linux_root_device_thisversion=3D"${LINUX_ROOT_DEVICE}" > > initrd=3D > for i in "initrd.img-${version}" "initrd-${version}.img" \ > "initrd.img-${alt_version}" "initrd-${alt_version}.img"; do > if test -e "${dirname}/${i}" ; then > initrd=3D"$i" > break > fi > done > if test -n "${initrd}" ; then > echo "Found initrd image: ${dirname}/${initrd}" >&2 > else > # "UUID=3D" magic is parsed by initrds. Since there's no initrd, i= t > can't work here. > linux_root_device_thisversion=3D${GRUB_DEVICE} > fi > > cat << EOF > insmod lvm > set root=3D(system-dom0_0) > menuentry "Xen ${OS}, linux ${version}" { > multiboot dummy=3Ddummy /boot/xen.gz $GRUB_CMDLINE_XEN_DEFAULT > module ${rel_dirname}/${basename} > root=3D${linux_root_device_thisversion} $GRUB_CMDLINE_LINUX_DEFAULT > EOF > if test -n "${initrd}" ; then > cat << EOF > module ${rel_dirname}/${initrd} ${rel_dirname}/${initrd} > EOF > fi > cat << EOF > } > EOF > > list=3D`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` > done > > -----------------------------------------------------------------------= - > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig09C0BBB4BD307538ABC6DE15 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.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAkv1y3wACgkQNak7dOguQgmmaQD7BVx5GtoH6898XvAOReIhehup 1Z8VCoQD+zlcT0bDPkcBAJVt3qm7GGK43wkPN2CW9hicFYyDTx6q0vvOnFYCZpQ+ =MRZm -----END PGP SIGNATURE----- --------------enig09C0BBB4BD307538ABC6DE15--