Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kmodtool for packaging mainline Linux #14617

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

tim-day-387
Copy link
Contributor

@tim-day-387 tim-day-387 commented Mar 13, 2023

Motivation and Context

I built a kernel.org 5.15.94 using Clang for some work on a Lustre patch (https://review.whamcloud.com/c/fs/lustre-release/+/50063). I needed to build the openZFS kernel modules as well. The build failed because kmodtool was incorrectly identifying my kernel as a RHEL/CentOS one.

Description

Changing the order of the checks in kmodtool allows the kernel to be identified correctly. The custom kernel has the Makefile under /lib/modules/${kernel}/build, whereas the RHEL distributed kernel does not.

How Has This Been Tested?

The kmod package builds on both my default system and the system with the custom kernel. I ran this though shellcheck and it didn't return any errors. The change isn't POSIX, but kmodtool is using bash in the shebang anyway.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

scripts/kmodtool Outdated
@@ -333,7 +333,7 @@ print_customrpmtemplate ()
{
for kernel in ${1}
do
if [[ -e "${buildroot}/usr/src/kernels/${kernel}" ]] ; then
if [[ -e "${buildroot}/usr/src/kernels/${kernel}" ]] && [[ "${kernel}" =~ el|fc ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is going to break some RedHat derivatives. Could we instead invert the conditional and check for a user-build-kernel and then a Fedora/RH kernel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inverting the conditional seems like it could work. I'll test it out and update this PR when I get the chance. Thanks!

kmodtool currently incorrectly identifies offical
RHEL kernels, as opposed to custom kernels. This
can cause the openZFS kmod RPM build to break.

The issue can be reproduced by building a set of
mainline Linux RPMs, installing them, and then
attempting to build the openZFS kmod package
against them.

Signed-off-by: Timothy Day <timday@amazon.com>
@tim-day-387 tim-day-387 reopened this Mar 21, 2023
@tim-day-387 tim-day-387 changed the title Fix kmodtool for building against mainline Linux Fix kmodtool for packaging mainline Linux Mar 21, 2023
@tim-day-387
Copy link
Contributor Author

This got closed/re-opened when I refreshed my Github fork. I need to find a better workflow for updating Github PRs. But I tested flipping the conditional on a few setups (based on CentOS specifically) and everything seemed to work well.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this passed my testing as well.

@behlendorf behlendorf merged commit 1eca40f into openzfs:master Mar 22, 2023
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Mar 23, 2023
kmodtool currently incorrectly identifies official
RHEL kernels, as opposed to custom kernels. This
can cause the openZFS kmod RPM build to break.

The issue can be reproduced by building a set of
mainline Linux RPMs, installing them, and then
attempting to build the openZFS kmod package
against them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Timothy Day <timday@amazon.com>
Closes openzfs#14617
pcd1193182 pushed a commit to pcd1193182/zfs that referenced this pull request Sep 26, 2023
kmodtool currently incorrectly identifies official
RHEL kernels, as opposed to custom kernels. This
can cause the openZFS kmod RPM build to break.

The issue can be reproduced by building a set of
mainline Linux RPMs, installing them, and then
attempting to build the openZFS kmod package
against them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Timothy Day <timday@amazon.com>
Closes openzfs#14617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Packaging custom packages Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants