Recompile current kernel only

Greetings,

Currently, I have this requirement to change a kernel parameter (presumably in “menuconfig”) and recompile the kernel with this new setting.

I have never recompiled a kernel and am trying to learn. I Googled the process and came up with some tutorials like (How to: Compile Linux kernel 2.6), but they all involved downloading the latest kernel image, etc.

What I am looking to do is use the current SUSE kernel I that is already installed, modify its parameters, and recompile as I am not sure whether the latest kernel would be compatible with OpenSUSE, etc.

Are there any documents or tutorials which teach me how to modify, recompile, and re-install the current kernel that I have?

Thanks!

Hi!
First, you need to install kernel-source package and some required packages to build kernel from source.

zypper in kernel-source gcc make zlib-devel ncurses-devel

other dependencies will be installed automatically.
Next, in /usr/src/linux directory, you can execute command:

make cloneconfig

this command will configure kernel source with options of the current running kernel.
next, you can configure kernel with

make menuconfig

be sure, that you change “local version” of your kernel configuration in “General setup” - “Local version - append to kernel realease”.
After configuration you can run:

make
make modules_install
make install

initrd file will be created automatically, during last command.
After that, you will need to add your new kernel entry in /boot/grub/menu.lst manually.
If i wrote something wrong, or miss something, i hope, that someone will correct me.
Good luck!

novsan, thank you very much - that was exactly what I was looking for and a big help. I had most of the packages installed from the C/C++ Development pattern, but did not install the kernel source :P.

By the way, what would happen if I went and downloaded the latest Linux kernel and installed that? Is this a generally-recommended practice and will it potentially break the system?

On 04/16/2010 12:56 PM, jester b84 wrote:
>
> novsan, thank you very much - that was exactly what I was looking for
> and a big help. I had most of the packages installed from the C/C++
> Development pattern, but did not install the kernel source :P.
>
> By the way, what would happen if I went and downloaded the latest Linux
> kernel and installed that? Is this a generally-recommended practice and
> will it potentially break the system?

The kernels in http://kernel.org do not have the specialized patches
that openSUSE adds, including but not limited to AppArmor, but they work
fine. I do kernel testing and development for wireless devices. I’m
currently running 2.6.34-rc4 and only run the standard kernels to check
on a problem reported in the fora. With each kernel cycle, the early rc
releases may have problems for some hardware; however, my HP DV2500
laptop usually has no problems. You will need to build any out-of-kernel
drivers yourself.

lwfinger, thanks for the reply. Seems I would be better sticking with the kernel I have at the moment. Will be sure to experiment though at a later date when I get more comfortable with the process.

Check this also:

Compiling kernel in openSUSE – easy way

Or if you prefer building as an rpm package…

OpenSUSE 11.2 - How to compile a Kernel for Newbies - Linux Tweaking