<?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>/usr/bin/mike &#187; Operating Systems</title>
	<atom:link href="http://www.mgriepentrog.com/category/computers/operating-systems/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mgriepentrog.com</link>
	<description>Michael Griepentrog&#039;s Personal Website</description>
	<lastBuildDate>Thu, 17 Nov 2011 00:28:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Enable ftrace on Ubuntu Linux</title>
		<link>http://www.mgriepentrog.com/2009/09/09/enable-ftrace-on-ubuntu-linux/</link>
		<comments>http://www.mgriepentrog.com/2009/09/09/enable-ftrace-on-ubuntu-linux/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:57:02 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.mgriepentrog.com/?p=75</guid>
		<description><![CDATA[Introduction I was interested in using ftrace for a potential project, but didn&#8217;t find much documentation on how to get it working. I hope to change that by providing step-by-step instructions to enable ftrace for use in Ubuntu Linux 9.10 &#8230; <a href="http://www.mgriepentrog.com/2009/09/09/enable-ftrace-on-ubuntu-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I was interested in using <a href="http://lwn.net/Articles/322731/">ftrace</a> for a potential project, but didn&#8217;t find much documentation on how to get it working. I hope to change that by providing step-by-step instructions to enable ftrace for use in Ubuntu Linux 9.10 (Karmic Koala). Overview from the kernel documentation:</p>
<blockquote><p>Ftrace is an internal tracer designed to help out developers and designers of systems to find what is going on inside the kernel. It can be used for debugging or analyzing latencies and performance issues that take place outside of user-space.</p></blockquote>
<p>Given that ftrace is targeted towards developers and designers of systems, I&#8217;m assuming you more or less know what you&#8217;re doing with these steps. I also recommend virtualizing an instance of linux so that if you do mess up, you aren&#8217;t left with an un-bootable machine.</p>
<h2>Steps</h2>
<p><a href="http://cdimage.ubuntu.com/releases/karmic/alpha-3/">Download</a> and install Ubuntu 9.10 Alpha-3</p>
<p>Run the following commands to install the necessary dependencies for a custom kernel:</p>
<p><code>$ sudo apt-get install git-core fakeroot build-essential makedumpfile kernel-wedge<br />
$ sudo apt-get build-dep linux </code></p>
<p>Get the latest version of the Ubuntu kernel:</p>
<p><code>$ cd ~/<br />
$ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-karmic.git</code></p>
<p>edit &#8220;debian/config/config.common.ubuntu&#8221; and make the following changes:</p>
<p><code>CONFIG_FTRACE_SYSCALLS=y<br />
CONFIG_FUNCTION_TRACER=y</code></p>
<p>Next, run the following commands:</p>
<p><code>$ sudo debian/rules clean<br />
$ CONCURRENCY_LEVEL=2 AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-386</code></p>
<p>If you are prompted about enabling other forms of tracing, see ftrace.txt for more information about each type. You will want to enable DYNAMIC_FTRACE, which allows you to only trace functions you are concerned about.</p>
<p>Once finished, run the following commands from the parent directory :</p>
<p><code>$ sudo dpkg -i linux-image-2.6.31-5-386_2.6.31-5.24_i386.deb<br />
$ sudo dpkg -i linux-headers-2.6.31-5-386_2.6.31-5.24_i386.deb<br />
$ sudo update-grub</code></p>
<p>Restart your computer, and you should now see the kernel we compiled as a boot option:</p>
<p><a href="http://www.mgriepentrog.com/wp-content/uploads/2009/12/ubuntu_boot_menu.png"><img class="alignnone size-full wp-image-98" title="ubuntu_boot_menu" src="http://www.mgriepentrog.com/wp-content/uploads/2009/12/ubuntu_boot_menu.png" alt="" width="640" height="580" /></a></p>
<p>The rest is outlined in LWN&#8217;s look at ftrace, but here are a few things I noticed:</p>
<ul>
<li>You don&#8217;t have to mount a debugfs. There&#8217;s already one at /sys/kernel/debug (where it&#8217;s recommended to be).</li>
<li>I ran into some permission errors when trying to change what the current tracer was. Changing the owner or permissions of that directory should solve this issue.</li>
</ul>
<p>To verify that everything is working, when you cat &#8220;/sys/kernel/debug/tracing/available_tracers&#8221; you should see more options than just &#8220;nop&#8221;. Enjoy!</p>
<h2>Resources</h2>
<ul>
<li><a href="https://help.ubuntu.com/community/Kernel/Compile">Ubuntu Kernel Compile Page</a></li>
<li><a href="http://blog.avirtualhome.com/2008/10/28/how-to-compile-a-custom-kernel-for-ubuntu-intrepid-using-git/">How to compile a custom kernel for Ubuntu Intrepid using git</a></li>
<li><a href="http://lwn.net/Articles/322731/">ftrace.txt</a></li>
<li><a href="http://lwn.net/Articles/322666/">LWN.net: A look at ftrace</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mgriepentrog.com/2009/09/09/enable-ftrace-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

