I read from wireless developers that I have to run make menuconfig
command to change some configuration of the wireless driver (enable/disable something). After changing, do I have to recompile the kernel to give effect to changes? If I have to, how to compile?
3 Answers
First of all you have to get the kernel sources. Please have a look at the answer to »Getting the kernel source in Ubuntu«. It shows you where to get the sources. If you used the command apt-get source linux-source
, you'll a tar.gz-file. You can double-click on it to unpack or use the command line:
tar xfz linux.tar.gz
You might also need several other packages. This command installs all needed:
sudo apt-get install git kernel-package fakeroot build-essential ncurses-dev
Now you should change into the directory where your kernel sources reside. If you downloaded it with git
they might be in the subdirectory linux
. Otherwise they are copied to /usr/src
.
In the next step you should copy your existing kernel config file to the source tree:
cp /boot/config-$(uname -r) .config
And now you can execute
make menuconfig
and enter your changes. Please see also the site GitKernelBuild in the Ubuntu wiki for more advice. After you saved your changes you can compile your new kernel:
CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
and if you enter ls ..
you'll see some .deb
files. You can install them and use your new kernel.
-
I followed "apt-get source linux-source..." and dowloaded a "linux...tar.gz". Now do I have to extract it?– victorDec 18, 2012 at 11:09
-
-
please help me until I finish it. Now, I am at extracted folder, run command "cp /boot/config-$(uname -r) .config" and "make menuconfig". I made my changes and then recompile kernel. Is it right?– victorDec 18, 2012 at 11:25
-
Yes, if you type
make menuconfig
there should appear a menu on the command. line– qbiDec 18, 2012 at 11:29
You can look here for more instructions for a Debian specific way.
To build the kernel, execute these two commands:
make-kpkg clean fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
After
--append-to-version=
you can write any string that helps you identify the kernel, but it must begin with a minus (-) and must not contain whitespace.
This site has more generic instructions, which look a lot more familiar:
Start compiling to create a compressed kernel image, enter:
make
Start compiling to kernel modules:
make modules
Recompiling current 5.4.0 kernel on 20.04
Preparation
$ sudo apt install build-essential bison flex gcc-9 g++-9 libncurses libncurses-dev libssl-dev
The next will download current kernel sources
$ sudo apt install linux-source
Go to the directory with kernel sources archive and extract it
$ cd /usr/src/linux-source-5.4.0/
$ sudo tar xvfj linux-source-5.4.0.tar.bz2
$ cd linux-source-5.4.0
Configure kernel
$ sudo make menuconfig
Change it if you like, save and exit
Compile it using your number of threads after a "-j" option
$ sudo make -j2 deb-pkg LOCALVERSION=-cust
Install it
$ sudo apt install ../linux-*cust*.deb
Reference could help