Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riffa on ubuntu #58

Closed
erginatalar opened this issue Apr 17, 2023 · 11 comments
Closed

riffa on ubuntu #58

erginatalar opened this issue Apr 17, 2023 · 11 comments

Comments

@erginatalar
Copy link

I am new to driver installations. Can someone help me with the installation issue? I tried to install riffa on my ubuntu system and received the following error message:

erginatalar@AtalarUbuntu:~/Programming/riffa-master/driver/linux$ sudo make debug
Compiling driver for kernel: 5.19.0-38-generic with the following values
NAME: 'riffa'
MAJNUM: '100'
VENDOR_ID0: '10EE'
VENDOR_ID1: '1172'

sed -i 's/#define MAJOR_NUM [^\n]/#define MAJOR_NUM 100/g' riffa_driver.h
sed -i 's/#define DEVICE_NAME [^\n]
/#define DEVICE_NAME "riffa"/g' riffa_driver.h
sed -i 's/#define VENDOR_ID0 [^\n]/#define VENDOR_ID0 0x10EE/g' riffa_driver.h
sed -i 's/#define VENDOR_ID1 [^\n]
/#define VENDOR_ID1 0x1172/g' riffa_driver.h
sed -i 's/#define DEBUG [^\n]/#define DBUG 1/g' riffa_driver.h
sed -i 's/#define DBUG [^\n]
/#define DEBUG 1/g' riffa_driver.h
make -C /lib/modules/uname -r/build SUBDIRS=pwd modules
make[1]: Entering directory '/usr/src/linux-headers-5.19.0-38-generic'
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop.
make[1]: *** [arch/x86/Makefile:232: archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.19.0-38-generic'
make: *** [Makefile:101: riffa.ko] Error 2

@marzoul
Copy link
Collaborator

marzoul commented Apr 18, 2023

Hi,
I have never tried the make debug target, this compilation recipe may lack maintenance.
It is probably not what you want to compile the driver, just use make, no sudo should be needed.
Then proceed to installation with sudo.
Or, maybe you have not installed the Linux kernel headers package ?

@Arnoud-Bleeker
Copy link

I had a similar issue changing make -C $(KDIR) SUBDIRS=pwd modules to make -C $(KDIR) M=$(shell pwd) modules in the makefile solved it.

@marzoul
Copy link
Collaborator

marzoul commented Sep 21, 2023

I've just realized that the proposed fix is nearly exactly the patch I did 2 years ago for the Archlinux user package 😅
At that time I had no visibility about whether or not this change would be appropriate for other distros too.
https://aur.archlinux.org/packages/riffa-git
@Arnoud-Bleeker if you want to author a PR you would be welcome. Or I can do it in a few days.

@bartokon
Copy link

bartokon commented Jan 5, 2024

Ubuntu 22.04.1
`
Compiling driver for kernel: 6.2.0-39-generic with the following values
NAME: 'riffa'
MAJNUM: '100'
VENDOR_ID0: '10EE'
VENDOR_ID1: '1172'

sed -i 's/#define MAJOR_NUM [^\n]/#define MAJOR_NUM 100/g' riffa_driver.h
sed -i 's/#define DEVICE_NAME [^\n]
/#define DEVICE_NAME "riffa"/g' riffa_driver.h
sed -i 's/#define VENDOR_ID0 [^\n]/#define VENDOR_ID0 0x10EE/g' riffa_driver.h
sed -i 's/#define VENDOR_ID1 [^\n]
/#define VENDOR_ID1 0x1172/g' riffa_driver.h
sed -i 's/#define DEBUG [^\n]/#define DBUG 1/g' riffa_driver.h
sed -i 's/#define DBUG [^\n]
/#define DBUG 1/g' riffa_driver.h
echo "make -C /lib/modules/uname -r/build SUBDIRS=pwd modules"
make -C /lib/modules/6.2.0-39-generic/build SUBDIRS=/home/bartek/riffa/driver/linux modules
make -C /lib/modules/uname -r/build M=/home/bartek/riffa/driver/linux modules
make[1]: Entering directory '/usr/src/linux-headers-6.2.0-39-generic'
CC [M] /home/bartek/riffa/driver/linux/riffa_driver.o
/home/bartek/riffa/driver/linux/riffa_driver.c: In function ‘fill_sg_buf’:
/home/bartek/riffa/driver/linux/riffa_driver.c:469:29: error: too few arguments to function ‘get_user_pages’
469 | num_pages = get_user_pages(udata, num_pages_reqd, FOLL_WRITE, pages);
| ^~~~~~~~~~~~~~
In file included from ./include/linux/scatterlist.h:8,
from ./include/linux/dmapool.h:14,
from ./include/linux/pci.h:1555,
from /home/bartek/riffa/driver/linux/riffa_driver.c:52:
./include/linux/mm.h:2129:6: note: declared here
2129 | long get_user_pages(unsigned long start, unsigned long nr_pages,
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:260: /home/bartek/riffa/driver/linux/riffa_driver.o] Error 1
make[1]: *** [Makefile:2026: /home/bartek/riffa/driver/linux] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.2.0-39-generic'
make: *** [Makefile:102: riffa.ko] Error 2
makefile change:
echo "make -C $(KDIR) SUBDIRS=pwd modules"
make -C $(KDIR) M=$(shell pwd) modules
`
what can be the cause?

@marzoul
Copy link
Collaborator

marzoul commented Jan 5, 2024

Hi, I prepared fixes some time ago to compile with linux 6.5.
Your issue with get_user_pages seems part of what I fixed on my side.
I am not sure exactly what versions of linux introduced the changes.
master...marzoul:riffa:linux-65

@bartokon
Copy link

bartokon commented Jan 5, 2024

Yea but I'm already using code from "master" branch so it already includes your fix. Idk why but it seems like #define if else doesn't detect kernel version correctly. Linux version code.... how to get that number?

bartek@bartek-MS-7D25:~/riffa/driver/linux$ uname -a
Linux bartek-MS-7D25 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

and shall I change it in version.h?

bartek@bartek-MS-7D25:~/riffa/driver/linux$ uname -r
6.2.0-39-generic

@marzoul
Copy link
Collaborator

marzoul commented Jan 5, 2024

You are compiling for linux 6.2 so it is worth trying to lower the version "threshold" in the code of riffa_driver.c near line 466 probably. Change this :
#elsif LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0)
into this :
#elsif LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)

@LHDean
Copy link

LHDean commented May 31, 2024

You are compiling for linux 6.2 so it is worth trying to lower the version "threshold" in the code of riffa_driver.c near line 466 probably. Change this : #elsif LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) into this : #elsif LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)

I'm relatively new to C/C++, but shouldn't it be elif and not elsif? I was experiencing a similar problem, made this change (elsif --> elif) and it seems to compile fine now.

@marzoul
Copy link
Collaborator

marzoul commented Jun 4, 2024

Indeed. Quite surprising that there is no error nor warning on my side.
I will fix this (and the shell thing in the Makefile which got forgotten).

@marzoul
Copy link
Collaborator

marzoul commented Jun 5, 2024

Pull request opened in #64
Please comment about any missing fix.

@marzoul
Copy link
Collaborator

marzoul commented Aug 20, 2024

I suppose the issue is fixed so I am closing it.
Please reopen if necessary.

@marzoul marzoul closed this as completed Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants