Best practice to modify Xen's source and build it for qubes

I’m thinking about how to conveniently modify Xen’s source, and have it built for qubes to test. But I’m totally new to this workflow, and know little about Xen. So I’m seeking help. Hopefully this will also help other curious qubes users and potential contributors.

I can think up a few ways to do this:

  1. Have a clone of Xen’s source code, apply all qubes-specific patches to it, then use qubes-builder to build it in a hacking way ( since all patches are applied, remove them from xen.spec.in )
  2. Have a clone of Xen’s source code, add new commits locally, generate patches, and add the new patches to xen.spec.in to build it with qubes-builder.
  3. Have a clone of Xen’s source code, apply all qubes-specific patches to it, manually set up a build environment, modify and build it. However, the exact environment requirement is still unknown to me.

All three methods are only imagined, and haven’t been proved viable.
.
I think the “iterating overhead” of the first method is the need to repack Xen’s source code. The “iterating overhead” of the second method is the patch generation part.

Any idea and comment is appreciated.

1 Like