Details...
The process is way suboptimal speedwise, and contains some ugly
hacks. It goes like so:
- For each "ring" (lib/mm/kernel/init/ipc, net/fs, arch & drivers):
- For each .c file from the kernel tree:
- Use analyze_file.pl to dump out the functions into
separate files.
- Eliminate functions smaller than a certain size.
- Use classify_function.sh to classify the functions into
STATIC, INDIRECT (called through pointer) or NONSTATIC.
- Then use classify_nonstatics.sh to classify all the NONSTATIC
functions into EXPORTED (exported to modules using
EXPORT_SYMBOL), INDIRECT (called through pointer) or NORMAL.
This bunches the function names together in a big regexp,
greps through the kernel sources, and then greps through the
result of that for each function.
- Then we enter stage II: creating the Postscript. We create an
image/ subdirectory.
- First thing we do in run gen_makefile.sh to generate a Makefile
in the image/ dir, now we know what functions exist.
- Then we cd into the image/ dir and do a make. This does the
following:
- We render all the functions, using analyze_function.lex,
and feed the output of this into data2ps.c, which does the
actual rendering.
- The functions in each file are labelled and combined back
into a PostScript image of the whole file, using
conglomerate_functions.sh, which puts a dashed bounding box
and label on each function, then calls draw_arrangement.c to
arrange them into a glob, which gets a solid bounding box and
the filename attached.
- The files are then rendered into sectors, according to
the ring, using draw_arrangement.c again. The inner ring has
all the files in the ipc, kernel, lib, mm and init dirs all
piled together. The second ring has two segments: the fs/
segment and the net/ segment. The third ring has one segment
per architecture, and the final ring has all the drivers piled
together. The layout algorithm is inner to outer, smallest to
largest, with an iterative spacing increase if there is too
much gap in the outer ring.
- Rings II and III, which have multiple sectors, are
assembled using rotary_arrange.sh.
- Once the rings are done, we draw the black outline
demarking them, with the labels on it.
- Then we paste the rings together with the key, the title,
logo, author and the outline generated above, to give
image/image.ps.
- Finally, we create a symlink called "image.ps" into the image
directory.
- To create a nicely bounded PS compliant image, the "posterize"
shell script can be used (and trivially hacked), which uses the
bounding box information at the bottom of the PostScript file
(I keep this uptodate through all the steps).