Add compatibility to package kernel-debs that use a localversion-X file #5166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The current kernel.sh build system uses the
grab_version()
function in utils-compilation.sh to determine the version string of the kernel and locate the build artifacts aftermake
has completed.grab_version is a simple implementation that parses the makefile to guess the final kernel version, but if a userpatch has been applied to the kernel that includes a localversion-xx file (the PREEMPT_RT patch does this, for example), the returned value will be wrong (
grab_version
returns5.10.110
when the true value used to name the vmlinuz image is5.10.110-rt53-rockchip-rk3588
)Thank you to @rpardini on Discord for helping me identify a fix for this issue.
This patch switches kernel.sh to use the built in
make kernelrelease
command to return the kernel version, which takes into account any localversion-xx files in the kernel tree, as well as theLOCALVERSION=-${LINUXFAMILY}
value appended by the armbian kernel-make.sh code.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.
Packaging fails at
kernel_package_callback_linux_image() --> lib/functions/compilation/kernel-debs.sh:213
which is
run_host_command_logged ls -la "${kernel_pre_package_path}" "${kernel_image_pre_package_path}"
This fails because
kernel_image_pre_package_path
is derived fromgrab_version
vmlinuz filenames are unchanged from current functionality and correctly located by kernel-debs.sh to be built into .deb files.
Output from
run_host_command_logged ls -la "${kernel_pre_package_path}" "${kernel_image_pre_package_path}"
:.deb creation is correct:
vmlinuz files are correctly named with both the localversion-xx file and the armbian localversion appended in kernel-make.sh.
Output from
run_host_command_logged ls -la "${kernel_pre_package_path}" "${kernel_image_pre_package_path}"
:.debs are created as expected:
Checklist: