<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AmirWatad.com &#187; Linux Kernel</title>
	<atom:link href="http://www.amirwatad.com/blog/archives/category/linux-kernel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amirwatad.com/blog</link>
	<description>Remember the name ;)</description>
	<lastBuildDate>Wed, 22 Sep 2010 22:04:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Browse the Linux Kernel Source with LXR</title>
		<link>http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/</link>
		<comments>http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/#comments</comments>
		<pubDate>Mon, 11 May 2009 23:04:06 +0000</pubDate>
		<dc:creator>Amir Watad</dc:creator>
				<category><![CDATA[Linux Kernel]]></category>
		<category><![CDATA[Code Tagging]]></category>
		<category><![CDATA[Kernel Programming]]></category>
		<category><![CDATA[Linux Development]]></category>

		<guid isPermaLink="false">http://www.amirwatad.com/blog/?p=433</guid>
		<description><![CDATA[LXR (stands for Linux Cross-Reference), is a great tool which indexes the source code of the Linux Kernel and allows you browse the source in your favorite browser (Firefox), with quick references for all functions/files referenced in that code. (it&#8217;s not limited to use in Linux Kernel though, and can be used to index any [...]<p>---------
Note:
Some RSS readers might display this post with incorrect format.
View original post at <a href="http://www.amirwatad.com/blog">AmirWatad.com </a><br/><br/><a href="http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/">Browse the Linux Kernel Source with LXR</a></p>
]]></description>
			<content:encoded><![CDATA[<p>LXR (stands for Linux Cross-Reference), is a great tool which indexes the source code of the Linux Kernel and allows you browse the source in your favorite browser (Firefox), with quick references for all functions/files referenced in that code. (it&#8217;s not limited to use in Linux Kernel though, and can be used to index any large project&#8217;s source code).</p>
<p>Whenever I need to touch the Linux Kernel code, I first open a new tab with LXR, another with Google ready to work, and a shell terminal ready for grep queries.</p>
<p><span id="more-433"></span> This post will deal with installing LXR on Ubuntu and making it work.</p>
<p><br class="spacer_" /></p>
<p>1. First we need to install Apache (http server) and related stuff:</p>
<blockquote><p>sudo apt-get install apache2 libapache2-mod-perl2</p>
</blockquote>
<blockquote><p>sudo apt-get install libcgi-simple-perl libcgi-ajax-perl libhtml-parser-perl libtemplate-perl</p>
</blockquote>
<p>2. Install LXR</p>
<blockquote><p>sudo apt-get install lxr</p>
</blockquote>
<p>3. Now we need to install Glimpse, which is a powerful indexing tool used by LXR:</p>
<p>First we need to download the latest version from Glimpse&#8217;s homepage. <a href="http://webglimpse.net/trial/glimpse-latest.tar.gz" target="_blank">Click here to download</a>.</p>
<p>Extract the tarball:</p>
<blockquote><p>tar xzf glimpse-latest.tar.gz</p>
</blockquote>
<p>Now we need to install flex (needed for installing glimpse)</p>
<blockquote><p>sudo apt-get install flex</p>
</blockquote>
<p>In the top directory of glimpse run these:</p>
<blockquote><p>./configure</p>
</blockquote>
<blockquote><p>make</p>
</blockquote>
<blockquote><p>sudo make install</p>
</blockquote>
<p>4. Open /etc/apache2/httpd.conf with your favorite text editor (vim) as root, and add these:</p>
<blockquote><p># Linux Cross Reference Stuff<br />
 Alias /lxr /usr/share/lxr<br />
 &lt;Directory /usr/share/lxr&gt;<br />
 Options All<br />
 AllowOverride All<br />
 &lt;/Directory&gt;</p>
</blockquote>
<p>5. Open the file /usr/share/lxr/http/.htaccess with your favorite text editor and add these:</p>
<blockquote><p>&lt;Files ~ (search|source|ident|diff|find)$&gt;<br />
 SetHandler cgi-script<br />
 &lt;/Files&gt;</p>
</blockquote>
<p>6. Go to /usr/share/lxr/source/</p>
<p>7. Create a directory with the Kernel version number. For example:</p>
<blockquote><p>mkdir 2.6.22</p>
</blockquote>
<p>8. Download the Kernel Source from <a href="http://www.kernel.org/" target="_blank">kernel.org</a> into /usr/share/lxr/source/2.6.22<a href="http://www.kernel.org/" target="_blank"><br />
 </a></p>
<p>9. untar the source tarball inside the 2.6.22 directory</p>
<p>10. Add the version number to /usr/share/lxr/source/versions:</p>
<blockquote><p>echo 2.6.22 &gt; /usr/share/lxr/source/versions</p>
</blockquote>
<p>11. Create a symbolic link to 2.6.22 to make also the default version displayed:</p>
<blockquote><p>ln -s /usr/share/lxr/source/2.6.22 /usr/share/lxr/source/defversion</p>
</blockquote>
<p>12. Generate the cross-reference (This might take a few minutes):</p>
<blockquote><p>cd /usr/share/lxr/source/2.6.22/</p>
<p>genxref</p>
<p>glimpseindex -H . .</p>
</blockquote>
<p>13. Give permissions to http server to read the files:</p>
<blockquote><p>chown www-data.www-data .glimpse_*</p>
<p>chown -R www-data.www-data /usr/share/lxr/</p>
<p>chown www-data.www-data fileidx</p>
</blockquote>
<p>14. restart apache</p>
<blockquote><p>/etc/init.d/apache2 restart</p>
</blockquote>
<p>15. Open /usr/share/lxr/http/lxr.conf with a text editor.</p>
<p>Change this line:</p>
<blockquote><p>sourceroot: /usr/share/lxr/source/$v/linux/</p>
</blockquote>
<p>into:</p>
<blockquote><p>sourceroot: /usr/share/lxr/source/$v/</p>
</blockquote>
<p>16. That&#8217;s it, now open firefox, and go to:</p>
<p>http://localhost/lxr/http/blurb.html</p>
<p><br class="spacer_" /></p>
<p>- Note: It&#8217;s possible to cross-reference multiple source code projects (or multiple kernel versions). See more information in the sites linked below.</p>
<p>You should be able to browse the Kernel source files like the screenshot below:</p>
<p><br class="spacer_" /></p>
<div id="attachment_434" class="wp-caption alignnone" style="width: 310px"><a href="http://www.amirwatad.com/blog/wp-content/uploads/2009/05/lxr_screenshot.png"><img class="size-medium wp-image-434" title="LXR Screenshot" src="http://www.amirwatad.com/blog/wp-content/uploads/2009/05/lxr_screenshot-300x233.png" alt="LXR Screenshot" width="300" height="233" /></a><p class="wp-caption-text">LXR Screenshot</p></div>
<p><br class="spacer_" /></p>
<p>Enjoy <img src='http://www.amirwatad.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="Browse the Linux Kernel Source with LXR" /> </p>
<p><br class="spacer_" /></p>
<p>Credits:</p>
<p><a href="http://orangespike.ca/?q=node/77" target="_blank">Orandespike Blog<br />
 </a></p>
<p><a href="http://webglimpse.net/download.php" target="_blank">Glimpse</a></p>
<p><a href="http://tread.wordpress.com/2007/08/25/howto-setup-lxr-on-linux-ubuntu-feisty/" target="_blank">Eclectic&#8217;s Blog</a></p>
<p>---------
Note:
Some RSS readers might display this post with incorrect format.
View original post at <a href="http://www.amirwatad.com/blog">AmirWatad.com </a><br/><br/><a href="http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/">Browse the Linux Kernel Source with LXR</a></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=Browse+the+Linux+Kernel+Source+with+LXR+http://bit.ly/mERMp" title="Post to Twitter"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="Post to Twitter" style="margin:0;" title="Browse the Linux Kernel Source with LXR" /></a> <a target="_blank" class="tt" href="http://delicious.com/post?url=http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/&amp;title=Browse+the+Linux+Kernel+Source+with+LXR" title="Post to Delicious"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="Post to Delicious" style="margin:0 0 0 2px;" title="Browse the Linux Kernel Source with LXR" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/&amp;title=Browse+the+Linux+Kernel+Source+with+LXR" title="Post to Digg"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="Post to Digg" style="margin:0 0 0 2px;" title="Browse the Linux Kernel Source with LXR" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/&amp;t=Browse+the+Linux+Kernel+Source+with+LXR" title="Post to Facebook"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big3.png" alt="Post to Facebook" style="margin:0 0 0 2px;" title="Browse the Linux Kernel Source with LXR" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/&amp;title=Browse+the+Linux+Kernel+Source+with+LXR" title="Post to Reddit"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="Post to Reddit" style="margin:0 0 0 2px;" title="Browse the Linux Kernel Source with LXR" /></a> <a target="_blank" class="tt" href="http://stumbleupon.com/submit?url=http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/&amp;title=Browse+the+Linux+Kernel+Source+with+LXR" title="Post to StumbleUpon"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="Post to StumbleUpon" style="margin:0 0 0 2px;" title="Browse the Linux Kernel Source with LXR" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amirwatad.com/blog/archives/2009/05/12/browse-the-linux-kernel-source-with-lxr/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.682 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-05 16:36:58 -->

