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

Fix compile for 5.15.6-200.fc35.x86_64 #42

Merged
merged 2 commits into from
Dec 17, 2021
Merged

Fix compile for 5.15.6-200.fc35.x86_64 #42

merged 2 commits into from
Dec 17, 2021

Conversation

mbana
Copy link
Contributor

@mbana mbana commented Dec 13, 2021

  • #include <scsi/sg.h> is needed for newer Kernel.
  • scp->request has been removed and scsi_cmd_to_rq(scp) should be used instead.

Before:

$ cd src
$ make
make -C /lib/modules/5.15.6-200.fc35.x86_64/build M=/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src
make[1]: Entering directory '/usr/src/kernels/5.15.6-200.fc35.x86_64'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
  You are using:           gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
ln -sf `basename /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcblob.x86_64.o .o` /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcblob.x86_64.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_init.o
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_init.c: In function ‘rcraid_resume_one’:
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_init.c:1105:9: warning: ignoring return value of ‘pci_enable_device’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1105 |         pci_enable_device(adapter->pdev);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_init.c:1130:5: warning: ignoring return value of ‘pcim_enable_device’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1130 |     pcim_enable_device(pdev);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.o
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c: In function ‘rc_msg_send_srb’:
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c:1471:32: error: ‘struct scsi_cmnd’ has no member named ‘request’
 1471 |         srb->timeout      = scp->request->timeout/HZ;
      |                                ^~
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c: In function ‘rc_msg_srb_complete’:
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c:1873:70: error: ‘GOOD’ undeclared (first use in this function)
 1873 |                 scp->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | GOOD;
      |                                                                      ^~~~
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c:1873:70: note: each undeclared identifier is reported only once for each function it appears in
/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.c:1913:62: error: ‘CHECK_CONDITION’ undeclared (first use in this function)
 1913 |         scp->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | CHECK_CONDITION;
      |                                                              ^~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:277: /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.o] Error 1
make[1]: *** [Makefile:1872: /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.15.6-200.fc35.x86_64'
make: *** [Makefile:68: module] Error 2

After:

$ cd src
$ make
make -C /lib/modules/5.15.6-200.fc35.x86_64/build M=/run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src
make[1]: Entering directory '/usr/src/kernels/5.15.6-200.fc35.x86_64'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
  You are using:           gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
ln -sf `basename /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcblob.x86_64.o .o` /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcblob.x86_64.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_msg.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_mem_ops.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_event.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rc_config.o
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/vers.o
  LD [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcraid.o
  MODPOST /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/Module.symvers
  CC [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcraid.mod.o
  LD [M]  /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcraid.ko
  BTF [M] /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcraid.ko
Skipping BTF generation for /run/media/mbana/sabrent_rocket_q4/@/dev/github/banaio/rcraid-dkms/src/rcraid.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/kernels/5.15.6-200.fc35.x86_64'

* `#include <scsi/sg.h>` is needed for newer Kernel.
* `scp->request` has been removed and `scsi_cmd_to_rq(scp)` should be used instead.
@thopiekar
Copy link
Owner

thopiekar commented Dec 13, 2021

Does it build on older kernels still? See that you've included #include <scsi/sg.h> - since when does it exist?

PS: If it is a new header, please put your code in #if LINUX_VERSION_CODE <= KERNEL_VERSION(X,Y,Z) sections, so the driver can be built on older kernel versions still.

@mbana
Copy link
Contributor Author

mbana commented Dec 13, 2021

Does it build on older kernels still? See that you've included #include <scsi/sg.h> - since when does it exist?

Define older kernels, please.

To answer the question, I didn't check. I tried what I mentioned earlier. Is suggest you have a GitHub workflow that builds on different OSes and/or kenels. At least that way one can be somewhat sure, their changes buillds.

@thopiekar
Copy link
Owner

thopiekar commented Dec 13, 2021

Nope, never had the time to prepare something like this.
I would be interested in having this working for the last Ubuntu LTS at least, which is version 5.4.x .
If you could make a quick check on this version that would be great :)

@mbana
Copy link
Contributor Author

mbana commented Dec 14, 2021

Nope, never had the time to prepare something like this. I would be interested in having this working for the last Ubuntu LTS at least, which is version 5.4.x . If you could make a quick check on this version that would be great :)

The CI pipeline can be viewed at: https://github.com/banaio/rcraid-dkms/actions/runs/1578132114.

The corresponding CI file can be viewed at: https://github.com/banaio/rcraid-dkms/blob/5.15.6-200.fc35.x86_64/.github/workflows/rcraid-dkms-ci.yml.

It's building on ubuntu-18.04 and ubuntu-20.04 using, I believe, the 5.4.0 Kernel.

@thopiekar
Copy link
Owner

Awesome! From my experience, things can break while loading the driver still and give kerneloops.
But yeah, let's cross fingers and see what it gives. We can revert and/or rework the changes made here later if needed.

Thank you for your efforts!

@thopiekar thopiekar merged commit 6f64c83 into thopiekar:master Dec 17, 2021
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

Successfully merging this pull request may close these issues.

2 participants