summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile
diff options
context:
space:
mode:
authorChong Lu <Chong.Lu@windriver.com>2014-06-10 09:35:12 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-13 12:31:38 +0100
commitf51c639f99a92e808c0fa35839416c5c075a8bd8 (patch)
treef39d2868b684df657d8de1beae9725e6a0d6122b /meta/recipes-kernel/oprofile
parent36c3e923df85e685b707fe6bd84b053a5e366fe4 (diff)
downloadpoky-f51c639f99a92e808c0fa35839416c5c075a8bd8.tar.gz
oprofile: Determine the root home directory dynamically
This commit detects the root home directory dynamically with changes to the opcontrol script and the oprofile gui app source. The commit replaces an earlier fix that detected and adjusted a 'non-standard' root home directory at build time. The advantage of this patch is that the oprofile tools are adjusted to the current run-time path to ~root, not the build time path. (From OE-Core rev: 4fa57b42aa7ec3f77606ab3d3b5814f638c859d5) Signed-off-by: Dave Lerner <dave.lerner@windriver.com> Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/oprofile')
-rw-r--r--meta/recipes-kernel/oprofile/oprofile.inc5
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/oprofile-root.patch113
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch120
3 files changed, 122 insertions, 116 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile.inc b/meta/recipes-kernel/oprofile/oprofile.inc
index aaba48e8a0..76d0b6cbe5 100644
--- a/meta/recipes-kernel/oprofile/oprofile.inc
+++ b/meta/recipes-kernel/oprofile/oprofile.inc
@@ -19,16 +19,15 @@ FILES_${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/lib*.la"
19FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a" 19FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
20 20
21SRC_URI = "file://opstart.patch \ 21SRC_URI = "file://opstart.patch \
22 file://oprofile-root.patch \
23 file://acinclude.m4 \ 22 file://acinclude.m4 \
24 file://oprofile-cross-compile-tests.patch \ 23 file://oprofile-cross-compile-tests.patch \
25 file://run-ptest" 24 file://run-ptest \
25 file://root-home-dir.patch"
26 26
27inherit autotools-brokensep pkgconfig ptest 27inherit autotools-brokensep pkgconfig ptest
28 28
29EXTRA_OECONF = "--with-kernel=${STAGING_KERNEL_DIR} --without-x" 29EXTRA_OECONF = "--with-kernel=${STAGING_KERNEL_DIR} --without-x"
30do_configure () { 30do_configure () {
31 find ${S} -wholename '${S}/.pc' -prune -o -type f -print | xargs sed -i 's#ROOTHOME#${ROOT_HOME}#'
32 cp ${WORKDIR}/acinclude.m4 ${S}/ 31 cp ${WORKDIR}/acinclude.m4 ${S}/
33 autotools_do_configure 32 autotools_do_configure
34} 33}
diff --git a/meta/recipes-kernel/oprofile/oprofile/oprofile-root.patch b/meta/recipes-kernel/oprofile/oprofile/oprofile-root.patch
deleted file mode 100644
index f3fe4c9cb3..0000000000
--- a/meta/recipes-kernel/oprofile/oprofile/oprofile-root.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1Change hardcoded /root to /home/root
2
3Upstream-Status: inappropriate [OE specific]
4
5Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
6
7Replace "/home/root" with stub "ROOTHOME", then substitute it with
8real root home directory which is configured dymanically.
9
10Signed-off-by: Kang Kai <kai.kang@windriver.com>
11
12diff -ur oprofile-0.9.7.orig/doc/opcontrol.1.in oprofile-0.9.7/doc/opcontrol.1.in
13--- oprofile-0.9.7.orig/doc/opcontrol.1.in 2011-07-04 21:25:04.000000000 -0500
14+++ oprofile-0.9.7/doc/opcontrol.1.in 2012-07-02 14:02:16.358865420 -0500
15@@ -171,7 +171,7 @@
16
17 .SH FILES
18 .TP
19-.I /root/.oprofile/daemonrc
20+.I ROOTHOME/.oprofile/daemonrc
21 Configuration file for opcontrol
22 .TP
23 .I /var/lib/oprofile/samples/
24diff -ur oprofile-0.9.7.orig/doc/oprofile.1 oprofile-0.9.7/doc/oprofile.1
25--- oprofile-0.9.7.orig/doc/oprofile.1 2011-08-12 10:23:27.000000000 -0500
26+++ oprofile-0.9.7/doc/oprofile.1 2012-07-02 14:02:29.295862358 -0500
27@@ -150,7 +150,7 @@
28 .I $HOME/.oprofile/
29 Configuration files
30 .TP
31-.I /root/.oprofile/daemonrc
32+.I ROOTHOME/.oprofile/daemonrc
33 Configuration file for opcontrol
34 .TP
35 .I /opt/oprofile-0.9.7-rc3/share/oprofile/
36diff -ur oprofile-0.9.7.orig/doc/oprofile.1.in oprofile-0.9.7/doc/oprofile.1.in
37--- oprofile-0.9.7.orig/doc/oprofile.1.in 2011-07-04 21:25:04.000000000 -0500
38+++ oprofile-0.9.7/doc/oprofile.1.in 2012-07-02 14:01:35.812004623 -0500
39@@ -150,7 +150,7 @@
40 .I $HOME/.oprofile/
41 Configuration files
42 .TP
43-.I /root/.oprofile/daemonrc
44+.I ROOTHOME/.oprofile/daemonrc
45 Configuration file for opcontrol
46 .TP
47 .I @prefix@/share/oprofile/
48diff -ur oprofile-0.9.7.orig/doc/oprofile.html oprofile-0.9.7/doc/oprofile.html
49--- oprofile-0.9.7.orig/doc/oprofile.html 2011-07-04 21:32:35.000000000 -0500
50+++ oprofile-0.9.7/doc/oprofile.html 2012-07-02 14:04:59.804018961 -0500
51@@ -1394,7 +1394,7 @@
52 <dd>
53 <p>
54 Followed by list arguments for profiling set up. List of arguments
55- saved in <code class="filename">/root/.oprofile/daemonrc</code>.
56+ saved in <code class="filename">ROOTHOME/.oprofile/daemonrc</code>.
57 Giving this option is not necessary; you can just directly pass one
58 of the setup options, e.g. <span class="command"><strong>opcontrol --no-vmlinux</strong></span>.
59 </p>
60@@ -1430,7 +1430,7 @@
61 <dd>
62 <p>
63 Start data collection with either arguments provided by <code class="option">--setup</code>
64- or information saved in <code class="filename">/root/.oprofile/daemonrc</code>. Specifying
65+ or information saved in <code class="filename">ROOTHOME/.oprofile/daemonrc</code>. Specifying
66 the addition <code class="option">--verbose</code> makes the daemon generate lots of debug data
67 whilst it is running.
68 </p>
69diff -ur oprofile-0.9.7.orig/doc/oprofile.xml oprofile-0.9.7/doc/oprofile.xml
70--- oprofile-0.9.7.orig/doc/oprofile.xml 2011-07-04 21:25:04.000000000 -0500
71+++ oprofile-0.9.7/doc/oprofile.xml 2012-07-02 14:02:03.543019283 -0500
72@@ -568,7 +568,7 @@
73 <term><option>--setup</option></term>
74 <listitem><para>
75 Followed by list arguments for profiling set up. List of arguments
76- saved in <filename>/root/.oprofile/daemonrc</filename>.
77+ saved in <filename>ROOTHOME/.oprofile/daemonrc</filename>.
78 Giving this option is not necessary; you can just directly pass one
79 of the setup options, e.g. <command>opcontrol --no-vmlinux</command>.
80 </para></listitem>
81@@ -592,7 +592,7 @@
82 <term><option>--start</option></term>
83 <listitem><para>
84 Start data collection with either arguments provided by <option>--setup</option>
85- or information saved in <filename>/root/.oprofile/daemonrc</filename>. Specifying
86+ or information saved in <filename>ROOTHOME/.oprofile/daemonrc</filename>. Specifying
87 the addition <option>--verbose</option> makes the daemon generate lots of debug data
88 whilst it is running.
89 </para></listitem>
90diff -ur oprofile-0.9.7.orig/gui/oprof_start_util.cpp oprofile-0.9.7/gui/oprof_start_util.cpp
91--- oprofile-0.9.7.orig/gui/oprof_start_util.cpp 2011-07-04 21:25:04.000000000 -0500
92+++ oprofile-0.9.7/gui/oprof_start_util.cpp 2012-07-02 13:55:21.041876096 -0500
93@@ -39,7 +39,7 @@
94 // return the ~ expansion suffixed with a '/'
95 string const get_config_dir()
96 {
97- return "/root";
98+ return "ROOTHOME";
99 }
100
101 string daemon_pid;
102diff -ur oprofile-0.9.7.orig/utils/opcontrol oprofile-0.9.7/utils/opcontrol
103--- oprofile-0.9.7.orig/utils/opcontrol 2011-07-20 14:36:48.000000000 -0500
104+++ oprofile-0.9.7/utils/opcontrol 2012-07-02 13:55:06.232872688 -0500
105@@ -384,7 +384,7 @@
106 OPROFILED="$OPDIR/oprofiled"
107
108 # location for daemon setup information
109- SETUP_DIR="/root/.oprofile"
110+ SETUP_DIR="ROOTHOME/.oprofile"
111 SETUP_FILE="$SETUP_DIR/daemonrc"
112 SEC_SETUP_FILE="$SETUP_DIR/daemonrc_new"
113
diff --git a/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch b/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch
new file mode 100644
index 0000000000..45cab7d3d8
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/root-home-dir.patch
@@ -0,0 +1,120 @@
1oprofile: Determine the root home directory dynamically
2
3This commit detects the root home directory dynamically with changes to
4the opcontrol script and the oprofile gui app source.
5
6The commit replaces an earlier fix that detected and adjusted a
7'non-standard' root home directory at build time. The advantage of this
8patch is that the oprofile tools are adjusted to the current run-time
9path to ~root, not the build time path.
10
11Upstream-Status: inappropriate [OE specific]
12
13Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
14
15diff --git a/doc/opcontrol.1.in b/doc/opcontrol.1.in
16index c434704..f57eb76 100644
17--- a/doc/opcontrol.1.in
18+++ b/doc/opcontrol.1.in
19@@ -171,7 +171,7 @@ No special environment variables are recognised by opcontrol.
20
21 .SH FILES
22 .TP
23-.I /root/.oprofile/daemonrc
24+.I ~root/.oprofile/daemonrc
25 Configuration file for opcontrol
26 .TP
27 .I /var/lib/oprofile/samples/
28diff --git a/doc/oprofile.1.in b/doc/oprofile.1.in
29index 3d0f0ed..5c623e1 100644
30--- a/doc/oprofile.1.in
31+++ b/doc/oprofile.1.in
32@@ -150,7 +150,7 @@ No special environment variables are recognised by oprofile.
33 .I $HOME/.oprofile/
34 Configuration files
35 .TP
36-.I /root/.oprofile/daemonrc
37+.I ~root/.oprofile/daemonrc
38 Configuration file for opcontrol
39 .TP
40 .I @prefix@/share/oprofile/
41diff --git a/doc/oprofile.html b/doc/oprofile.html
42index 128d9f7..d7e4dea 100644
43--- a/doc/oprofile.html
44+++ b/doc/oprofile.html
45@@ -1394,7 +1394,7 @@ The <span class="command"><strong>opcontrol</strong></span> script provides the
46 <dd>
47 <p>
48 Followed by list arguments for profiling set up. List of arguments
49- saved in <code class="filename">/root/.oprofile/daemonrc</code>.
50+ saved in <code class="filename">~root/.oprofile/daemonrc</code>.
51 Giving this option is not necessary; you can just directly pass one
52 of the setup options, e.g. <span class="command"><strong>opcontrol --no-vmlinux</strong></span>.
53 </p>
54@@ -1430,7 +1430,7 @@ The <span class="command"><strong>opcontrol</strong></span> script provides the
55 <dd>
56 <p>
57 Start data collection with either arguments provided by <code class="option">--setup</code>
58- or information saved in <code class="filename">/root/.oprofile/daemonrc</code>. Specifying
59+ or information saved in <code class="filename">~root/.oprofile/daemonrc</code>. Specifying
60 the addition <code class="option">--verbose</code> makes the daemon generate lots of debug data
61 whilst it is running.
62 </p>
63diff --git a/doc/oprofile.xml b/doc/oprofile.xml
64index 6a17c6d..0968d76 100644
65--- a/doc/oprofile.xml
66+++ b/doc/oprofile.xml
67@@ -568,7 +568,7 @@ The <command>opcontrol</command> script provides the following actions :
68 <term><option>--setup</option></term>
69 <listitem><para>
70 Followed by list arguments for profiling set up. List of arguments
71- saved in <filename>/root/.oprofile/daemonrc</filename>.
72+ saved in <filename>~root/.oprofile/daemonrc</filename>.
73 Giving this option is not necessary; you can just directly pass one
74 of the setup options, e.g. <command>opcontrol --no-vmlinux</command>.
75 </para></listitem>
76@@ -592,7 +592,7 @@ The <command>opcontrol</command> script provides the following actions :
77 <term><option>--start</option></term>
78 <listitem><para>
79 Start data collection with either arguments provided by <option>--setup</option>
80- or information saved in <filename>/root/.oprofile/daemonrc</filename>. Specifying
81+ or information saved in <filename>~root/.oprofile/daemonrc</filename>. Specifying
82 the addition <option>--verbose</option> makes the daemon generate lots of debug data
83 whilst it is running.
84 </para></listitem>
85diff --git a/gui/oprof_start_util.cpp b/gui/oprof_start_util.cpp
86index d293431..d13fa8f 100644
87--- a/gui/oprof_start_util.cpp
88+++ b/gui/oprof_start_util.cpp
89@@ -20,6 +20,8 @@
90 #include <iostream>
91 #include <fstream>
92 #include <cstdlib>
93+#include <sys/types.h>
94+#include <pwd.h>
95
96 #include <qfiledialog.h>
97 #include <qmessagebox.h>
98@@ -39,7 +41,8 @@ namespace {
99 // return the ~ expansion suffixed with a '/'
100 string const get_config_dir()
101 {
102- return "/root";
103+ struct *pw = getpwnam("root");
104+ return pw->pw_dir;
105 }
106
107 string daemon_pid;
108diff --git a/utils/opcontrol b/utils/opcontrol
109index 09fa5a7..a8acdae 100644
110--- a/utils/opcontrol
111+++ b/utils/opcontrol
112@@ -385,7 +385,7 @@ do_init()
113 OPROFILED="$OPDIR/oprofiled"
114
115 # location for daemon setup information
116- SETUP_DIR="/root/.oprofile"
117+ SETUP_DIR="`grep root /etc/passwd | cut -d: -f6`/.oprofile"
118 SETUP_FILE="$SETUP_DIR/daemonrc"
119 SEC_SETUP_FILE="$SETUP_DIR/daemonrc_new"
120