Does a new kernel contain all patches with all the options - linux

Well, let's start with what I know.
I know that I can apply a linux kernel patch to upgrade my current kernel version. let's say that I've a 4.2 version and I want to upgrade to 4.3 I can apply this patch:
https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.3.xz
Now let's say that I don't want that I want to install the 4.3 kernel(without patching my current one) I can do that by:
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.xz
Now let's move on to what ruined my knowledge, while researching on how to make a linux kernel run in RealTime, I found that I need to apply this patch to the kernel that I downloaded:
https://www.kernel.org/pub/linux/kernel/projects/rt/4.1/patch-4.1.15-rt17.patch.xz
My question here is: Does "linux-4.3.tar.xz" have RT support on no, to have it available I need to apply "patch-4.1.15-rt17.patch.xz" to any kernel that I want to be supporting RealTime feature ?
some Src: http://proaudio.tuxfamily.org/wiki/index.php?title=Realtime_(RT)_Kernel#Obtain_the_kernel-source_and_necessary_patches

New kernel contains only accepted patches. AFAIK RT kernel patches are not accepted in vanilla kernel (to which you refer as "patch-4.3"), so it is developed as separate project and provides its own patches to be applied on vanilla kernel.
I suppose RT support is developed in this repository: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-rt-devel.git/
Here is a repository for vanilla kernel: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
You may try to seek any merges from RT to vanilla kernel, but I doubt that they exist.

The RT patches are not part of the upstream, mainline kernel yet. It's a feature in development, and released as patches on top of each supported mainline kernel release. To use RT, you need to choose the RT patchset that matches the mainline kernel you want to use.
Gradually, the patches are being merged to mainline kernel. At the same time, the mainline kernel moves on, and the other out-of-tree RT patches might no longer apply without rebasing. That's why there are RT patches for each (supported) mainline kernel release.

Related

Kernel module compatibility with kernel recompiled with new patch

I would like to know if a Linux Kernel Module can be used with a Linux Kernel version of a higher patch number (last number in the version) than the kernel was compiled against.
Take the following example:
You are currently using Linux 4.14.75 for an ARM target
I give you an RPM containing an application and kernel module that work together. The module was compiled against the 4.14.75 kernel. The module is loaded with insmod by the application.
A security concern arises and you update your target's kernel to 4.14.100.
Given this situation, will the kernel module in the RPM I gave you work with the new kernel?Is it possible to compile a kernel once and have it be compatible with all 4.14 kernels?
I am NOT asking if depmod/modprobe will work or if it is good practice.
"Is it possible to compile a kernel once and have it be compatible with all 4.14 kernels?"
If security updates and backports do not break anything, maybe.
However there is no stable Kernel API/ABI in the Kernel.
Just userland API/ABIs are stable.
https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kernel-Stable-API-ABI
https://github.com/torvalds/linux/blob/master/Documentation/process/stable-api-nonsense.rst
Here a post to automatically check, if any API/ABI to userland will break/breaks:
Linux kernel API changes/additions
For Kernel ABI I found a tool for that (and your use case):
https://developers.redhat.com/blog/2018/03/28/analyzing-binary-interface-changes-linux-kernel/

linux 0.01 kernel cross reference

i am searching for a linux cross reference for the first linux kernel 0.01,
many websites provide a LXR (Linux Cross Reference) for existing kernels starting from 2.x but not including old ones.
There is no cross-reference readily available for this version, because it is too old. If you want one, you will have to create it yourself. (Which should not be difficult; this version of the kernel is barely 10k lines of code. This is small enough that a cross-reference is hardly even necessary.)
Keep in mind that Linux 0.01 was a very early release. It represents the original "pre-alpha" version of the kernel that Linus Torvalds made available on his university's FTP server in 1991. At that point in time, the kernel had one developer (Linus himself) and no users.
Moreover, Linux 0.01 isn't even a very good resource for learning about the Linux kernel. It predates much of the modern organization of the kernel, and as such is significantly different from modern kernels. In particular:
Kconfig is not present. Linux 0.01 had no configuration options at all, and was built using hand-written Makefiles.
There is no arch directory yet. Linux 0.01 would only build and run on x86 systems.
There is no drivers directory either. The system only supported a few built-in system devices, such as the hard disk and keyboard, and those were essentially hard-coded into the kernel directory.
There is no support for SMP systems, nor any form of locking or kernel preemption. Multiprocessor x86 systems were extremely rare when Linux 0.01 was released, so Linus didn't have one to test on.
Many commonly used macros and structures in the modern Linux kernel, such as struct list, are not yet present. There wasn't a need for them yet.
Trying to use this extremely early version of Linux for learning purposes is not a good introduction to Linux kernel programming. If you want to learn, you should really work with a current version.
You don't need a cross-reference site. If you have a copy of the source code, download and use cscope. It's a great tool for searching C programs; I'm sure you'll find it useful.

Yocto add driver from newer kernel version

I need to add a wireless driver to a Yocto image that uses kernel 3.10.17. My problem is that the driver entered mainline kernel since version 3.11 (and it is also part of the backports project). I have read the Yocto documentation about kernel development, but it more confused me. What is the proper way to accomplish this? (I suppose adding the driver sources by hand is not).
First: It's not clear which Yocto version you are using. So you might want to update to the current 1.7 version (Dizzy) which provides Kernel 3.10, 3.14 and 3.17.
You can find the kernel configuration in meta/recipes-kernel/linux. Be aware that a BSP or any other layer can also provide other kernel versions/configuration as well as limiting accepted/working version (especially if you use a BSP).
That said, you can define the kernel version that should be used by adding/adjusting PREFERRED_VERSION. An example is PREFERRED_VERSION_linux-stable = "3.10". Another one you can find is PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-dev".
Please be aware that just choosing another kernel doesn't guarantee that the kernel module you want to have will be automatically build. You might need to adjust the kernel configuration to compile it into the kernel or build it as module.

Understanding linux kernel and patches releases

I would like to better understand how linux kernel / patches releases work.
For example, if I open www.kernel.org today (Dec 12, 2013) the main download (yellow button) takes me to "linux-3.12.5.tar.xx" that is the latest stable. This is clear.
But if I move into "https://www.kernel.org/pub/linux/kernel/v3.x/", I can find (among many archives):
(1) linux-3.12.tar.gz
(2) patch-3.12.5.gz
(3) patch-3.12.gz
So the first question: is "linux-3.12.5" = (1)linux-3.12 "+" (2)patch-3.12.5?
If so, what is "patch-3.12"(3) for ? is "linux-3.12" = linux-3.11 "+" (3)patch-3.12 like above?
Thanks!
According to https://github.com/torvalds/linux/blob/master/README (line 95 onward):
Unlike patches for the 3.x kernels, patches for the 3.x.y kernels
(also known as the -stable kernels) are not incremental but instead
apply directly to the base 3.x kernel. For example, if your base
kernel is 3.0 and you want to apply the 3.0.3 patch, you must not
first apply the 3.0.1 and 3.0.2 patches. Similarly, if you are running
kernel version 3.0.2 and want to jump to 3.0.3, you must first reverse
the 3.0.2 patch (that is, patch -R) before applying the 3.0.3 patch.
You can read more on this in Documentation/applying-patches.txt
Thanks to n.m. for linking source!

Upgrade a specific Linux Kernel Subsystem?

Is it possible to upgrade only a specific sub-system, say I2C, of the Linux Kernel.
For example:
Is it possible to include "Support for multiplexed I2C bus topologies (introduced in Kernel 2.6.36)" in the Kernel version 2.6.31.1.
No this is not possible.
A kernel module or 'subsystem' (eg the i2c module) is build for a specific kernel image, you cannot combine different kernel(module) versions.
If you are feeling lucky (depending on your kernel skills), you could:
download the source code of your kernel
Install compiler and friends
add the updated ic2 driver
Try to compile the module for your kernel version
Cross your fingers and load it into your own kernel...\
I do not have any experience with this, so I do not know whether this works or not. Of course, if the ic2 module requires other (updated) modules, you could be ending up with updating (almost) the complete kernel...

Resources