Home Home > 2014 > 04 > 15 > Have some fun today… compile kernel
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

Have some fun today… compile kernel

April 15th, 2014 by

Are you bored or seeking something to do? Do you want to do something that your friends will call just waste of time but it is so highly nerdy and most cool? Do you want to know what makes openSUSE or Linux in general tick?

Kernel? eh what?

Imagine a car where you can change motor as many times you like. You can tune your motor as much as you can and you can run it in your car again with Linux you can do that. Your ride with new kernel can be good or really bad (or something between).
As you might know Linux is just a name for Linux-kernel as Google Android is just Google’s forked Linux kernel. What happens after kernel booting is not that important anymore.

User-space and kernel-space

Nearly every modern operating system separate kernel-space and user-space. Your applications like browser works in user-space and your USB-stick operates in kernel-space. In normal life you never have to cross kernel space but If you do you should really find what are: /dev, /proc and /sys directories in Linux. Those directories contains kernel stuff what is in there you have to check from Internet or how /sys works from this Wikipedia article.

openSUSE kernel

Official linux kernel can be found on https://www.kernel.org/ and kernel newbies can go here (Really give time to that site if you don’t know what you are doing). You have to make clear to yourself there is no official binaries for Linux kernel. If you compile and start using yours it’s as official as anyone else. Distributions have their own official kernel binaries and that that.
So you can just pull kernel from git version control down and start compiling right a way. It’s not that easy you need to have config file and doing that is hardest part. There is preset configs in Linux but I assume you are using openSUSE version of Linux kernel.
That means what you ask from me? You have to understand there is official and only official Linus Torvals kernel GIT and then there is hundreds versions of kernel that contains some random stuff that is not allowed in mainline Linus Torvalds version.
Mainly every distribution have their own version of Kernel and openSUSE is not an exception of this. openSUSE Linux kernel can be pulled from git: http://kernel.opensuse.org/cgit/kernel/.

WTF? ROLF? I’ll install something that only has binaries

Yes please do so there is kernel binary running in your openSUSE currently and you don’t have to change that. Compiling kernel is not for people in hurry nor for people that doesn’t have adventurous mind or some urge to do it. It takes time to learn and years to master really. In that time frame you just have to admit that sometimes your new compiled kernel doesn’t event boot. So we start and we need some tools (install them as root)

zypper install gcc make git

so then we clone openSUSE kernel stable branch (see this page for more)

git clone -b stable git://kernel.opensuse.org/kernel.git

You need couple of gigabytes free space just for pull and one gigabyte more for the build. So now you have openSUSE Linux kernel. If you like to compile it biw then we get config file. We get that openSUSE uses for desktop kernel from x86_64. Attention! if you are using x86 machine it won’t boot 64-bit kernel! So use this file here if you have 32-bit machine.. After that this is how you do it:

wget http://kernel.opensuse.org/cgit/kernel-source/plain/config/x86_64/desktop?h=stable
mv desktop\?h\=stable .config
make oldconfig
make bzImage
make modules
make bzImage modules

and again it takes time if you have for example 4 cpu you can allways compile with all of them

make bzImage modules -j4

I won’t tell you how to get it running until next time. You can tune config with

make menuconfig

Test compiling with different kernel config options make it non workable and start again. You can test different x86_64/x32 architectures and remove modules or compile everything in kernel (After all linux is monolithic kernel). So happy compiling times and remember to have fun..

Both comments and pings are currently closed.

Comments are closed.