You are not logged in.

#1 2010-09-08 10:43:47

cartman
Member
Registered: 2010-09-08
Posts: 5

Just received a patch from a kernel developer, what should I do?

Hello, I have been in contact with the linux kernel scsi list because of some issues I have with a SAS controller, and recently a developer sent me a patch to try.
As I have not done this before, what is the best method to recompile only the affected module and replace it with the patched one?
(I want to avoid recompiling the complete kernel and rebooting)

 drivers/scsi/libsas/sas_ata.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 042153c..ddbade7 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -347,6 +347,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
 static struct ata_port_operations sas_sata_ops = {
     .phy_reset        = sas_ata_phy_reset,
     .post_internal_cmd    = sas_ata_post_internal,
+    .qc_defer               = ata_std_qc_defer,
     .qc_prep        = ata_noop_qc_prep,
     .qc_issue        = sas_ata_qc_issue,
     .qc_fill_rtf        = sas_ata_qc_fill_rtf,

Offline

#2 2010-09-08 10:49:18

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Just received a patch from a kernel developer, what should I do?

You need to use the patch command to patch the file in question.

man patch

Usually something like this:

$ patch < patch_file.diff

Run that in the directory the file needing to be patched is in.


neutral

Offline

#3 2010-09-08 11:30:12

cartman
Member
Registered: 2010-09-08
Posts: 5

Re: Just received a patch from a kernel developer, what should I do?

Thanks for your answer, my problem is that although I have patched the correct file, I am unable to compile the module ( make modules SUBDIRS=drivers/scsi/libsas  does not work )

Last edited by cartman (2010-09-08 11:30:59)

Offline

#4 2010-09-08 12:55:51

theDOC
Member
From: Aachen, Germany
Registered: 2009-06-18
Posts: 50

Re: Just received a patch from a kernel developer, what should I do?

is it set to be compiled as a module? I if your only concern is not having to reboot, you could just do a "make modules". If you already compiled the kernel, the command should only recompile the files that changed...

Offline

#5 2010-09-10 07:58:12

cartman
Member
Registered: 2010-09-08
Posts: 5

Re: Just received a patch from a kernel developer, what should I do?

Make modules worked, but then I had vermagic issues so I had to modprobe --force-vermagic

libsas: version magic '2.6.35.4-ARCH SMP preempt mod_unload ' should be '2.6.35-ARCH SMP preempt mod_unload '
libsas: bad vermagic: kernel tainted.
Disabling lock debugging due to kernel taint

Offline

#6 2010-09-11 02:37:45

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Just received a patch from a kernel developer, what should I do?

Not sure how you patched the kernel but it looks like the error is from a mismatched kernel and module(s).
You really should be using a stock kernel directly from kernel.org to test his patch. In that case you would need to run:

mount /boot && make && make modules_install && make install && umount /boot

make modules_install is probably what you ran but make install is what is needed to tie the active kernel together with its modules.

If any of this seems confusing don't try it. Instead, get the PKGUILD of your arch kernel and simply add the patch line in and mkpkg & pacman install it.

Offline

#7 2010-09-12 02:19:15

kagerato
Member
Registered: 2007-09-10
Posts: 45
Website

Re: Just received a patch from a kernel developer, what should I do?

T-Dawg is correct.  You built the kernel module for a newer version, and then loaded it using an older kernel.

To build a stock kernel from the sources, do the following: (replace /usr/src/linux with where-ever the kernel sources actually are)

cd /usr/src/linux
make clean
make
make modules_install
make install

The second command cleans out all the binaries in the tree.  The third builds the kernel and modules.  The fourth copies the modules over to a directory in /lib/modules .  The final one copies over the kernel image, the config, and the System.map over to /boot .

If all of this concludes successfully, you just need to update your boot loader to start the new kernel.  For classic GRUB (Grub 1.x), edit the file /boot/grub/menu.lst as root.  For new GRUB (Grub 2.x), run the command 'update-grub' as root and it should pick up any new kernels in /boot automatically.

In case all of this fails for one reason or another, check out the Arch docs for doing it the Arch way.  That may be easier.  The directions I've given here will work in any GNU/Linux distro so long as you have the Linux kernel source, gcc, and the correct development libraries and headers.  (The development version of libncurses is needed for make menuconfig, for instance.  That command brings up the ncurses dialog to change the current configuration of the kernel source tree you run it in.)

Good luck.

Offline

#8 2010-09-13 14:38:58

cartman
Member
Registered: 2010-09-08
Posts: 5

Re: Just received a patch from a kernel developer, what should I do?

Thanks for your answers, they are really informative.
I am interested in doing this the arch way, or at least keeping the same kernel configuration. Would a zcat /proc/config.gz > .config be enough for that?

Offline

#9 2010-09-13 15:22:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,789

Re: Just received a patch from a kernel developer, what should I do?

yes


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB