[Pkg-xen-devel] #505517 [grub-pc] Dosen't handle xen dom0 kernel automagically [PATCH]

Didier Raboud didier at raboud.com
Mon Nov 17 17:52:13 UTC 2008

Le lundi 17 novembre 2008 18:30:33 Ian Campbell, vous avez écrit :
> On Mon, 2008-11-17 at 18:02 +0100, Didier Raboud wrote:
> > Here is a patch that solves bug #505517 in two steps :
> >
> > * grub-pc_00_add_xen_support.patch
> > 	Removes the xen kernels from 10_linux's listing
> > 	(simply blacklisting *-xen-* kernels and initrds)
> This is wrong for a few reasons.
> First the uname of the kernel is not a strong indicator of its Xen'ness.
> Consider that XEN could just as likely be the users initials or the name
> of a particular machine for which this is a custom kernel.
> Secondly modern kernels (with CONFIG_PARAVIRT=y) can be booted on both
> Xen and native so you want a native entry to support that.
> Thirdly pygrub can be used to boot a domU by examining the inguest grub
> configuration. This relies on the presence of a native style entry
> inside the guest (although it doesn't currently speak the grub2 config
> file format).

Thanks for your feedback ! I was guessing something like this, that's why I have 
put it that removal in a different patch.

Please dis-regard patch -00-.

> The only case where you might historically have wanted to exclude a
> kernel is a legacy (not CONFIG_PARAVIRT) kernel when you are running in
> domain 0 but that is counter to the pygrub usecase and it is complicated
> to detect when you are in domain 0 vs domain U reliably. Since it only
> effects legacy kernels it is best to just ignore it since it will go
> away shortly, IOW never filter away any Xen kernels.
> There are a number of closed bugs against grub1's update-grub about this
> issue, I guess debian/changelog of the grub1 source would list them.
> > * grub-pc_01_add_xen_support.patch
> > * grub-pc_02_add_xen_support.patch
> > * grub-pc_03_add_xen_support.patch
> > 	Add a 10_xen in /etc/grub.d/ for support of the Xen hypervisors
> > 	Lists all the *-xen-* kernels for each hypervisor version
> Only kernels which have CONFIG_XEN_PRIVILEGED_GUEST=y should get a
> hypervisor style stanza (in addition to a native one as discussed
> above).

Ok. So a reasonable approach would be to parse the /boot/config* files to now 
which kernels could be used as dom0. Right ?

> Looks like there is some code duplication in 10_linux vs 10_xen, is
> there some common location you could put it ?

I guess something like /etc/grub.d/common or adding it down the 
file /usr/lib/grub/update-grub_lib could be something good.

> Usually with grub1 Xen was listed first (I guess since in all likelihood
> if you installed it you will boot it) so perhaps 09_xen ???

When I begun to work on it, I had a 08_xen, but then I read /etc/grub.d/README 
which states the "native boot entries", so I guessed that a 10_* would be the 
appropriate. A trick could be to name it 10_hypervisors_xen so that it would be 
taken 'before' 10_linux.

> Ian.

Anyway, I don't know if I have the skills and time to do it properly, but I'll 
make a second try soon !

Final note : do you think that these eventual patches would have their place in 
grub-pc or in xen-whatever ?



Didier Raboud, proud Debian user.
CH-1802 Corseaux
didier at raboud.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.alioth.debian.org/pipermail/pkg-xen-devel/attachments/20081117/019e38d9/attachment.pgp 

More information about the Pkg-xen-devel mailing list