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.html77
1 files changed, 33 insertions, 44 deletions
diff --git a/SystemTap_Beginners_Guide/cross-compiling.html b/SystemTap_Beginners_Guide/cross-compiling.html
index 15be5fef..039f3bbd 100644
--- a/SystemTap_Beginners_Guide/cross-compiling.html
+++ b/SystemTap_Beginners_Guide/cross-compiling.html
@@ -1,59 +1,48 @@
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"> 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="idm246925959920" class="indexterm"></a><a id="idm246875250768" class="indexterm"></a><a id="idm246880504656" class="indexterm"></a><a id="idm246873746544" class="indexterm"></a><a id="idm246878065984" class="indexterm"></a><a id="idm246914242512" class="indexterm"></a><a id="idm246877654000" class="indexterm"></a><a id="idm246917572880" class="indexterm"></a><div class="para">
3<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>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 name="generator" content="publican 2.8" /><meta name="package" content="Systemtap-SystemTap_Beginners_Guide-2.2-en-US-2.2-2" /><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 src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="https://fedorahosted.org/publican"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="using-systemtap.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="using-usage.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" id="cross-compiling" lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="cross-compiling">2.2. Generating Instrumentation for Other Computers</h2></div></div></div><a id="idp18180320" class="indexterm"></a><a id="idp18178912" class="indexterm"></a><a id="idp13857856" class="indexterm"></a><a id="idp25072560" class="indexterm"></a><a id="idp63991376" class="indexterm"></a><a id="idp44638288" class="indexterm"></a><a id="idp33262128" class="indexterm"></a><a id="idp37588672" class="indexterm"></a><div class="para">
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). 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).
5 </div><div class="para"> 4 </div><div class="para">
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 RPMs that provide compilers or debug information on specific machines, which will prevent the deployment of SystemTap. 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>.
7 </div><div class="para"> 6 </div><div class="para">
8 To work around this, you can resort to <em class="firstterm">cross-instrumentation</em>. 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: 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:
9 </div><a id="idp18808464" class="indexterm"></a><a id="idp38573792" class="indexterm"></a><div class="itemizedlist"><ul><li class="listitem"><div class="para"> 8 </div><a id="idm246871281296" class="indexterm"></a><a id="idm246877247440" class="indexterm"></a><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para">
10 The kernel information packages for various machines can be installed on a single <span class="emphasis"><em>host machine</em></span>. 9 The kernel information packages for various machines can be installed on a single <span class="emphasis"><em>host machine</em></span>.
11 </div></li><li class="listitem"><div class="para"> 10 </div></li><li class="listitem"><div class="para">
12 Each <span class="emphasis"><em>target machine</em></span> only needs one RPM to be installed to use the generated SystemTap instrumentation module: <code class="filename">systemtap-runtime</code>. 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.
13 </div></li></ul></div><div class="note"><div class="admonition_header"><h2>Note</h2></div><div class="admonition"><div class="para"> 12 </div></li></ul></div><div class="para">
14 For the sake of simplicity, we will be using the following terms throughout this section: 13 For the sake of simplicity, the following terms are used throughout this section:
15 </div><div class="itemizedlist"><ul><li class="listitem"><div class="para"> 14 </div><div xmlns:d="http://docbook.org/ns/docbook" class="itemizedlist"><ul><li class="listitem"><div class="para">
16 <a id="idp50800928" class="indexterm"></a> 15 <a id="idm246927320432" class="indexterm"></a> <a id="idm246914411904" 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>.
17 <a id="idp21847984" class="indexterm"></a> 16 </div></li><li class="listitem"><div class="para">
18 <span class="emphasis"><em>instrumentation module</em></span> — the kernel module built from a SystemTap script; i.e. 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>. 17 <a id="idm246907857280" class="indexterm"></a> <a id="idm246917522176" 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>.
19 </div></li><li class="listitem"><div class="para"> 18 </div></li><li class="listitem"><div class="para">
20 <a id="idp22715392" class="indexterm"></a> 19 <a id="idm246913059600" class="indexterm"></a> <a id="idm246871727296" 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.
21 <a id="idp17714112" class="indexterm"></a> 20 </div></li><li class="listitem"><div class="para">
22 <span class="emphasis"><em>host system</em></span> — the system on which you compile the instrumentation modules (from SystemTap scripts), to be loaded on <span class="emphasis"><em>target systems</em></span>. 21 <a id="idm246928051760" class="indexterm"></a> <a id="idm246875290544" 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>.
23 </div></li><li class="listitem"><div class="para"> 22 </div></li></ul></div><div class="para">
24 <a id="idp33613632" class="indexterm"></a> 23 To configure a host system and target systems, complete the following steps:
25 <a id="idp44026352" class="indexterm"></a> 24 </div><div xmlns:d="http://docbook.org/ns/docbook" class="procedure"><a id="preppingxcompile"></a><a id="idm246911923168" class="indexterm"></a><a id="idm246927632480" class="indexterm"></a><a id="idm246917564832" class="indexterm"></a><ol class="1"><li class="step"><div class="para">
26 <span class="emphasis"><em>target system</em></span> — the system for which you are building the <span class="emphasis"><em>instrumentation module</em></span> (from SystemTap scripts). 25 Install the <span class="package">systemtap-runtime</span> package on each <span class="emphasis"><em>target system</em></span>.
27 </div></li><li class="listitem"><div class="para">
28 <a id="idp17705088" class="indexterm"></a>
29 <a id="idp22440160" class="indexterm"></a>
30 <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 wish to load/run the <span class="emphasis"><em>instrumentation module</em></span>.
31 </div></li></ul></div></div></div><div class="procedure" id="preppingxcompile"><h6>Procedure 2.1. Configuring a Host System and Target Systems</h6><a id="idp30116800" class="indexterm"></a><a id="idp49285808" class="indexterm"></a><a id="idp45864592" class="indexterm"></a><ol class="1"><li class="step"><div class="para">
32 Install the <code class="filename">systemtap-runtime</code> RPM on each <span class="emphasis"><em>target system</em></span>.
33 </div></li><li class="step"><div class="para"> 26 </div></li><li class="step"><div class="para">
34 Determine the kernel running on each <span class="emphasis"><em>target system</em></span> by running <code class="command">uname -r</code> on each <span class="emphasis"><em>target system</em></span>. 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.
35 </div></li><li class="step"><div class="para"> 28 </div></li><li class="step"><div class="para">
36 Install SystemTap on the <span class="emphasis"><em>host system</em></span>. You will be building the <span class="emphasis"><em>instrumentation module</em></span> for the <span class="emphasis"><em>target systems</em></span> on the <span class="emphasis"><em>host system</em></span>. For instructions on how to install SystemTap, refer to <a class="xref" href="using-systemtap.html#installproper">Section 2.1.1, “Installing SystemTap”</a>. 29 Install SystemTap on the <span class="emphasis"><em>host system</em></span>. You will be building the <span class="emphasis"><em>instrumentation module</em></span> for the <span class="emphasis"><em>target systems</em></span> on the <span class="emphasis"><em>host system</em></span>. For instructions on how to install SystemTap, refer to <a class="xref" href="using-systemtap.html#installproper">Section 2.1.1, “Installing SystemTap”</a>.
37 </div></li><li class="step"><div class="para"> 30 </div></li><li class="step"><div class="para">
38 Using the <span class="emphasis"><em>target kernel</em></span> version determined earlier, install the <span class="emphasis"><em>target kernel</em></span> and related RPMs on the <span class="emphasis"><em>host system</em></span> by the method described in <a class="xref" href="using-systemtap.html#install-kinfo">Section 2.1.2, “Installing Required Kernel Information RPMs”</a>. If multiple <span class="emphasis"><em>target systems</em></span> use different <span class="emphasis"><em>target kernels</em></span>, you will need to repeat this step for each different kernel used on the <span class="emphasis"><em>target systems</em></span>. 31 Using the <span class="emphasis"><em>target kernel</em></span> version determined earlier, install the <span class="emphasis"><em>target kernel</em></span> and related RPM packages on the <span class="emphasis"><em>host system</em></span> as described in <a class="xref" href="using-systemtap.html#install-kinfo">Section 2.1.2, “Installing Required Kernel Information Packages Manually”</a>. If multiple <span class="emphasis"><em>target systems</em></span> use different <span class="emphasis"><em>target kernels</em></span>, repeat this step for each different kernel used on the <span class="emphasis"><em>target systems</em></span>.
39 </div></li></ol></div><div class="para"> 32 </div></li></ol></div><div class="para">
40 After performing <a class="xref" href="cross-compiling.html#preppingxcompile">Procedure 2.1, “Configuring a Host System and Target Systems”</a>, 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>. 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>.
41 </div><div class="para"> 34 </div><div class="para">
42 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): 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):
43 </div><pre class="screen">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></pre><div class="para"> 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">
44 Here, <code class="command"><em class="replaceable"><code>kernel_version</code></em></code> refers to the version of the <span class="emphasis"><em>target kernel</em></span> (the output of <code class="command">uname -r</code> on the target machine), <code class="command"><em class="replaceable"><code>script</code></em></code> refers to the script to be converted into an <span class="emphasis"><em>instrumentation module</em></span>, and <code class="command"><em class="replaceable"><code>module_name</code></em></code> is the desired name of the <span class="emphasis"><em>instrumentation module</em></span>. 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>.
45 </div><div class="note"><div class="admonition_header"><h2>Note</h2></div><div class="admonition"><a id="idp21619344" class="indexterm"></a><a id="idp21620304" class="indexterm"></a><a id="idp38813648" class="indexterm"></a><div class="para"> 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="idm246911863984" class="indexterm"></a><a id="idm246869060400" class="indexterm"></a><a id="idm246869059472" class="indexterm"></a><div class="para">
46 To determine the architecture notation of a running kernel, run <code class="command">uname -m</code>. 39 To determine the architecture notation of a running kernel, you can run the following command:
47 </div></div></div><div class="para"> 40 </div><pre class="screen"><code class="command">uname -m</code></pre></div></div><div class="para">
48 Once the 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: 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:
49 </div><pre class="screen">staprun <em class="replaceable"><code>module_name</code></em>.ko</pre><div class="para"> 42 </div><pre class="screen"><code class="command">staprun <em class="replaceable"><code>module_name</code></em>.ko</code></pre><div class="para">
50 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: 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:
51 </div><div class="para"> 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">
52 <code class="command">stap -r 2.6.18-92.1.10.el5 -e 'probe vfs.read {exit()}' -m simple</code> 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>):
53 </div><div class="para"> 46 </div><pre class="screen"><code class="command">staprun simple.ko</code></pre><div xmlns:d="http://docbook.org/ns/docbook" class="important"><div class="admonition_header"><p><strong>Important</strong></p></div><div class="admonition"><div class="para">
54 This will create a module named <code class="filename">simple.ko</code>. To use the <span class="emphasis"><em>instrumentation module</em></span> <code class="filename">simple.ko</code>, 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>):
55 </div><div class="para">
56 <code class="command">staprun simple.ko</code>
57 </div><div class="important"><div class="admonition_header"><h2>Important</h2></div><div class="admonition"><div class="para">
58 The <span class="emphasis"><em>host system</em></span> must be the same architecture and running the same distribution of Linux as the <span class="emphasis"><em>target system</em></span> in order for the built <span class="emphasis"><em>instrumentation module</em></span> to work. 47 The <span class="emphasis"><em>host system</em></span> must be the same architecture and running the same distribution of Linux as the <span class="emphasis"><em>target system</em></span> in order for the built <span class="emphasis"><em>instrumentation module</em></span> to work.
59 </div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="using-systemtap.html"><strong>Prev</strong>Chapter 2. Using SystemTap</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="using-usage.html"><strong>Next</strong>2.3. Running SystemTap Scripts</a></li></ul></body></html> 48 </div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="using-systemtap.html"><strong>Prev</strong>Chapter 2. Using SystemTap</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="using-usage.html"><strong>Next</strong>2.3. Running SystemTap Scripts</a></li></ul></body></html> \ No newline at end of file