Reputation: 15561
I am trying to build source code and running into grief.
[root@localhost Driver]# pwd
/usr/src/PlxSdk/Driver
[root@localhost Driver]# ls -la
total 36
drwxr-xr-x. 7 root root 183 Sep 15 18:10 .
drwxr-xr-x. 8 root root 123 Sep 15 18:10 ..
-rwxr-xr-x. 1 root root 658 Sep 15 18:10 buildalldrivers
-rwxr-xr-x. 1 root root 4524 Sep 15 18:10 builddriver
-rw-r--r--. 1 root root 590 Sep 15 18:10 Makefile
...
[root@localhost Driver]# ./buildalldrivers
------------------
Build: Plx8000_NT
- PLA: CentOS Linux release 8.2.2004 (Core)
- KER: 4.18.0-193.el8.x86_64
- INC: /lib/modules/4.18.0-193.el8.x86_64/build/include
- CPU: x86_64 (64-bit Little Endian)
- CMP: gcc
- TYP: 8000_NT Driver
- PKG: PCI/PCIe SDK v8.00
- CFG: Release
make[1]: *** /lib/modules/4.18.0-193.el8.x86_64/build: No such file or directory. Stop.
make: *** [/usr/src/PlxSdk/Makefiles/Targets.def:46: BuildDriver] Error 2
------------------
I saw this informative SO post, which talks of my problem, but none of the answers helped.
Use $ uname -r to check the kernel version
4.18.0-193.el8.x86_64
The complaint is No such file or directory
, however there is a build directory and the kernel developer tools do exist.
[root@localhost Driver]# ls -la /lib/modules/4.18.0-193.el8.x86_64
total 16440
drwxr-xr-x. 6 root root 4096 Sep 15 20:20 .
drwxr-xr-x. 4 root root 64 Sep 14 14:27 ..
-rw-r--r--. 1 root root 295 May 8 07:07 bls.conf
lrwxrwxrwx. 1 root root 54 Sep 15 20:20 build -> ../../../usr/src/kernels/4.18.0-193.14.2.el8_2.x86_64/
-rw-r--r--. 1 root root 187648 May 8 07:07 config
drwxr-xr-x. 12 root root 128 Sep 14 14:27 kernel
-rw-r--r--. 1 root root 865312 Sep 14 14:31 modules.alias
-rw-r--r--. 1 root root 827199 Sep 14 14:31 modules.alias.bin
-rw-r--r--. 1 root root 488 May 8 07:07 modules.block
-rw-r--r--. 1 root root 7534 May 8 07:07 modules.builtin
-rw-r--r--. 1 root root 9748 Sep 14 14:31 modules.builtin.bin
-rw-r--r--. 1 root root 287699 Sep 14 14:31 modules.dep
-rw-r--r--. 1 root root 397124 Sep 14 14:31 modules.dep.bin
-rw-r--r--. 1 root root 365 Sep 14 14:31 modules.devname
-rw-r--r--. 1 root root 140 May 8 07:07 modules.drm
-rw-r--r--. 1 root root 59 May 8 07:07 modules.modesetting
-rw-r--r--. 1 root root 1602 May 8 07:07 modules.networking
-rw-r--r--. 1 root root 100539 May 8 07:07 modules.order
-rw-r--r--. 1 root root 553 Sep 14 14:31 modules.softdep
-rw-r--r--. 1 root root 414722 Sep 14 14:31 modules.symbols
-rw-r--r--. 1 root root 505717 Sep 14 14:31 modules.symbols.bin
lrwxrwxrwx. 1 root root 5 May 8 07:07 source -> build
-rw-r--r--. 1 root root 347581 May 8 07:07 symvers.gz
-rw-------. 1 root root 3909996 May 8 07:07 System.map
drwxr-xr-x. 2 root root 6 May 8 07:06 updates
drwxr-xr-x. 2 root root 40 Sep 14 14:27 vdso
-rwxr-xr-x. 1 root root 8913656 May 8 07:07 vmlinuz
-rw-r--r--. 1 root root 166 May 8 07:06 .vmlinuz.hmac
drwxr-xr-x. 3 root root 23 Sep 14 14:30 weak-updates
[root@localhost Driver]#
The build link is valid and blinking.
[root@localhost Driver]# ls -la /usr/src/kernels/4.18.0-193.14.2.el8_2.x86_64/
total 5348
drwxr-xr-x. 24 root root 4096 Sep 15 20:56 .
drwxr-xr-x. 3 root root 42 Sep 15 17:13 ..
drwxr-xr-x. 26 root root 4096 Sep 15 17:13 arch
drwxr-xr-x. 3 root root 78 Sep 15 17:13 block
drwxr-xr-x. 2 root root 37 Sep 15 17:13 certs
-rw-r--r--. 1 root root 187644 Jul 26 00:02 .config
drwxr-xr-x. 4 root root 76 Sep 15 17:13 crypto
drwxr-xr-x. 135 root root 4096 Sep 15 17:13 drivers
drwxr-xr-x. 2 root root 22 Sep 15 17:13 firmware
drwxr-xr-x. 73 root root 4096 Sep 15 17:13 fs
drwxr-xr-x. 30 root root 4096 Sep 15 17:14 include
drwxr-xr-x. 2 root root 37 Sep 15 17:14 init
drwxr-xr-x. 2 root root 22 Sep 15 17:14 ipc
-rw-r--r--. 1 root root 575 Jul 26 00:02 Kconfig
drwxr-xr-x. 17 root root 4096 Sep 15 17:14 kernel
drwxr-xr-x. 16 root root 4096 Sep 15 17:14 lib
-rw-r--r--. 1 root root 60925 Jul 26 00:02 Makefile
-rw-r--r--. 1 root root 1325 Jul 26 00:02 Makefile.rhelver
drwxr-xr-x. 3 root root 71 Sep 15 17:14 mm
-rw-r--r--. 1 root root 0 Sep 15 20:51 modules.order
-rw-r--r--. 1 root root 1241984 Jul 26 00:02 Module.symvers
drwxr-xr-x. 70 root root 4096 Sep 15 17:14 net
drwxr-xr-x. 26 root root 4096 Sep 15 17:14 samples
drwxr-xr-x. 13 root root 8192 Sep 15 17:14 scripts
drwxr-xr-x. 10 root root 151 Sep 15 17:14 security
drwxr-xr-x. 26 root root 4096 Sep 15 17:14 sound
-rw-r--r--. 1 root root 3910607 Jul 26 00:02 System.map
drwxr-xr-x. 2 root root 6 Sep 15 20:51 .tmp_versions
drwxr-xr-x. 29 root root 4096 Sep 15 17:14 tools
drwxr-xr-x. 2 root root 37 Sep 15 17:14 usr
drwxr-xr-x. 4 root root 44 Sep 15 17:14 virt
-rw-r--r--. 1 root root 41 Jul 26 00:02 vmlinux.id
[root@localhost Driver]#
sudo dnf install kernel-devel-$(uname -r)
Already installed
@Nighthawk663 in his answer stated Notice that the "source" link is also broken because it points to build.
My Source
link also points to build, but nothing that I did has it going anywhere else. I do not know if that is a valid comment or not.
[root@localhost Driver]# rpm -i /home/mnvme/Downloads/kernel-devel-4.18.0-193.el8.x86_64.rpm
package kernel-devel-4.18.0-193.14.2.el8_2.x86_64 (which is newer than kernel-devel-4.18.0-193.el8.x86_64) is already installed
[root@localhost Driver]#
The PLX SDK Linux Support Release Notes page stated some requirements, which I followed:
In order to build the files supplied, the shell environment variable PLX_SDK_DIR must be set. This should be set to the root location of where the PlxSdk folder is created.
# export PLX_SDK_DIR=$HOME/PlxSdk
#
# Or in my case
export PLX_SDK_DIR=/usr/src/PlxSdk
I did update my .bashrc
file with that line and the comment.
I wanted to verify that gcc
works and that there is no issue with the compiler, so I built the API and one of the samples. Here is the output from building one of the samples.
[root@localhost Samples]# cd ApiTest
[root@localhost ApiTest]# make
Build: ApiTest
- PLA: CentOS Linux release 8.2.2004 (Core)
- CPU: x86_64 (64-bit Little Endian)
- CMP: gcc
- TYP: Sample App
- PKG: PCI/PCIe SDK v8.00
- CFG: Release
CC /usr/src/PlxSdk/Samples/Shared/ConsFunc.c
CC /usr/src/PlxSdk/Samples/Shared/PlxInit.c
CC ApiTest.c
LNK ApiTest
Application "App/ApiTest" built successfully
[root@localhost ApiTest]# cd ..
[root@localhost Samples]#
As such, the problem is strictly building the driver and in particular there is something with the kernel that makes the build tools not happy.
Attempting to load the driver states that I did not build the driver, as expected. (I am also stating the load command for completeness sake.)
[root@localhost Bin]# ./Plx_load 8000d d
Install: Plx8000_DMA_dbg
Load module......... ERROR: Driver not built or invalid path
\-- /usr/src/PlxSdk/Driver/Source.Plx8000_DMA/Output/Plx8000_DMA_dbg.ko
[root@localhost Bin]#
NOTE:
The PLX Release Notes states the following, which apply to my problem.
Kernel 2.6 Kernel 2.6 introduced the Linux kernel build system. In order to build PLX drivers, or any other drivers for that matter, the Linux build system requires the following:
·Linux kernel development package, which matches the destination kernel version, must be installed
·In some cases, the current running kernel must be configured and built manually If the PLX driver fails to build, please verify the requirements mentioned above are met.
I have the Linux kernel development package matching the destination kernel version as discussed previously, and I am not sure about the second point. I will investigate that.
Thoughts?
Upvotes: 0
Views: 797
Reputation: 15561
The specific answer to the problem was to create the symbolic link without the ../../.. like on the samples.
I executed as root the command from the /lib/modules/4.18... directory.
ln -s /usr/src/kernels/4.18.0-193.14.2.el8_2.x86_64/ build
Doing so then yielded a solid blue on black link to which I was able to do a CD into that.
I was then able to get to my next problem, but first problem resolved.
The funny thing is that I tried the above command before. Maybe I had to install something and then do that line. All I know is the culmination of everything above resolved the issue. Thanks to @JohnBollinger for the steer to the right direction.
[mnvme@localhost Driver]$ ./buildalldrivers
------------------
Build: Plx8000_NT
- PLA: CentOS Linux release 8.2.2004 (Core)
- KER: ver 4.18.0-193.14.2.el8_2.x86_64
- INC: /lib/modules/4.18.0-193.el8.x86_64/build/include
- CPU: x86_64 (64-bit Little Endian)
- CMP: gcc
- TYP: 8000_NT Driver
- PKG: PCI/PCIe SDK v8.00
- CFG: Release
arch/x86/Makefile:248: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop.
make: *** [/usr/src/PlxSdk/Makefiles/Targets.def:46: BuildDriver] Error 2
The solution to the non-retpoline
error comes via a search and this post. I have to:
export the PLX_CHIP type of each project and make the project as root.
From a # prompt:
cd /usr/src/PlxSdk export PLX_CHIP=8000_NT make export PLX_CHIP=8000_DMA make export PLX_CHIP=6000_NT make
The 9000 code has a compiler bug.
Upvotes: 1