Self Hosting Fedora Base

Harald Hoyer January 14, 2014 #fedora #bootstrap #buildroot

If you want to bootstrap a distribution or want to rebuild it from the sources (SRPMS) to get the same binaries (think CentOS), you have to build the build tools and rebuild them with the built build tools, which have to be built with other build tools…

My goal for a self-hosting Fedora Base is to reduce the number of packages to do such a rebuild.

The first step is to get the packages to build the most important component for a linux distribution - the kernel.

To get those packages, Phil Knirsch wrote a small python script, which calls repoquery. I extended this script to output graphviz .dot formatted files.

The first run gives us 1806 packages, with which you could build the tools to build the tools to […] build the kernel, if you manage to break the dependency cycle, etc.

If you want to display this beast with e.g. “sfdp” and “gvmap” from the graphviz suite, this will give you a monster graph.

Self-Hosting kernel build requirements Self-Hosting kernel build requirements

This was generated with the kernel-br-all.dot file and the command:

$ START=7; cat kernel-br-all.dot | \
 sfdp -Gstart=$START -Goverlap=prism | \
 gvmap -e -d $START | \
 neato -Gstart=$START -n2 -Ecolor=#44444455 -Tsvg \
> kernel-br-all.svg

My next step was to identify the source of weird build requirements like qt, kdelibs or wayland. So I build a list of packages, which might be removed from the build requirements, because they only build documentation or willingly add a build requirement to a graphical component like X, wayland or a GUI.

After filtering those with the python script, the resulting graph was mainly dominated by perl packages, so I just merged them in one “perl” node. The graph from this is almost readable.

Reduced Self-Hosting kernel build requirements Reduced Self-Hosting kernel build requirements

graphviz comes with tred, which reduces the graph, so that at least one path leads from X to Y. With this reduction we get a nice graph generated from kernel-br-reduced.dot by:

$ START=7; tred kernel-br-reduced.dot | \
 sfdp -Gstart=$START -Goverlap=prism | \
 gvmap -e -d $START | \
 neato -Gstart=$START -n2 -Ecolor=#44444455 -Tsvg \
 > kernel-br-reduced-tred.svg

Now, most of the build requirements are missing, but one path, so you can at least find one package, which requires a specific package. All the red nodes in the graph are the build requirements, for which no build requirements were added. So the strategy should be to get rid of those, or make sure they don’t pull in the # complete distribution. We might want to use the pre-built documentation shipped with the package or have a separate documentation build phase with the same source. For other packages, we might have to split out the GUI components. If you have other ideas, I am happy to get to know them.

Conclusion: 188 packages plus all the perl packages could form a basic buildroot to build itsself. To achieve this, we have to take care of those 56 red packages, that these are not used.

The list of the 65 spec files with the build requirements to ifdef can be found here: http://harald.fedorapeople.org/bootstrap-not-needed-deps.txt

Reduced Build Requirements for the package kernel