'maps'
feature.
With older releases, the header layout will be awfully messy
and the result is not guaranteed
(it depends on key retrieval order
which may vary from execution to execution according to Perl documentation).
The Linux kernel has been ported on many computer architectures. However, there exists a single source tree encompassing both all possible "features" and "machines".
To be manageable, the source tree is organized in smaller directories, eventually containing sub-directories to keep things tidy:
The include/ directory itself has a similar organisation with many sub-directories named after the feature. Featureless definitions are stored in the linux/ sub-directory.
A typical source file begins like:
As can be seen, the include/ directory is implicit.
Its location is passed to the compiler through an option.
We need then to mimic this to enable hyperlink construction
under the #include
directives.
This is possible with an 'incprefix'
parameter in lxr.conf:
Architecture-specific parts are stored in the arch/ directory
in their own sub-directories (alpha/, arm/,
powerpc/, x86/, …).
But these parts are not directly #include
d by the
architecture-independent code.
Instead, the directive is written #include <asm/...>
as in the following example:
The abstract asm/ directory is mapped to a real
architecture-directory by the configuration management system
through an option specification given to the compiler.
All architecture-directories contain an include/asm/ sub-directory
where all .h definitions are stored.
If we are interested in the arm architecture,
we can augment the above 'incprefix'
to:
But what if we want to compare the x86 version? Reconfiguring lxr.conf for a two-minute reading is not user-friendly.
Fortunately, we can use a very handy LXR feature:
'maps'
with variable substitution.
First, we create a variable whose value will be the target architecture
(in fact, the name of the architecture sub-directory).
Let us call it 'a'
for architecture:
'range'
content must be manually typed.
We incur the risk of omitting an architecture or entering a non-existing one.
Further below, a tip is given to automatically collect an up-to-date list.
When LXR is launched, this variable appears in the header area. Just select the target architecture and click the Change button to set the variable.
Next, the architecture 'incprefix'
rule must be rewritten
to reference a virtual architecture:
Finally, a path rewrite rule is applied just before the test for file existence with the variable value as parameter:
The above configuration parameters are satisfactory for the "classical" computer architectures, but clearly do not meet all requirements for the embedded architectures, such as arm. These present variants in processors, boards, peripheral chips, … which challenge an effective LXR configuration.
Let us consider the arm case as an example. The Linux-arm implementation must cope with machine and platform variants. Two new variables are then created:
'when'
clause is a 1.0 feature preventing variable
display outside a defined context.
Here, the variables appear on screen only
when variable 'a'
is equal to arm
.
The machine-specific files are referenced with
#include <mach/…>
and they live in the arch/arm/mach-xxx/include/mach/ directory
where xxx is one of the values defined in
'arm_mach'
's 'range'
(respectively 'arm_plat'
for platform-specific files).
Leaving aside 'incprefix'
for the moment,
the following rules would do the job at first thought:
THIS IS WRONG!
'maps'
rules is cumulative:
after application of the first rule,
%=LEVEL2=%
has been replaced and, consequently,
the second rule never matches any more
since %=LEVEL2=%
has disappeared.
This implies we must force two different include paths. The correct configuration is
#include
directives are not hyperlinked,
check if variables 'arm_mach'
and 'arm_plat'
describe an existing configuration.
Similar rules can be designed for the other architectures.
Starting with release 1.0, LXR ships with a script which collects the architecture names and their variants. Launch it from the LXR root directory as:
Possible options are --help
, --verbose
,
--erase
and --suffix=
s.
The script output is a collection of *_list.txt files in the custom.d/ directory suitable for automatic reading into the master configuration.
The following parameters are recommended for Linux kernel browsing:
readfile
argument.
This is taken care of by the configuration wizard,
starting with release 2.0.3.
This can be automatically generated by the initial configuration script:
Use option --add
if you already configured LXR for another tree.
If you intend to use LXR against the kernel source only,
the complete configuration process is done with:
If you gave a --suffix=
s to script
kernel-grab-vars.sh,
you must first manually change the default suffix to your custom suffix
in this file.
Remember to run script initdb.sh to create the associated database:
Copy the configuration file to its final destination:
Everything is ready for genxref.