Building xen
First have all the build dependencies installed.
Then download the source tree of xen with mercurial
hg clone http://xenbits.xensource.com/xen-4.0-testing.hg
or xen-unstable.hg or something.
The various linux dom0 kernels it will download and build are configured in buildconfigs/ and linux-2.6-pvops is the new type of kernel. The default git branch is xen/master which is based on 2.6.31.13 right now but in buildconfigs/mk.linux-2.6-pvops it can be changed to
XEN_LINUX_GIT_REMOTEBRANCH ?= xen/stable-2.6.32.x .
Then
make linux-2.6-pvops-build XEN_LINUX_NONINTERACTIVE_CONFIG=y CONFIG_SPARSE_IRQ=0 dist
and it will skip all the configuration questions and you can put in an existing .config in the menu or copying it to ./build-linux-2.6-pvops_x86_64/.config. config-2.6.32.17 is a .config for the xen/stable-2.6.32.x branch of linux-2.6-pvops.git.
Then any changes to the linux source could be made and run make dist to compile everything.
god dammit, how do I make the firmware?
building a rpm
http://fedoraproject.org/wiki/PackageMaintainers/CreatingPackageHowTo After it is finished compiling, tar -cvzf ~/xendist401rc6pre.tar.gz xen-4.0-testing.hg/dist/ from the parent directory of the source tree with whatever the filename of the tarball should be.
set up the rpm environment
http://wiki.centos.org/HowTos/SetupRpmBuildEnvironment
yum install rpmdevtools rpmdev-setuptree
build the rpm
To make the rpm from the dist tarball, copy it to ~/rpmbuild/SOURCES/ and edit the spec file in ~/rpmbuild/SPECS/ to have the right version and run rpmbuild -ba prgmrxen4.spec.
cp xendist-luke-mod-1.tar.gz ~/rpmbuild/SOURCES rpmbuild -ba prgmrxen4.spec
For more information about setting up the rpm build environment see the centos and fedora wikis.