Xen Zynq Distribution Support Forums
What type of dom0 Image does Xen expect/require? - Printable Version

+- Xen Zynq Distribution Support Forums (http://xzdforums.dornerworks.com)
+-- Forum: General Xilinx Support (http://xzdforums.dornerworks.com/forumdisplay.php?fid=1)
+--- Forum: Public Support (http://xzdforums.dornerworks.com/forumdisplay.php?fid=6)
+--- Thread: What type of dom0 Image does Xen expect/require? (/showthread.php?tid=656)



What type of dom0 Image does Xen expect/require? - brettstahlman - 03-15-2017

Inspection of the build artifacts from a petalinux-build shows a vmlinux whose <stext> section starts at 0x80040, with an unconditional branch to 0x80040 at start of _text section @ 0x80000. When I try to boot a dom0 kernel built with buildroot, boot simply hangs. Don't know whether this is the problem, but I've noticed that the buildroot-generated vmlinux file used to create the dom0 Image has PE and COFF headers at the 0x80000 address prior to the stext section. (The code at 0x80000 is an add, followed by an unconditional branch past the headers to <stext>.) First of all, can anyone provide a link to documentation on what exactly Xen is expecting? I've seen several boot examples, but I'm having trouble locating documentation on the applicable boot protocol.

I'm wondering whether there's something I could modify here...

Code:
fatload mmc 0:1 0x80000 Image
fdt set /chosen/dom0 reg <0 0x80000 0x$filesize>

...which would allow me to boot a non-petalinux Image (e.g., one that has the standard EFI boot stub at 0x80000).

What is the "secret sauce" that allows the petalinux Image to boot where the buildroot Image hangs? (Note that I've booted the buildroot Image successfully without Xen...)


RE: What type of dom0 Image does Xen expect/require? - david_norwood - 03-16-2017

Hi Brett,

It sounds like both of your posts are related insofar as inquiring about the format of the dom0 file for non-Petalinux based Linux kernel.  The main Xen project page, https://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs, provides some considerations when configuring a Linux kernel for dom0 support.  Hopefully, this will help highlight pieces you may not have configured, and perhaps also help shed light on the differences between the Petalinux generated Image file and your customized version.  Also, the Xen project page has other information as well for non-Petalinux based Linux kernels that you may find beneficial.

Thanks for contributing to the XZD Forums.  Don’t forget to check us out at http://dornerworks.com/xen/xilinxxen for more information regarding XZD support.

David


RE: What type of dom0 Image does Xen expect/require? - brettstahlman - 03-16-2017

(03-16-2017, 05:31 PM)david_norwood Wrote: Hi Brett,

It sounds like both of your posts are related insofar as inquiring about the format of the dom0 file for non-Petalinux based Linux kernel.  The main Xen project page, https://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs, provides some considerations when configuring a Linux kernel for dom0 support.  Hopefully, this will help highlight pieces you may not have configured, and perhaps also help shed light on the differences between the Petalinux generated Image file and your customized version.  Also, the Xen project page has other information as well for non-Petalinux based Linux kernels that you may find beneficial.

Thanks for contributing to the XZD Forums.  Don’t forget to check us out at http://dornerworks.com/xen/xilinxxen for more information regarding XZD support.

David

David,
Thanks. That's very helpful. In particular, it makes me think the issue has more to do with kernel options than with the format of the kernel Image. Although the buildroot image contains an "MZ" signature and EFI stub headers, which are missing from the petalinux Image, the 1st 2 instructions (located at 0x80000) are the "MZ" signature (disguised as an ADD immediate instruction) followed by a branch past the headers to "stext". Thus, provided the random ADD doesn't cause any issues, I'm thinking the start of the 2 images should be roughly equivalent, headers notwithstanding.

I suspect my real problem lies in failure to set some of the configuration options listed in the "Mainline Linux Kernel Configs" doc you referenced. Do I need to set only the options listed under "Configuring the Kernel for dom0 Support", or does dom0 also require the domU options listed under "Configuring the Kernel for domU Support"?

What is the best way to bake these options into an automated build process? I mean, I know I can run `make menuconfig' manually, but can I just modify a .config file, and if so, when does it get overwritten?

*** Update ***
After adding all applicable DomU and Dom0 options to my .config file and rebuilding the kernel, I was able to boot the resulting Image as Xen dom0. The Image still has the EFI boot stub, so clearly that wasn't the problem; rather, it was failure to build with the Xen-specific parameters. Would still be interested to know exactly what was causing the kernel to hang with no output: e.g., did Xen detect the problem with the image and simply refuse to load it? If that were the case, I would have expected to see some sort of error message. I guess it's more likely that the non-xen-enabled kernel started executing, and the lack of Xen functionality caused it to hang without warning...

Thanks for steering me in the right direction...


RE: What type of dom0 Image does Xen expect/require? - david_norwood - 03-17-2017

Brett,
If you had to enable any CONFIG_HVC options, I would consider them as suspects for it not outputting anything. But, not being familiar with your setup, it's hard to say. Overall, I'm glad to hear you got things working and can continue with your development.

Good Luck,
David


RE: What type of dom0 Image does Xen expect/require? - brettstahlman - 03-17-2017

(03-17-2017, 12:57 PM)david_norwood Wrote: Brett,      
If you had to enable any CONFIG_HVC options, I would consider them as suspects for it not outputting anything.  But, not being familiar with your setup, it's hard to say.  Overall, I'm glad to hear you got things working and can continue with your development.

Good Luck,
David

David,
Yes. CONFIG_HVC_XEN and CONFIG_HVC_XEN_FRONTEND were 2 of the I options I enabled. So perhaps the boot wasn't hanging after all (or at least not immediately)...
Thanks,
Brett S.