Development/Howto/2009Kernel/StableABI

From Mandriva Community Wiki

Jump to: navigation, search

Contents

[edit] Using ABI versioning in Mandriva Kernels

This is the initial version of the document describing the necessary steps to have a system to manage changes between the updates of stable and OEM Mandriva Kernels that does not require module rebuilds on every kernel update.

[edit] The Problem

Current Mandriva Kernel updates require all external modules to be rebuilt in order to have them installed in a directory that can be found by the depmod stuff. We also have OEM setups where providing channels do redistributing some modules is not easy.

On every security update, we have to:

  • (usually) I prepare a kernel, send it to vdanen;
  • build a kernel, place it on testing/;
  • ask the "binary DKMS guy" (blino or spuk) to get the kernel from testing/ and rebuild all the modules against it;
  • blino/spuk places the built modules on testing/ too;
  • the main security guy gathers all the modules and pushes them to the update repositories.

Note: currently this procedure has been somewhat simplified:

  • (usually) I prepare a kernel;
  • kernel is built in secteam machines;
  • DKMSs are built in secteam machines;
  • kernel and DKMSs are pushed to the update repositories.

(Also, there's a missing step in both: QAteam tests kernels and DKMSs.)

[edit] One alternative: only rebuild modules when ABI changes

Ubuntu and SuSE use symbol version to try to address it.

[edit] How Ubuntu does it

Ubuntu has a version component called "ABI Number", whenever the Makefile.symvers change, the ABI number is increased and all external modules must be rebuilt.

The build scripts create one file with based on Makefile.symvers, but with a different column order (dunno why):

EXPORT_SYMBOL_GPL_FUTURE drivers/usb/core/usbcore 0x1acd1ff3 usb_register_driver

Then the file generated in the current build is compared against the generated in the last ABI release:

if [ "`diff -u $prev_abidir/$flavour $abidir/$flavour | grep ^-[^-] | wc -l`" != "0" ]
then
    echo "check FAILED (nice one Tonto, go get the Lone Ranger)"
    diff -u $prev_abidir/$flavour $abidir/$flavour
    exit 1
fi

If something is changed (thus the -[^-] in the regexp) between the releases, a ABI breakage is detected.

[edit] How SuSE does it

TODO.

[edit] Implementation on the Mandriva package

[edit] Kernel configuration

Essentially, the needed steps are:

  1. set CONFIG_MODVERSIONS, and
  2. set CONFIG_MODULE_SRCVERSION_ALL.

CONFIG_MODVERSIONS is used to make the symbols to have their CRCs appended after their names. There is an old description about symbol versioning [[1]].

CONFIG_MODULE_SRCVERSION_ALL is needed to make all modules to contain srcversion in their modinfo. As pointed here, DKMS needs this information in order to know when to rebuild a module. For me it is not clear yet when we will have this situation, but it is enabled on Ubuntu and SuSE, so it is probably needed.

[edit] Package configuration

Here is the most important detail in the whole scheme. The kernel configuration can be even optional compared to what is changed in the versioning scheme of the package.

The package will have another version number, the ABI version, which is just another version component in the final package version number. This number will be increased every time a new patch changes any aspect of the kernel ABI and rebuilding external modules is needed.

In fact, this ABI version can be perfectly replaced by release number used in the current kernels. The only change needed is to add another variable that will define the Release in the SPEC.

[edit] Problems

But we have a few problems:

  • the latest ABI released must be kept inside the SOURCES/ directory, so we have to find a automated way to upload it after a full kernel build (seems our Makefile will be useful again).
Personal tools