Introduction:
LXR- Linux Cross Referencer, what is it? Well it is "a software toolset for indexing and presenting source code repositories. LXR was initially targeted at the Linux source code, but has proved usable for a wide range of software projects. lxr.linux.no is currently running an experimental fork of the LXR software."

In the real world, people use it to cross reference multitudes of code like kernels. It should have a disclaimer that reads: your sanity is at risk, we have a typical opensource lack of friendly documentation.

I tried to get this up and running on CentOS 5.2, but that was to no avail. Got it working on Ubuntu 7.10 Fiesty Fawn pretty easily.

Installation:

Started with a clean install of Ubuntu 7.10, no additional frills except for gcc and compilers/libraries.

Installed apache, however, the others I added for completeness. You may not need them.

sudo apt-get install apache2 libapache2-mod-perl2
sudo apt-get install libcgi-simple-perl libcgi-ajax-perl libhtml-parser-perl libtemplate-perl

Install LXR and glimpse:

aptitude install lxr
aptitude install glimpse

*Might need to become root for that one. To do that: sudo -i and enter your password at the prompt.

Add the following lines to /etc/apache2/httpd.conf at the end:

# Linux Cross Reference Stuff
Alias /lxr /usr/share/lxr

Options All
AllowOverride All

Create a file /usr/share/lxr/http/.htaccess which contains:


SetHandler cgi-script

Restart Apache

/etc/init.d/apache2 restart

Configuration:

Create /usr/share/lxr/source if it doesn’t exist.

Create a directory 2.6.22 inside. Here I will dump the contents of my 2.6.22 kernel tar. To get this up and running just grab a kernel from http://kernel.org

Untar the kernel source inside this directory i.e., you now have /usr/share/lxr/source/2.6.22/ with the source in the linux directory.

Add a line with contents ‘2.6.22′ (without the single quotes) in /usr/share/lxr/source/versions

echo 2.6.22 > /usr/share/lxr/source/versions

Create a symbolic link for defversion.

ln -s /usr/share/lxr/source/2.6.22 /usr/share/lxr/source/defversion

Change your directory to your source root and activate genxref.

cd /usr/share/lxr/source/
genxref

**note: genxref will probably take a good while if you have a newer kernel you are cross compiling. During my configuration, I had two kernels.

In case you want to have two kernels note the following:

-In source I had two directories in /usr/share/lxr/source/
They were: 2.6.22 and 2.6.23.8 (2.6.22 was the default)

-In the file versions located in the same source directory I did a quick echo append like this to the file: echo 2.6.23.8 >> /usr/share/lxr/source/versions

Now lets get glimpse to generate its db/files. Also we will make sure apache can read them. (I am not sure, if this really matters, however, it might solve a problem or two)

cd /usr/share/lxr/source
glimpseindex -H . .
chown www-data.www-data .glimpse_*

I also chowned the whole lxr directory like so:

chown -R www-data.www-data /usr/share/lxr/

Configure lxr.conf:

Its located at: /usr/share/lxr/http/lxr.conf

# Configuration file.

# Define typed variable "v", read valueset from file.
variable: v, Version, [/usr/share/lxr/source/versions], [/usr/share/lxr/source/defversion]

# Define typed variable "a". First value is default.
variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)

#Define typed variable "s". First value is default. This is for searching basically.
variable: s, Source, (2.6.22, 2.6.23.8)

# Define the base url for the LXR files. 192.168.0.200 is my Ubuntu IP
baseurl: http://192.168.0.200/lxr/http/

# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: /usr/share/lxr/http/template-head
htmltail: /usr/share/lxr/http/template-tail
htmldir: /usr/share/lxr/http/template-dir

# The source is here.
sourceroot: /usr/share/lxr/source/$s
srcrootname: $s

# "#include " is mapped to this directory (in the LXR source
# tree)
incprefix: /include

# The database files go here.
dbdir: /usr/share/lxr/source/$v/

# Glimpse can be found here.
glimpsebin: /bin/glimpse

# The power of regexps. This is pretty Linux-specific, but quite
# useful. Tinker with it and see what it does. (How's that for
# documentation?)
map: /include/asm[^\/]*/ /include/asm-$a/
map: /arch/[^\/]+/ /arch/$a/

Restart apache and you now will have a working LXR :)

/etc/init.d/apache2 restart

Now in your browser, navigate to http://YourIP/lxr/http/blurb.html

References&Notes:

http://tread.wordpress.com/2007/08/25/howto-setup-lxr-on-linux-ubuntu-fe...
http://www.linuxjournal.com/article/9279
http://darwish-07.blogspot.com/2008/02/howto-lxrng-on-ubuntu-710.html

I also read a bunch of the project Readmes, they weren't all that logical for myself. Others might find that not so, but thats just my opinion. I recommend reading a few "howtos" since not always are they complete for your setup.

Also look at your apache logs, there might be a hint there if yoru experiencing page access problems/errors.

Post new comment
The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
Navigation
Syndicate
Syndicate content
Share this
Powered by Drupal, an open source content management system