Undefined symbols with Linux kernel driver build (NVidia) - linux-kernel

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

Related

Comiling linux perf tools and its dependent kernel modules from source/scratch

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.

Where is tftp efi shell command?

Cannot find tftp command in shell.efi app from Tianocore.
When type tftp, got 'tftp' is not recognized as an internal or external command, operable program, or batch file. Help also doesn't know about it.
I looked at sources and found it is implemented in DynamicCommand directory. Maybe command must be loaded or activated somehow before using?
Edit: well, the only way i found to get tftp client working on Tianocore shell is building ShellPkg from sources. There is DynamicCommand/TftpDynamicCommand subdirectory contains tftp application. It will produce tftp.efi on package building finished. "Manual" can be found here. Still dont understand how to make shell with built-in tftp command and why Tianocore maintainers do not include procompiled tftp.efi in ShellBinPkg for example.
How to Run OVMF article contain information on how to get pre-built OVMF images:
Pre-built images are available at https://www.kraxel.org/repos/
These images are automatically built and track the latest OVMF code in the EDK II tree.
Some of these builds include a seabios CSM and can boot non-UEFI “legacy” operating systems. Note: seabios is GPLv3 licensed)
If your OS doesn’t work with RPM repositories, then you can manually download and decompress the RPM files under jenkins/edk2
You can find the latest OVMF RPM packages at kraxel repository. They contain the latest firmware and UefiShell.iso to boot. You will find tftp command you need and other cool stuff there.

linux/bounds.h not found while compiling source of my driver

I am developing drivers for my embedded device that has linux kernel version 2.6.32. In driver code, I am including linux/modules.h but on compiling, It gives me error linux/bounds.h not found.
I have downloaded kernel source from linux git repository. I have checked path settings. They are ok.
I checked my kernel source, there is no bounds.h file. So why my driver is expecting that. Error is coming due to including modules.h.
First, I need to run make command, so that it can generate and link all necessary files.

How to extract kernel headers for compiling kernel module later

I compiled various Linux kernel from git repositories. There are times when I copied the kernel to other system and need the kernel header to compile external module.
I tried to run "make headers_install" but it only generated a include/ folder. When I tried to point external module to that folder, it complains it cannot find Makefile.
What is the proper way to package kernel-header for deployment?
Thanks.
Create kernel packages instead, that's "make deb-pkg" for dpkg based distros and "make rpm-pkg" for RPM based ones. These create multiple packages, one of those is a package usable for external modules building. That should be linux-headers-* for the Debian packages and a "devel" package for he RPM versions.
In some ways this is just an expansion of the previous answer. If you look at the file scripts/package/builddeb in the kernel sources you will find script code which selects the files needed for building external modules from a kernel build and puts them into /usr/src/linux-headers-$version. I can find that script code in my local kernel version by searching for the string "# Build kernel header package" in the builddeb file. If you want to do things by hand you could execute that script code manually.

OCaml: how to use modules in Windows

I'm jus following the tutorial. It demonstrates the use of Graphics. It says
[Windows users: For this example to work interactively on Windows, you
will need to create a custom toplevel. Issue the command ocamlmktop -o
ocaml-graphics graphics.cma from the command line.]
I don't exactly what it means.
I have corresponding source code in "D:\MySourceCode\OCaml\2.Graphics.ml". My cmd has entered OCaml environment. Now what should I do?
On my machine OCaml is installed in C:\OCaml and its libraries to C:\OCaml\lib. If I change directory to C:\OCaml\lib and execute C:\OCaml\bin\ocamlmktop.exe -o graphics-toplevel.exe graphics.cma I get graphics-toplevel executable with built-in Graphics module. I can use Graphics.open_graph "640x480" directly without loading OCaml Graphics library.

Resources