I am using linux perf tool for profiling shared library. Though it worked well on Ubuntu but now I want to run it on embedded linux and I cannot use apt-get to install linux perf tools on embedded linux. That's why I should have to compile everything from scratch.
Can anyone please guide how to compile linux perf tools and dependent kernel module from scratch/source.
Any help will be highly appreciated.
Thanks
Arslan Ali
Source code of perf is found in linux-kernel/tools/perf. So use the same kernel which use are using for your board.
For building the perf tools, go to the perf directory as told above. Then run the below command
These commands will change based on your cross toolchain
export CC=arm-linux-gnueabihf-gcc
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
After building is over copy the perf binary to your board /bin directory and
add the execution permission to it. Then you can use this feature.
Related
I am brand-new to Buildroot and didn’t use embedded systems or distros a lot.
I successfully flashed my STM32 and have buildroot as distro on it but after flashing it I figured out that I needed to install gcc package.
I didn’t find the gcc package after make menuconfig -->target packages. In fact not all packages listed in the buildroot/package/ Directory are listed in the menuconfig target packages interface.
I am really a noob and it would be great if you orient me step by step in order to get this done.
Best Regards
I think you need native compiler on the target in Buildroot. But Buildroot do not provide native toolchain after Buildroot-2012.11.
For more details refer : https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target
If you really need native toolchain try a real distribution like
openembedded
yocto
Fedora
I think this helped you !
I wrote a little game using Rust, and I used cargo build --release to compile a release version on Mac.
I tried to share this with my friend who is using Ubuntu, but when he tried to run the binary, he got the following error:
cannot execute binary file: Exec format error
I searched for this but found no answers. Doesn't Rust claim to have "no runtime"? Shouldn't it be able to run anywhere in binary form?
Rust not having a runtime means that it doesn't have a lot of code running as part of the language (for example a garbage collector or bytecode interpreter). It does still need to use operating system primitives (i.e. syscalls), and these are different on MacOS and Linux.
What you want is a cross compiler. If you're using rustup, then installing a cross compiler should be simple:
# Install the toolchain to build Linux x86_64 binaries
rustup target add x86_64-unknown-linux-gnu
Then building is:
cargo build --release --target=x86_64-unknown-linux-gnu
Caveat: I don't have an OS X machine to test this on; please comment or edit to fix this if it works!
Well, it is because Rust has no runtime (unlike e.g. Java's JVM) that you can't just compile code on one OS and expect it to run on a different one; what you are looking for is cross-compilation. I haven't done it in Rust, but from what I can gather you can find relevant information on different cross-compilation Rust strategies on this GitHub repo.
How can I build a Linux kernel in Travis CI. I have added script: make menuconfig to my Travis config and it doesn't work and says
No output has been received in the last 10 minutes
How can I fix this?
Link to GitHub repo : https://github.com/ProjectPolyester/tegra_kernel and submit fixes in PRs if possible
Travis monitors your build process and if there is no output for about 10 minutes, it assumes that your process is stuck somewhere for unknown reasons, and then kills it.
Solution in your case :
You need to provide with the actual build command.
make menuconfig
actually just allows you to configure the kernel. It doesn't really starts the kernel build process. So there is no output of this command.
Also, the kernel should already be configured or you can download the appropriate .config file if its available some where online. And then there will be no need to execute:
make menuconfig
The build command
It can be simply
make
or something like
make -j3 modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-$SOURCE_VERSION
The second one is actually to perform cross compilation.
You also need to set all the prerequisites like downloading the header file etc
You may want to take a look at this script , it crosscompiles the modules only, not the entire kernel.
If you want to use the old config for a new kernel, you can use make olddefconfig. Here is my example how to compile and boot a new kernel in travis: https://github.com/avagin/criu/blob/linux-next/scripts/travis/kexec.sh#L54
I know that this is an old thread but I was recently able to get Travis CI working on building a Linux kernel
https://github.com/GlassROM-devices/android_kernel_oneplus_msm8994/commit/6ed484812bbd4a25c3b22e730b7489eaaf668da1
GCC fix is for toolchains compiled on Debian unstable, arch, gentoo, etc. These toolchains will fail to compile on Ubuntu so you'll have to use the GCC fix for these toolchains
And you really want to upgrade GCC before you even try building a kernel. Travis CI has a very old GCC that will fail if you try to compile the kernel
In my commit I'm building it with GCC 8 linaro built by myself
I have built the openwrt firmware and installed it to a device.
Now I want to compile my source code in C in the device (I can ssh into it).
However, openwrt firmware is quite basic and does not include make.
How can I install make/ equivalent to compile my C source code inside the device running openwrt firmware?
OpenWrt is not intended to work as a build server, so you won't find compiler, linker etc. in its root file system. As you mentioned before, you've successfully compiled the firmware. That means you have cross compiler at hand, so you can cross compile your software and then copy it to your system via scp.
Another approach would be to create your own feed, add your software to this feed, so that at the end you'll get an ordinary ipkg package, that you can download and install via web interface. See OpenWrt documentation for more details.
Lots of Cross Compiler are available for host system i.e PC running any Linux OS.
Just install compiler corresponding to Architecture in which Openwrt is running,
e.g If OpenWRT running on ARM architecture,
sudo apt-get install gcc-arm-linux-gnueabi
then compile source code as:
arm-linux-gcc -o yourprogram yourprogram.c
I am having issues with my kernel driver build. I'm and building a custom (albeit very basic) NVidia RDMA driver and am receiving build warnings during the make file. Specifically it is looking for two NVidia API calls nvidia_p2p_put_pages and nvidia_p2p_get_pages. Using 'nm' is see these entry points are in the NVidia driver module (nvidia.ko). However, I'm not familiar enough with the internals of the Linux driver make file system to locate those entry points at build time.
The RDMA tool kit documentation refers to an extraction script "./NVIDIA-Linux-x86_64-.run" and a build directory. However, I was unable to locate any build files after extracting the latest driver sources.
As you can tell, I'm rather new to this. Any help would be greatly appreciated.
Thanks
The basic GPUDirect RDMA documentation is here.
As indicated in section 4.3, building an nvidia driver linux kernel module requires various driver header files and makefiles.
These files can be accessed as follows:
get an appropriate NVIDIA linux driver installer (.run file) such as 319.72 here
All nvidia linux driver installers have command line switch options. Basic options can be found by appending --help to the driver installer command string, such as:
sh NVIDIA-Linux-x86_64-319.72.run --help
more advanced options can be accessed with:
sh NVIDIA-Linux-x86_64-319.72.run --advanced-options
one of the advanced options is -x which will only extract the driver files, it will not "install" any:
sh NVIDIA-Linux-x86_64-319.72.run -x
This will create a directory where the files are available. Within this directory, the kernel directory has the necessary header files and a sample kernel module makefile which can be used to learn appropriate libraries to link against:
cd NVIDIA-Linux-x86_64-319.72/kernel