Understanding linux kernel and patches releases - linux

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!

Related

Linux Kernel minor number vermagic comparison

I have a simple question about modules in the linux kernel.
Is it guaranteed that my compiled module works throughout the whole X.Y kernel release.
X: Kernel version
Y: Major version
Z: Minor version
So for example:
I compile my module.ko with the tree of a 4.9 Kernel.
Then it is possible to insmod my module with 4.9.24, 4.9.31,4.9.34,...?
So does the vermagic comparison skip everything after the major number?
Are you familiar with https://github.com/torvalds/linux/blob/master/Documentation/process/stable-api-nonsense.rst ?
If you want stable ABI you need to target kernels shipped with RHEL or SLES (or their derivatives which claim to maintain the ABI).

What does the number following 'linux-2.6.38.' in the file names like linux-2.6.38.1.tar.xz and linux-2.6.38.2.tar.xz mean?

I wanted to download Linux kernel 2.6.38 source files from https://www.kernel.org/pub/linux/kernel/v2.6/
but the webpage listed linux-2.6.38.1.tar.xz, linux-2.6.38.2.tar.xz etc, as well as linux-2.6.38.tar.xz.
What's the relationship between them? Which file should I choose?
These number represents the kernel version/releases, and give us information about its stability. From here :
The first number denotes the kernel version. It is changed least
frequently, and only when truly major changes in the concept and the
code of the kernel occur. In fact, it has been changed only twice in
the history of the kernel: in 1994 with version 1.0 and in 1996 with
version 2.0.
The second number denotes the major revision of the kernel version. It
was formerly the case that even numbers indicated a stable release,
that is, one that was deemed fit for production use (i.e., use in a
non-experimental environment), such as 1.2, 2.4 or 2.6. Likewise, odd
numbers, such as 1.1 or 2.5, have historically represented development
releases. They were for testing new features and device drivers until
they became sufficiently stable to be included in a stable release.
However, this has changed starting with the Linux 2.6.x series, and
new feature development now takes place in the same revision number.
The third number indicates the minor revision of the kernel. It is
only changed when new features or new drivers are added.
The fourth number represents corrections, such as security patches and
bug (i.e., error) fixes.

Does a new kernel contain all patches with all the options

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.

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.

Kernel module alias

When compiling different versions of the Linux kernel, every now and then I see some drivers being dropped in favor of others.
For instance, the commit 5772dcaa790851ec068afcd0d1f160d801b1126e drops (removes) the IBM driver for the Xirlink C-it Camera, located in drivers/media/video/usbvideo/ibmcam.c in the v2.6.37 branch. The newer driver appears in v2.6.38 at drivers/media/video/gspca/xirlink_cit.c.
For that particular driver, I see that all devices supported by the newer driver are supported by the old , as written in its usb_device_table, defined in xirlink_cit.c. However, I don't see any alias from the newer driver module towards the older. I know the existence of the MODULE_ALIAS macro, but in this case in particular, I don't see it being used.
That said, I want to know all possible ways in which aliases can be programatically defined.
Any help appreciated :)

Resources