On Feb 24, 2012, at 9:26 AM, <vishwanath.kulkarni@wipro.com> wrote:

Hello Mike,
Thank you very much for the inputs you provided.
However, we are again unfortunate to get oprofile working. Here is what we did –
We have cross-compiled oprofile.ko and the kernel and got the zImage by following the steps that you gave. The following options we enabled in .config file and built the kernel,
When we run oprofile on the target,
# opcontrol --init
modprobe: can't load module oprofile (kernel/drivers/oprofile.ko): unknown symbol in module, or unknown parameter
modprobe: can't load module oprofile (kernel/drivers/oprofile.ko): unknown symbol in module, or unknown parameter
Kernel doesn't support oprofile
# lsmod
    Tainted: P
CDBlkDrv 40434 5 - Live 0x7f035000
sd8xxx 37798 1 - Live 0x7f025000
mlan 65945 1 sd8xxx, Live 0x7f00e000 (P)
mrvlsdio 4334 1 sd8xxx, Live 0x7f007000
This time we got one entry as “Tainted: P”. Not sure what this means though.

It related to whether or not all the source running in a Linux kernel is open or not. As you see above, your mlan module has a (P) [meaning proprietary]. That "taints" the running kernel and it limits the support you get from the community because they don't want to spend time debugging something that's running code whose source they cannot inspect.

In this case I don't think it relates to your problems.
We even tried reading back the /proc/config.gz to check for the options that we had set. Unfortunately they (CONFIG_OPROFILE, CONFIG_PROFILING) are not present in this file. Alternatively, when we executed “uname –a” on the target, the timestamp was not today’s date but rather the old kernel build date.
Are we missing anything here?

Ah ok, you are seeing the problem. You said you built the kernel. The problem is you are not running that kernel. The oprofile module needs to be loaded into the kernel built and configured for it.

So we need to understand how your board is booting its kernel. What bootloader is in use? Does it boot from a network or from FLASH?

Somehow we need to preserve the kernel you have now (for safety's sake) and get the zImage (or some wrapped/compress version of it [again this depends on what boot loader you are using]) into the board so it is the kernel being used.

Then I expect your module will load.

Best regards,

From: Michael Cashwell [mailto:mboards@prograde.net] 
Sent: Thursday, February 23, 2012 7:59 PM
To: Vishwanath Kulkarni (WT01 - Manufacturing & Hi Tech)
Cc: oprofile-list@lists.sourceforge.net
Subject: Re: Running OProfile on Linux target running WR 2.6.36
On your target, do you have "/lib/modules/2.6.36/kernel/arch/arm/oprofile/oprofile.ko"? If so but modprobe can't find it then it sounds like some mismatch with modules.dep. I'm not sure how to help there except to maybe rebuild your kernel from scratch.
If you don't have that .ko file then you need to build it.
So in addition to CONFIG_HAVE_OPROFILE=y that you already have, you also need CONFIG_OPROFILE=m
Then in the top-level of the kernel tree and with:
# KARGS="ARCH=arm CROSS_COMPILE=<your tool chain>"
# KINSTDIR="<your build-time path to your staged root target file system>"
do something like:
# make $KARGS modules || abort "In-tree module build failed."
# make $KARGS INSTALL_MOD_PATH=$KINSTDIR modules_install || abort "In-tree module install failed."
That should provide the needed oprofile.ko in the place where modprobe (used by opcontrol) expects it.
(One note: we do build our own kernel zImage and we do it before the make steps above. That may be required. I'm not sure. If module building fails you might need to build your zImage first.)
Good luck!
On Feb 23, 2012, at 8:43 AM, <vishwanath.kulkarni@wipro.com> wrote:

We are having a target device that runs WR Linux with kernel 2.6.36 on ARMv7 based processor.
We have cross-compiled OProfile with following options,
./configure --host=arm-linux CC=<our tool chain>gcc CXX=... ...etc...
When running ./configure we observed the statement something like "Checking kernel support for OProfile ... yes"
The product of this build are:
libbfd-2.22.so             libbfd.so          libpopt.so.0    libpopt.so.0.0.0        opannotate
oparchive                   opcontrol         opgprof          ophelp                       opjitconv
opreport                    oprofiled
On target board:
# cat /proc/modules
CDBlkDrv 40434 5 - Live 0x7f035000
sd8xxx 37798 1 - Live 0x7f025000
mlan 65945 1 sd8xxx, Live 0x7f00e000 (P)
mrvlsdio 4334 1 sd8xxx, Live 0x7f000000
When we run "opcontrol --init" on the target board, we get the following error:
# opcontrol --init
modprobe: module oprofile not found in modules.dep
modprobe: module oprofile not found in modules.dep
Kernel doesn't support oprofile
How do we make this "opcontrol" run successfully on the target board? The kernel is already built with CONFIG_HAVE_OPROFILE=y option. This we confirmed by seeing the option in the file /proc/config.gz on the target board. Do we still need to build oprofile.ko
If yes, how do we do.
If not, then how do we get away with this problem.
Any help in this regard is appreciated.
Thanks and Regards,
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
oprofile-list mailing list