Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828010 - kernel-install.eclass: kernel.release sanity-checking (commit e893119949ec1f94b83dc467514dc9ad4495a596) breaks with multiple different target builds
Summary: kernel-install.eclass: kernel.release sanity-checking (commit e893119949ec1f9...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Distribution Kernel Project
URL: https://gitweb.gentoo.org/repo/gentoo...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-02 12:01 UTC by Skyler Mäntysaari
Modified: 2023-07-08 19:11 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build logs, too big without compression (file_828010.txt,89 bytes, text/plain)
2021-12-02 12:04 UTC, Skyler Mäntysaari
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Skyler Mäntysaari 2021-12-02 12:04:13 UTC
Created attachment 757190 [details]
Build logs, too big without compression
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 16:38:31 UTC
The reason is that I've failed to bump genpatches version in the past and it resulted in building the wrong kernel version.
Comment 3 Skyler Mäntysaari 2021-12-02 17:47:54 UTC
So is the best option to basically create our own kernel-install_pkg_preinst() function in the eclass that overwrites your change, or what's the better thing to do about this?
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 18:06:08 UTC
Is there a specific reason you're not installing the release file?  Or does the eclass get the path wrong?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 18:23:58 UTC
(In reply to Skyler Mäntysaari from comment #3)
> So is the best option to basically create our own
> kernel-install_pkg_preinst() function in the eclass that overwrites your
> change, or what's the better thing to do about this?

I feel like you've come at this from the wrong angle here. mgorny's question is the same as mine.

Could you explain why this logic isn't working for you? We're not being adverserial here, we want it to work for you too, so let's talk about what you need. You don't need to jump to overriding functions forever.

I'd assumed this was possibly b/c not using genpatches but you are.

(FWIW, I think I'd be open to having something like this / importing these in ::gentoo. I really would like it if we could talk more and we could import more stuff (with you maintaining it if you wish!) rather than just keeping it in an overla yforever.)
Comment 6 Michael Jones 2021-12-02 20:33:00 UTC
Ultimately I think the reason its not working for us is simply that our kernel ebuild didn't have a reason to deploy the kernel.release file until the commit that added the check for it.

Our ebuild produces multiple kernels from the same source code, since we're targeting the raspberry pi platform, we build a distinct kernel for each board that we support.

So it's hard to know which of those kernel.release files should be the one that gets installed to the location marked by "relfile".

/// Copied from https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e893119949ec1f94b83dc467514dc9ad4495a596
local ver="${PV}${KV_LOCALVERSION}"
local kdir="${ED}/usr/src/linux-${ver}"
local relfile="${kdir}/include/config/kernel.release"

You'll see in this code block here: 

/// copied from https://github.com/GenPi64/genpi64-overlay/blob/72aa8f467995b86d1378b21e8e230b4414df0f72/eclass/pikernel-build.eclass#L158

# note: we're using mv rather than doins to save space and time
# install main and arch-specific headers first, and scripts
local kern_arch=$(tc-arch-kernel)
local ver="${PV}"
dodir "/usr/src/linux-${ver}/arch/${kern_arch}"
mv include scripts "${ED}/usr/src/linux-${ver}/" || die
mv "arch/${kern_arch}/include" \
	"${ED}/usr/src/linux-${ver}/arch/${kern_arch}/" || die


That we're coping the "include" dir to "${ED}/usr/src/linux-${ver}/", but that apparently doesn't have the kernel.release file either.

In our builds, the kernel.release file is not the same for each board we're building a kernel for.

E.g

ymir ~/genpi64/openrc/chroot/var/tmp/portage/sys-kernel/raspberrypi-kernel-5.10.11/work # find . -name "*kernel.release*"
./bcmrpi3/include/config/kernel.release
./bcm2711/include/config/kernel.release
ymir ~/genpi64/openrc/chroot/var/tmp/portage/sys-kernel/raspberrypi-kernel-5.10.11/work # cat ./bcm2711/include/config/kernel.release ./bcmrpi3/include/config/kernel.release
5.10.11-v8-p4
5.10.11-v8


Which of these two files should be installed? If we just wanted to hack it together, picking one and being consistent would be sufficient, i suppose, but obviously that defeats the point.


As for whether or not to have closer integration with the ::gentoo repository, I'm all for that. We don't have any particular need to control the ebuild for our kernel, its just what we got working. If you have a suggestion for a different way to approach the raspberry pi board kernel, happy to listen.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-08 19:11:57 UTC
Right, after discussing on IRC, I get it now.

The issue more broadly is, how do we properly support multiple different targets in kernel-{build,install}.eclass?

For your case, it makes sense to use a single ebuild for it and have a single binpkg at the end (because you need a bunch of different .imgs on RPi).

We didn't consider that case until now.