6

I am getting an error when I try to compile drivers for a TP Link AC 600, on Kali Linux amd64 4.7.0 gcc 5.4.1 Debian 5.4.1-3.

The error is "error code model kernel does not support PIC mode"

After some flat footing I found someone whom was having similar issues and someone had posted a patch.

How do I apply the patch, and to where do I apply it?

Here is the other link: Cannot compile kernel: error, kernel does not support PIC mode

SpaceGoat
  • 61
  • 1
  • 3
  • It seems we have the very same problem on different driver. http://unix.stackexchange.com/questions/320264/unable-to-install-proprietary-nvidia-driver-after-last-kali-update – MKay Nov 02 '16 at 10:21
  • from the research I have done, It appears to be a bit of a common "issue". Fortunately, there are people whom have dealt with it and can assist, hopefully. – SpaceGoat Nov 02 '16 at 16:26
  • So, did you find a solution? Or do I need to start a bounty on this question? – Amedee Van Gasse Nov 21 '16 at 21:27
  • Have you tried to add `-fno-pie` to compiler flags when building your drivers? – Dmitry Grigoryev Nov 22 '16 at 16:28

2 Answers2

1

As far as Ubuntu and Intel drivers are concerned, Intel only tested their drivers for LTS versions of Ubuntu (see answer by Todd Fujinaka). So you need to downgrade Ubuntu from 16.10 to 16.04.1 LTS (reinstall while keeping /home).

For all other Debian-based distros like Kali, the same is true: you need to downgrade (ie reinstall) to a version that is explicitly supported by the driver vendor. A version before the gcc PIC stuff.

That may not be a pleasant answer, but it is technically correct and if you're not a kernel developer yourself, then all you can do is hang out on a kernel mailing list and very politely ask if a developer can work on the driver code. Sometimes that works, but be patient.

0

The process to apply a patch it's very simple. Assuming that you have the kernel directory and the patch file like this:

- /usr/src/kernels (or where you have the kernel directory)
---- /user/src/kernels/kernel_directory
---- /user/src/kernels/patch_file

Depending off in which format did you have the patch (normally .gz, .bz2 or .xz), you need to use a different command to extract it. You need to go into kernel_directory, and run the next command:

gzip -cd ../patch_file | patch -p1 - This for a gzip patch

bzip2 -cd ../patch_file | patch -p1 - This for a bzip patch

xz -cd ../patch_file | patch -p1 - This for a xz patch

It will apply the patch file /usr/src/kernels/patch_file into the kernel /usr/src/kernels/kernel_directory. You need to navigate first to the /usr/src/kernels/kernel_directory and run the command from there.

Take in consideration make a copy of the kernel directory, so you can do the process with a copy of the kernel in backup to revert it easily.

NOTE: This is only the process to apply the patch, assuming that you are using the proper patch for your kernel, it shouldn't give any error. You need to have the patch file, like the kernel official one's.

  • This is the patch file: http://unix.stackexchange.com/a/319830/70502, the linux kernel source is in the default location, and which Makefile do I need? – Amedee Van Gasse Nov 21 '16 at 22:00
  • /usr/src/linux-headers-4.8.0-27/arch/x86$ cat ~/e1000e-3.3.4/disable-pie.patch | sudo patch -p1 patching file Makefile patch: **** malformed patch at line 7: all: vmlinux – Amedee Van Gasse Nov 21 '16 at 22:02
  • you should use `wget` or `curl` to download the patch *as it is* and not use copy&paste – Alex Nov 28 '16 at 22:01