r/kernel • u/learningphase • May 15 '19
linux kernel compile
I have downloaded linux from https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
My system is running with 4.15.0.47.
I want to learn to do below things:
How to compile v2.6.14.6 on my system?
How to compile v2.6.14.6 with v4.9.99 on my system?
How to compile v2.6.14.6 with v2.6.11 on my system?
My goal is to be an expert in compiling and trying to gather test cases to try.I am preparing myself to find an embedded/firmware software engineer job.
2
u/danielkza May 15 '19
The awesome folk from Bootlin have material from their embedded Linux course available on their site, you could use it as a starting point for your learning.
Also, what's the point of compiling such an ancient kernel? Pretty much everything you learn about it will have changed in some way by now.
1
2
u/waftedfart May 15 '19
Find an old distro with the version you want, and install it on a VirtualBox. Actual compilation and installation aren't very difficult (YMMV), but configuration can be challenging if you're trying to streamline the kernel.
1
u/learningphase May 15 '19
Thanks for the reply. I am at a very beginner stage trying to pick up speed.
2
u/cengizIO May 15 '19
Why do you specifically need v2.6? Because of a documentation to follow?
1
u/learningphase May 15 '19
Upon downloading the source from the mentioned link, I did git tag I found a lot of versions available to check out.
So I picked out randomly as I wanted to learn
1
u/cengizIO May 16 '19
Pick a recent stable version instead. That's way too old. You can have a smoother journey by using Buildroot. You can select different versions within its menu and let it handle all that cross compilation work.
1
u/esmth May 15 '19
you won’t be building 2.6 without a toolchain with an older version of GCC
1
u/learningphase May 15 '19
That's what I wanted to learn. Wanted to understand things in a hard way?
1
u/waftedfart May 15 '19
You might not want to jump in too deep right away, it gets pretty messy. I would take your existing kernel and config file and just compile it. You can learn about cross compiling later.
0
7
u/BraveNewCurrency May 15 '19
In general, your currently running kernel does not matter at all.
Some kernels are deeply tied to versions of GCC. There are multiple ways to get different versions of GCC:
Some distros will compile multiple versions of GCC and let them be run side-by-side. (i.e. gcc-5, gcc-6)
You can have a 2nd compiler, and use env vars to "cross compile" using it.
You can use an isolation technology like Docker of VM to have a 'different computer' with the compiler you want.
If I were you, I'd start studying BuildRoot, it automates a lot of stuff for you. Build some systems (kernel+rootfs), boot them up in quemu and KVM. Then try cross-compiling an ARM kernel and boot it up in qemu-arm. Get a Raspberry PI and try booting your custom kernels on that.
Frankly, I would avoid investing time in the 2.6 kernel. v2.6.14 is almost 15 years old! Start with chips that run the mainline kernel.