summaryrefslogtreecommitdiffstats
path: root/SystemTap_Beginners_Guide/cross-compiling.html
diff options
Diffstat (limited to 'SystemTap_Beginners_Guide/cross-compiling.html')
-rw-r--r--SystemTap_Beginners_Guide/cross-compiling.html24
1 files changed, 13 insertions, 11 deletions
diff --git a/SystemTap_Beginners_Guide/cross-compiling.html b/SystemTap_Beginners_Guide/cross-compiling.html
index 6209b96f..233d220a 100644
--- a/SystemTap_Beginners_Guide/cross-compiling.html
+++ b/SystemTap_Beginners_Guide/cross-compiling.html
@@ -1,27 +1,29 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">2.2. Generating Instrumentation for Other Computers</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="publican v4.0.0" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.6-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="using-systemtap.html" title="Chapter 2. Using SystemTap" /><link rel="prev" href="using-systemtap.html" title="Chapter 2. Using SystemTap" /><link rel="next" href="using-usage.html" title="2.3. Running SystemTap Scripts" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="https://fedorahosted.org/publican"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="using-systemtap.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="using-usage.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="cross-compiling"></a>2.2. Generating Instrumentation for Other Computers</h2></div></div></div><a id="idm47951466606512" class="indexterm"></a><a id="idm47951457694528" class="indexterm"></a><a id="idm47951462945440" class="indexterm"></a><a id="idm47951468141824" class="indexterm"></a><a id="idm47951469078592" class="indexterm"></a><a id="idm47951464609200" class="indexterm"></a><a id="idm47951460796288" class="indexterm"></a><a id="idm47951476318464" class="indexterm"></a><div class="para"> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">2.2. Generating Instrumentation for Other Computers</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="publican v4.1.3" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.6-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="using-systemtap.html" title="Chapter 2. Using SystemTap" /><link rel="prev" href="using-systemtap.html" title="Chapter 2. Using SystemTap" /><link rel="next" href="using-usage.html" title="2.3. Running SystemTap Scripts" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="https://fedorahosted.org/publican"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="using-systemtap.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="using-usage.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="cross-compiling">
3 ⁠</a>2.2. Generating Instrumentation for Other Computers</h2></div></div></div><a id="idm213978436128" class="indexterm"></a><a id="idm213973987664" class="indexterm"></a><a id="idm214014021200" class="indexterm"></a><a id="idm213975700048" class="indexterm"></a><a id="idm214015541904" class="indexterm"></a><a id="idm213969565440" class="indexterm"></a><a id="idm214010451120" class="indexterm"></a><a id="idm214014059168" class="indexterm"></a><div class="para">
3 When users run a SystemTap script, SystemTap builds a kernel module out of that script. SystemTap then loads the module into the kernel, allowing it to extract the specified data directly from the kernel (refer to <a class="xref" href="understanding-how-systemtap-works.html#systemtapsession">Procedure 3.1, “SystemTap Session”</a> in <a class="xref" href="understanding-how-systemtap-works.html#understanding-architecture-tools">Section 3.1, “Architecture”</a> for more information). 4 When users run a SystemTap script, SystemTap builds a kernel module out of that script. SystemTap then loads the module into the kernel, allowing it to extract the specified data directly from the kernel (refer to <a class="xref" href="understanding-how-systemtap-works.html#systemtapsession">Procedure 3.1, “SystemTap Session”</a> in <a class="xref" href="understanding-how-systemtap-works.html#understanding-architecture-tools">Section 3.1, “Architecture”</a> for more information).
4 </div><div class="para"> 5 </div><div class="para">
5 Normally, however, SystemTap scripts can only be run on systems where SystemTap is deployed (as in <a class="xref" href="using-systemtap.html#using-setup">Section 2.1, “Installation and Setup”</a>). This could mean that if you want to run SystemTap on ten systems, you would need to deploy SystemTap on <span class="emphasis"><em>all</em></span> those systems. In some cases, this may be neither feasible nor desired. For instance, corporate policy may prohibit an administrator from installing RPM packages that provide compilers or debug information on specific machines, and thus prevent the deployment of SystemTap. To work around this problem, SystemTap allows you to use <em class="firstterm">cross-instrumentation</em>. 6 Normally, however, SystemTap scripts can only be run on systems where SystemTap is deployed (as in <a class="xref" href="using-systemtap.html#using-setup">Section 2.1, “Installation and Setup”</a>). This could mean that if you want to run SystemTap on ten systems, you would need to deploy SystemTap on <span class="emphasis"><em>all</em></span> those systems. In some cases, this may be neither feasible nor desired. For instance, corporate policy may prohibit an administrator from installing RPM packages that provide compilers or debug information on specific machines, and thus prevent the deployment of SystemTap. To work around this problem, SystemTap allows you to use <em class="firstterm">cross-instrumentation</em>.
6 </div><div class="para"> 7 </div><div class="para">
7 Cross-instrumentation is the process of generating SystemTap instrumentation module from a SystemTap script on one computer to be used on another computer. This process offers the following benefits: 8 Cross-instrumentation is the process of generating SystemTap instrumentation module from a SystemTap script on one computer to be used on another computer. This process offers the following benefits:
8 </div><a id="idm47951469099984" class="indexterm"></a><a id="idm47951461471792" class="indexterm"></a><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para"> 9 </div><a id="idm214007277376" class="indexterm"></a><a id="idm214007237696" class="indexterm"></a><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para">
9 The kernel information packages for various machines can be installed on a single <span class="emphasis"><em>host machine</em></span>. 10 The kernel information packages for various machines can be installed on a single <span class="emphasis"><em>host machine</em></span>.
10 </div></li><li class="listitem"><div class="para"> 11 </div></li><li class="listitem"><div class="para">
11 Each <span class="emphasis"><em>target machine</em></span> only needs one RPM package to be installed in order to use the generated SystemTap instrumentation module: the <span class="package">systemtap-runtime</span> package. 12 Each <span class="emphasis"><em>target machine</em></span> only needs one RPM package to be installed in order to use the generated SystemTap instrumentation module: the <span class="package">systemtap-runtime</span> package.
12 </div></li></ul></div><div class="para"> 13 </div></li></ul></div><div class="para">
13 For the sake of simplicity, the following terms are used throughout this section: 14 For the sake of simplicity, the following terms are used throughout this section:
14 </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para"> 15 </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para">
15 <a id="idm47951415797216" class="indexterm"></a> <a id="idm47951461387648" class="indexterm"></a> <span class="emphasis"><em>Instrumentation module</em></span> — the kernel module built from a SystemTap script. The <span class="emphasis"><em>SystemTap module</em></span> is built on the <span class="emphasis"><em>host system</em></span>, and will be loaded on the <span class="emphasis"><em>target kernel</em></span> of <span class="emphasis"><em>target system</em></span>. 16 <a id="idm213972682672" class="indexterm"></a> <a id="idm214012266752" class="indexterm"></a> <span class="emphasis"><em>Instrumentation module</em></span> — the kernel module built from a SystemTap script. The <span class="emphasis"><em>SystemTap module</em></span> is built on the <span class="emphasis"><em>host system</em></span>, and will be loaded on the <span class="emphasis"><em>target kernel</em></span> of <span class="emphasis"><em>target system</em></span>.
16 </div></li><li class="listitem"><div class="para"> 17 </div></li><li class="listitem"><div class="para">
17 <a id="idm47951461377568" class="indexterm"></a> <a id="idm47951463669056" class="indexterm"></a> <span class="emphasis"><em>Host system</em></span> — the system on which you compile the <span class="emphasis"><em>instrumentation modules</em></span> from SystemTap scripts in order to load them on <span class="emphasis"><em>target systems</em></span>. 18 <a id="idm214008631440" class="indexterm"></a> <a id="idm214018432416" class="indexterm"></a> <span class="emphasis"><em>Host system</em></span> — the system on which you compile the <span class="emphasis"><em>instrumentation modules</em></span> from SystemTap scripts in order to load them on <span class="emphasis"><em>target systems</em></span>.
18 </div></li><li class="listitem"><div class="para"> 19 </div></li><li class="listitem"><div class="para">
19 <a id="idm47951475665056" class="indexterm"></a> <a id="idm47951416182656" class="indexterm"></a> <span class="emphasis"><em>Target system</em></span> — the system for which you are building the <span class="emphasis"><em>instrumentation modules</em></span> from SystemTap scripts. 20 <a id="idm213970633024" class="indexterm"></a> <a id="idm213970632064" class="indexterm"></a> <span class="emphasis"><em>Target system</em></span> — the system for which you are building the <span class="emphasis"><em>instrumentation modules</em></span> from SystemTap scripts.
20 </div></li><li class="listitem"><div class="para"> 21 </div></li><li class="listitem"><div class="para">
21 <a id="idm47951428029136" class="indexterm"></a> <a id="idm47951464505904" class="indexterm"></a> <span class="emphasis"><em>Target kernel</em></span> — the kernel of the <span class="emphasis"><em>target system</em></span>. This is the kernel on which you intend to load or run the <span class="emphasis"><em>instrumentation module</em></span>. 22 <a id="idm214017439440" class="indexterm"></a> <a id="idm214013912832" class="indexterm"></a> <span class="emphasis"><em>Target kernel</em></span> — the kernel of the <span class="emphasis"><em>target system</em></span>. This is the kernel on which you intend to load or run the <span class="emphasis"><em>instrumentation module</em></span>.
22 </div></li></ul></div><div class="para"> 23 </div></li></ul></div><div class="para">
23 To configure a host system and target systems, complete the following steps: 24 To configure a host system and target systems, complete the following steps:
24 </div><div xmlns:d="http://docbook.org/ns/docbook" class="procedure"><a id="preppingxcompile"></a><a id="idm47951464565376" class="indexterm"></a><a id="idm47951464498976" class="indexterm"></a><a id="idm47951461367568" class="indexterm"></a><ol class="1"><li class="step"><div class="para"> 25 </div><div xmlns:d="http://docbook.org/ns/docbook" class="procedure"><a id="preppingxcompile">
26 ⁠</a><a id="idm214017323360" class="indexterm"></a><a id="idm214015248464" class="indexterm"></a><a id="idm214017102064" class="indexterm"></a><ol class="1"><li class="step"><div class="para">
25 Install the <span class="package">systemtap-runtime</span> package on each <span class="emphasis"><em>target system</em></span>. 27 Install the <span class="package">systemtap-runtime</span> package on each <span class="emphasis"><em>target system</em></span>.
26 </div></li><li class="step"><div class="para"> 28 </div></li><li class="step"><div class="para">
27 Determine the kernel running on each <span class="emphasis"><em>target system</em></span> by running the <code class="command">uname -r</code> command on each of these systems. 29 Determine the kernel running on each <span class="emphasis"><em>target system</em></span> by running the <code class="command">uname -r</code> command on each of these systems.
@@ -33,13 +35,13 @@
33 After completing these steps, you can now build the <span class="emphasis"><em>instrumentation module</em></span> (for any <span class="emphasis"><em>target system</em></span>) on the <span class="emphasis"><em>host system</em></span>. 35 After completing these steps, you can now build the <span class="emphasis"><em>instrumentation module</em></span> (for any <span class="emphasis"><em>target system</em></span>) on the <span class="emphasis"><em>host system</em></span>.
34 </div><div class="para"> 36 </div><div class="para">
35 To build the <span class="emphasis"><em>instrumentation module</em></span>, run the following command on the <span class="emphasis"><em>host system</em></span> (be sure to specify the appropriate values): 37 To build the <span class="emphasis"><em>instrumentation module</em></span>, run the following command on the <span class="emphasis"><em>host system</em></span> (be sure to specify the appropriate values):
36 </div><pre class="screen"><code class="command">stap -r <em class="replaceable"><code>kernel_version</code></em> <em class="replaceable"><code>script</code></em> -m <em class="replaceable"><code>module_name</code></em></code></pre><div class="para"> 38 </div><pre class="screen"><code class="command">stap -r <em class="replaceable">kernel_version</em> <em class="replaceable">script</em> -m <em class="replaceable">module_name</em></code></pre><div class="para">
37 Here, <em class="replaceable"><code>kernel_version</code></em> refers to the version of the <span class="emphasis"><em>target kernel</em></span> (the output of the <code class="command">uname -r</code> command on the target machine), <em class="replaceable"><code>script</code></em> refers to the script to be converted into the <span class="emphasis"><em>instrumentation module</em></span>, and <em class="replaceable"><code>module_name</code></em> is the desired name of the <span class="emphasis"><em>instrumentation module</em></span>. 39 Here, <em class="replaceable">kernel_version</em> refers to the version of the <span class="emphasis"><em>target kernel</em></span> (the output of the <code class="command">uname -r</code> command on the target machine), <em class="replaceable">script</em> refers to the script to be converted into the <span class="emphasis"><em>instrumentation module</em></span>, and <em class="replaceable">module_name</em> is the desired name of the <span class="emphasis"><em>instrumentation module</em></span>.
38 </div><div xmlns:d="http://docbook.org/ns/docbook" class="note"><div class="admonition_header"><p><strong>Note</strong></p></div><div class="admonition"><a id="idm47951427714880" class="indexterm"></a><a id="idm47951458643632" class="indexterm"></a><a id="idm47951458642608" class="indexterm"></a><div class="para"> 40 </div><div xmlns:d="http://docbook.org/ns/docbook" class="note"><div class="admonition_header"><p><strong>Note</strong></p></div><div class="admonition"><a id="idm214012739168" class="indexterm"></a><a id="idm214012738208" class="indexterm"></a><a id="idm214015375056" class="indexterm"></a><div class="para">
39 To determine the architecture notation of a running kernel, you can run the following command: 41 To determine the architecture notation of a running kernel, you can run the following command:
40 </div><pre class="screen"><code class="command">uname -m</code></pre></div></div><div class="para"> 42 </div><pre class="screen"><code class="command">uname -m</code></pre></div></div><div class="para">
41 Once the <span class="emphasis"><em>instrumentation module</em></span> is compiled, copy it to the <span class="emphasis"><em>target system</em></span> and then load it using: 43 Once the <span class="emphasis"><em>instrumentation module</em></span> is compiled, copy it to the <span class="emphasis"><em>target system</em></span> and then load it using:
42 </div><pre class="screen"><code class="command">staprun <em class="replaceable"><code>module_name</code></em>.ko</code></pre><div class="para"> 44 </div><pre class="screen"><code class="command">staprun <em class="replaceable">module_name</em>.ko</code></pre><div class="para">
43 For example, to create the <span class="emphasis"><em>instrumentation module</em></span> <code class="filename">simple.ko</code> from a SystemTap script named <code class="filename">simple.stp</code> for the <span class="emphasis"><em>target kernel</em></span> 2.6.18-92.1.10.el5 (on x86_64 architecture), use the following command: 45 For example, to create the <span class="emphasis"><em>instrumentation module</em></span> <code class="filename">simple.ko</code> from a SystemTap script named <code class="filename">simple.stp</code> for the <span class="emphasis"><em>target kernel</em></span> 2.6.18-92.1.10.el5 (on x86_64 architecture), use the following command:
44 </div><pre class="screen"><code class="command">stap -r 2.6.18-92.1.10.el5 -e 'probe vfs.read {exit()}' -m simple</code></pre><div class="para"> 46 </div><pre class="screen"><code class="command">stap -r 2.6.18-92.1.10.el5 -e 'probe vfs.read {exit()}' -m simple</code></pre><div class="para">
45 This creates a module named <code class="filename">simple.ko</code>. To use this <span class="emphasis"><em>instrumentation module</em></span>, copy it to the <span class="emphasis"><em>target system</em></span> and run the following command (on the <span class="emphasis"><em>target system</em></span>): 47 This creates a module named <code class="filename">simple.ko</code>. To use this <span class="emphasis"><em>instrumentation module</em></span>, copy it to the <span class="emphasis"><em>target system</em></span> and run the following command (on the <span class="emphasis"><em>target system</em></span>):