PDA

View Full Version : Recompiling the Kali Linux Kernel



bolexxx
2013-02-01, 15:38
If you are in need of recompiling the kernel, please read below:


To read the full document, check our Recompiling the Kali Linux Kernel (http://docs.kali.org/development/recompiling-the-kali-linux-kernel) article.

If you have any issues with this procedure, please post them in this thread.

jkocan
2013-03-15, 11:59
It looks like some of the files are missing from the Kali site for installing kernel source. In addition to running the commands below (per the instructions) I can see that the files are actually missing from the site (when trying to download with a browser).

apt-get install linux-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
linux-source-3.7
Suggested packages:
libncurses-dev ncurses-dev libqt4-dev
The following NEW packages will be installed:
linux-source linux-source-3.7
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 82.4 MB of archives.
After this operation, 82.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://http.kali.org/kali/ kali/main linux-source-3.7 all 3.7.2-0+kali5
404 Not Found
Get:1 http://http.kali.org/kali/ kali/main linux-source all 3.7+46+kali1 [4,482 B]
Fetched 4,482 B in 0s (5,003 B/s)
Failed to fetch http://http.kali.org/kali/pool/main/l/linux-kali/linux-source-3.7_3.7.2-0+kali5_all.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

duck-duck
2013-03-15, 22:24
have similar problem.

and questions:
If I have understood correctly Kali is dependent wheezy?
It fits everything I can with full use of wheezy?
and how it looks with the other debian distros?

Koderground
2013-03-21, 14:07
Very useful, thank you very much.

smelly-toilet
2013-03-27, 11:36
is the standart injection in the download Kali-kernel (the kernel which i can prebuild), or only in the kali-ISO Kernel?
in the documentation is written i must copy the config from standart kali kernel in to the Download kali kernel.
but i have the problem, when iam copy the config into the new kernel, he doesnt find the config.
i have search the config, but doesnt found.
I do not know if I have misunderstood with copy?

cobra
2013-05-05, 23:09
You can copy the config file located on /boot, then change the name for .config. But as far as I know you may loose all the patched wifi drivers and maybe more...

MrCapo
2015-09-06, 22:18
try again with best connection

abizjak
2016-11-20, 23:02
This weekend I installed Kali linux on my laptop. I have issue with compiling the kernel using the following instructions: Recompiling the Kali Linux Kernel (http://docs.kali.org/development/recompiling-the-kali-linux-kernel)

Beside that instructions are a bit outdated (there is no more unxz and ncurses-dev packages, instead there are xz-utils and libncurses5-dev packages), I have the following problem:

When I run

fakeroot make-kpkg kernel_image
i got error:

Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
Makefile:1052: recipe for target 'prepare-compiler-check' failed

So I tried with

time KCPPFLAGS="-fno-PIE" fakeroot make-kpkg kernel_image
and after that I got next error:

make[2]: *** No rule to make target 'debian/certs/benh@debian.org.cert.pem', needed by 'certs/x509_certificate_list'. Stop.
Makefile:972: recipe for target 'certs' failed

So I removed CONFIG_MODULE_SIG_ALL, CONFIG_MODULE_SIG_KEY and
CONFIG_SYSTEM_TRUSTED_KEYS from .config file.

After
time KCPPFLAGS="-fno-PIE" fakeroot make-kpkg kernel_image
I got the third error, without specific message (see attachment err3.txt).
What I am doing wrong? Any help would be appreciated. I am using 4.6.0-kali1-amd64, and new kernel is from linux-source package (version 4.8.5). I am using gcc version 6.2.0 20161109 (Debian 6.2.0-13).

Thank you for the help.

abizjak
2016-11-25, 18:10
I managed to solve the issue;

1. set CONFIG_SYSTEM_TRUSTED_KEYS="" in .config file

2. in make menuconfig changed to

--- Enable loadable module support
Module signature verification
Require modules to be validly signed
Automatically sign all modules
Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->
for details see
https://wiki.gentoo.org/wiki/Signed_kernel_module_support

3. compiled using
time KCPPFLAGS="-fno-PIE" fakeroot make-kpkg kernel_image

At the end I ran out of disk space during kernel build, but this is my problem. I am compiling again.