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

create linux-libc-dev when building kernel packages #6408

Merged
merged 3 commits into from
Mar 25, 2024
Merged

create linux-libc-dev when building kernel packages #6408

merged 3 commits into from
Mar 25, 2024

Conversation

vali-um
Copy link
Contributor

@vali-um vali-um commented Mar 18, 2024

Description

Added the necessary parts to create linux-libc-dev packages when creating armbian images. This functionality was not added to the new build system but worked just fine up until v23.02.

In my opinion linux-libc-dev should always be created when building an armbian kernel as the kernel versions often differ greatly from the ones natively in the distros (eg. debian bookworm: 6.1.76 vs. armbian current 6.6.21).

Also the armbian package source previously included the package but does not anymore, so the latest updates available were 23.02.2.

See also https://forum.armbian.com/topic/36140-linux-libc-dev-packages-not-available-after-2302/#comment-184962

How Has This Been Tested?

Used the updated scripts to build deb packages and images for bananapi and rpi4b.
The created package linux-libc-dev installs the expected headers.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

@vali-um vali-um requested a review from a team as a code owner March 18, 2024 13:02
@github-actions github-actions bot added the size/small PR with less then 50 lines label Mar 18, 2024
Copy link
Member

@rpardini rpardini left a comment

Choose a reason for hiding this comment

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

Interesting stuff, thanks for the contribution.

Unfortunately I think this will produce a problem when publishing to apt repos -- different kernels produce the same .deb package name with different contents; if you really need this, you should produce kernel-specific packages (linux-libc-dev-armbian-${BRANCH}-${LINUXFAMILY}) that Provides: linux-libc-dev.

Also, what is linux-kernel-headers ?

The way I understand it, libc headers are only useful if you need to rebuild gcc and libc from source yourself and target that specific kernel's features. Since we're using Debian and Ubuntu userspace, built with their glibc, it makes sense to use their headers package, usually corresponding to their "linux-generic" kernel image, no matter what version it was -- the kernel avoids breaking userspace AFAIK.

Would you care to share what is your use-case for the libc headers package? (eg why isn't linux-headers enough?)

@rpardini
Copy link
Member

@amazingfate for awareness as I know you build glibc (for widevine purposes?), would it benefit from having 35xx's kernels linux-libc-dev package?

@amazingfate
Copy link
Contributor

@amazingfate for awareness as I know you build glibc (for widevine purposes?), would it benefit from having 35xx's kernels linux-libc-dev package?

glibc usually doesn't need linux-libc-dev from kernel. Some userspace apps using uAPIs like v4l2-request need it to get the latest uAPI headers from mainline kernel.

@vali-um
Copy link
Contributor Author

vali-um commented Mar 20, 2024

Unfortunately I think this will produce a problem when publishing to apt repos -- different kernels produce the same .deb package name with different contents; if you really need this, you should produce kernel-specific packages (linux-libc-dev-armbian-${BRANCH}-${LINUXFAMILY}) that Provides: linux-libc-dev.

Appended -${BRANCH}-${LINUXFAMILY} as is done for linux-headers package.

Also, what is linux-kernel-headers ?

Was taken from the old armbian build scripts (v23.02), i removed it now.

The way I understand it, libc headers are only useful if you need to rebuild gcc and libc from source yourself and target that specific kernel's features. Since we're using Debian and Ubuntu userspace, built with their glibc, it makes sense to use their headers package, usually corresponding to their "linux-generic" kernel image, no matter what version it was -- the kernel avoids breaking userspace AFAIK.

Would you care to share what is your use-case for the libc headers package? (eg why isn't linux-headers enough?)

Other than creating this package from the armbian build system there is no way to get those headers in a version matching the armbian kernel.

linux-headers always installs linux-libc-dev as a dependency, so it is not enough. headers provided by linux-libc-dev are used by almost all lbraries and programs (e.g. openssl, libc, samba, curl,....)

Going through kernel documentationit states [1]:
"Kernel headers are backwards compatible, but not forwards compatible."
Where kernel headers refers to the headers created make headers_install, packaged in linux-libc-dev in debian and ubuntu.

Therefore, the matching headers from linux-libc-dev are required when:

  • (re)compiling something that needs/can use more recent kernel features
  • using an armbian kernel older than the one included in debian or ubuntu

For now we did not notice builds failing because of this but we noticed that linux-libc-dev would stay at version 23.02.2 as it was previously provided by armbian and the debian included version 6.1.76-1 is obviously lower.

[1] https://docs.kernel.org/6.6/kbuild/headers_install.html

Copy link
Member

@rpardini rpardini 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, thanks!

@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge 05 Milestone: Second quarter release labels Mar 21, 2024
@igorpecovnik igorpecovnik merged commit 22511b3 into armbian:main Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
05 Milestone: Second quarter release Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines
Development

Successfully merging this pull request may close these issues.

4 participants