openSUSE:Online Kernel Patching
Requirements
- SLE11 SP2 or some latest openSUSE release
- Installed Ksplice package from OBS
- Some kernel patch (a diff) you want to apply online
Building a Binary Patch
Step 1: Build a SUSE kernel
This should result in two directories:
- linux-<version> with sources, and
- linux-obj with object files
Step 2: Creating Configuration for Ksplice
Configuration is meant to be a directory where Ksplice reads from. It should contain these three entries:
- build: a link to linux-obj above
- flags: a text file with flags passed to make. This is usually "O=<path to linux-obj>"
- System.map: simply a copy of build/System.map
Step 3: Creating Binary Patch
The final step is to actually create the binary patch. Now, it is as simple as running ksplice-create:
ksplice-create --patch=<path_to_diff> --config=<path_to_conf_dir> <path_to_linux_sources>
Note that it accepts also -j parameter to perform a parallel build and speed up the whole process.
Patching the Kernel
Given the binary patch, you can just call ksplice-apply utility to apply the patch as follows:
ksplice-apply ksplice-<id>.tar.gz
And check what patches are applied:
ksplice-view
Unpatching the Kernel
Sometimes you might want to remove patches from the running system. For that purpose, ksplice-undo exists. The only thing needed is the id of the patch. You can find that by ksplice-view. Then issue command like the one below to get rid of the patch.
ksplice-undo ksplice-<id>