Hi Team, Guys,
Feeling good to create my 1st post here. Really looking fordward to have your reply.
On RL 9.x , I could not install onload-dkms which should be easy to search and download. On RL 8.x everything’s OK.
It is because RL 9.x not able to compile the c code below. Looks there is a problem on <linux/uaccess.h>. Is there anything missing? Meanwhile <linux/module.h> is working fine.
#include <linux/uaccess.h>
MODULE_LICENSE(\"GPL\");
int func(unsigned long size)
{
return access_ok(NULL, size);
}
Here is the detail steps to trigger the problem. You could sikp:
Step 1 Install
yum install onload-dkms
...
Building module:
Cleaning build area...(bad exit status: 2)
Failed command:
make -C /lib/modules/5.14.0-427.22.1.el9_4.x86_64/build M=/var/lib/dkms/onload/8.1.3.40/build clean
Building module(s)...(bad exit status: 1)
Failed command:
/var/lib/dkms/onload/8.1.3.40/build/scripts/onload_install
Error! Bad return status for module build on kernel: 5.14.0-427.22.1.el9_4.x86_64 (x86_64)
Consult /var/lib/dkms/onload/8.1.3.40/build/make.log for more information.
Step 2 Check log
cat /var/lib/dkms/onload/8.1.3.40/build/make.log
...
/var/lib/dkms/onload/8.1.3.40/build/src/driver/linux_resource/kernel_compat.sh -k /lib/modules/5.14.0-427.22.1.el9_4.x86_64/build -q > driver/linux_resource/autocompat.h
kernel_compat.sh: Kernel build tree is unable to build modules
make: *** [/var/lib/dkms/onload/8.1.3.40/build/src/mmake.mk:34: driver/linux_resource/autocompat.h] Error 1
make: Leaving directory '/var/lib/dkms/onload/8.1.3.40/build/build/x86_64_linux-5.14.0-427.22.1.el9_4.x86_64'
onload_build: ERROR: Failed to build driver components.
onload_install: ERROR: Build failed. Not installing.
Step 3 Update test_compile
For function test_compile() function, I add a line to the test.c and remove some code to get the error print on shell.
cd /var/lib/dkms/onload/8.1.3.40/build/src/driver/linux_resource/
vi kernel_compat_funcs.sh
From
echo "$source" > $dir/test.c
cat > $dir/Makefile <<EOF
$makefile_prefix
obj-m := test.o
EOF
make -rR -C $KPATH ${ARCH:+ARCH=$ARCH} M=$dir O=$KOUT ${CC:+CC="$CC"} >$dir/log 2>&1
To
echo "$source" > $dir/test.c
cat $dir/test.c > /tmp/test.c
cat > $dir/Makefile <<EOF
$makefile_prefix
obj-m := test.o
EOF
make -rR -C $KPATH ${ARCH:+ARCH=$ARCH} M=$dir O=$KOUT ${CC:+CC="$CC"}
Step 4 Retry
Retry and located the failure on which test.c
/var/lib/dkms/onload/8.1.3.40/build/src/driver/linux_resource/kernel_compat.sh -k /lib/modules/5.14.0-427.22.1.el9_4.x86_64/build -q > driver/linux_resource/autocompat.h
Skipping BTF generation for /tmp/tmp.T9O48II4mF/test.ko due to unavailability of vmlinux
/tmp/tmp.Iy6DjKhReu/test.c:3:16: error: expected declaration specifiers or ‘...’ before string constant
3 | MODULE_LICENSE("GPL");
| ^~~~~
make[1]: *** [scripts/Makefile.build:299: /tmp/tmp.Iy6DjKhReu/test.o] Error 1
make: *** [Makefile:1934: /tmp/tmp.Iy6DjKhReu] Error 2
cat /tmp/test.c
#include <linux/uaccess.h>
MODULE_LICENSE("GPL");
int func(unsigned long size)
{
return access_ok(NULL, size);
}
Step 5 Confirm <linux/module.h> is working
I’m not providing details here. If you have different result, please advise.
Change the line we added
from
cat $dir/test.c > /tmp/test.c
to
cat $dir/test.c >> /tmp/test.c