Rebuilding the OpenAFS kernel modules

Redhat platforms

The basic process for building our local openafs kernel module packages goes like this:

  • As root, install the new kernel-devel packages for the kernel versions you want.
  • Install the most recent copy of the openafs SRPM (grab it from our local repository or from the openafs website)
  • Run the rpmbuild command like this:

rpmbuild -ba --define "kernvers 3.10.0-1127.13.1.el7" \
             --define "build_modules 1" --define "build_userspace 0" \
             rpmbuild/SPECS/openafs.spec

The kernvers option must be set to the version of the kernel you wish to build against, it can be omitted if you want to build a module for the currently running kernel.

It's best to build the modules and userspace separately, also when building the userspace packages you don't need to specify the kernel version.

Submit the new module package, note that unless you have just built all the userspace packages you shouldn't submit them too. For example:

pkgsubmit -B world -x rpmbuild/RPMS/x86_64/kmod-openafs-1.8.7-1.3.10.0_1160.11.1.el7.x86_64.rpm

Once this is done:

  • Test the new AFS kernel module by upgrading a machine to use both the new kernel and the new module
  • Run om updaterpms run -- -f on your build machine to clean up any extra kernel packages or you could end up with no kernel installed whatsoever...
  • Let Stephen know that the the modules been built, and coordinate making the changes to the ed/options/openafs-el7.h header

Debian/Ubuntu platforms

On Ubuntu we use the dkms tool to help with building the openafs kernel module packages. Typically dkms is used to build new modules on-the-fly as required when new kernels are installed but that's slow and rather inefficient for large numbers of machines. Thankfully dkms also supports pre-building and packaging the modules for distribution.

Firstly you need to install the openafs-modules-dkms package

apt install openafs-modules-dkms

This may result in post-install scripts attempting to build openafs modules for you, just leave it to get on with the job, it may take a while and it might also fail but we don't care about that.

For each kernel version you wish to support you need to install the linux-headers package, for example:

apt install linux-headers-5.4.0-45-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following additional packages will be installed:
  linux-headers-5.4.0-45
The following NEW packages will be installed
  linux-headers-5.4.0-45 linux-headers-5.4.0-45-generic
0 to upgrade, 2 to newly install, 0 to remove and 228 not to upgrade.
Need to get 12.2 MB of archives.
After this operation, 85.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Note that we use the -generic versions of the kernels. Again, this may result in post-install scripts attempting to build openafs modules for you, just leave it to get on with the job, it may take a while and it might also fail but we don't care about that.

To build the module for a particular kernel version use a command like this:

dkms build openafs/1.8.7 -k 5.4.0-45-generic/amd64

Note that you need to specify the openafs version as well as the kernel version. Also, unlike with Redhat, we are building this package as the root user.

Once that is done you can generate a Debian package like this:

dkms mkbmdeb openafs/1.8.7 -k 5.4.0-45-generic/amd64

If it succeeds the final lines of the output will look like:

DKMS: mkbmdeb completed.
Moving built files to /var/lib/dkms/openafs/1.8.7/bmdeb...
Cleaning up temporary files...

That tells you where the Debian package has been stored, for example /var/lib/dkms/openafs/1.8.7/bmdeb

To submit the newly built package you need a .changes file, there's a simple tool which you can use to generate one like this:

cd /var/lib/dkms/openafs/1.8.7/bmdeb
changestool --create openafs-modules-5.4.0-45-generic_1.8.7_amd64.changes add openafs-modules-5.4.0-45-generic_1.8.7_amd64.deb

The name for the .changes file should be the same as the package but with the suffix altered.

Submission is done using the standard dput tool like this:

dput inf-focal-world openafs-modules-5.4.0-45-generic_1.8.7_amd64.changes

If all goes well this will appear on the package server within 5 minutes, you can check the /var/log/lcfg/aptly logfile to see if it succeeded.

Finally on your build machine run =om apt run -- -f"

Once this is done:

  • Test the new AFS kernel module by upgrading a machine to use both the new kernel and the new module
  • Run om apt run -- -f on your build machine to clean up any extra kernel packages or you could end up with no kernel installed whatsoever...
  • Let Stephen know that the the modules been built, and coordinate making the changes to the ed/options/openafs-ubuntu.h header and the platform specific package list (e.g. ed/ed_ubu2004_openafs.pkgs).
Topic revision: r8 - 21 Jan 2021 - 11:38:29 - StephenQuinney
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies