There is information in the Fedora Docs and Wiki on how to compile a kernel with fedpkg from the dist-git to get a RPM packaged kernel on the build host targeted for the build host. I’m wondering, since I read here and there that despite cross-compiling not being a general thing in Fedora, the packages necessary for cross-compiling the kernel are there and maintained. The kernel.spec also has sections for cross-compiling if I’m not mistaken. How is this supposed to work if at all?
There is of course the possibility to take the vanilla sources and use make with necessary packages, etc. I’m more interested in the RPM spec based fedpkg approach to this, since the goal is to cross-build RPM packages for arm64 on a x86 fedora host so they are installable on rpm-ostree systems.
Thanks for the reply! I can’t seem to find anything regarding cross-compiling following that link and linked sub-pages on that doc page. It’s actually the page I’m browsing through the last couple of days. Maybe I’m missing some crucial context or base knowledge which prevents me from interpreting the cross-compile implications from the mentioned doc? Would you mind to elaborate on that?
Thanks! So while fedpkg scratch-build-<archs> fails for me fedpkg scratch-build --arches <archs> works.
I have to extend the question to how I build this locally without Koji and COPR. As I understand the Koji infrastructure has native(?) aarch64 instances to run tagged builds. I’d like to cross-compile on my local Fedora Workstation instead
This might not be what you’re looking for, but using rpmbuild to cross-compile packages on a local x86_64 host for i.e. aarch64 works just fine.
# setup directories
# get the sources
koji download-build --arch=src --quiet kernel-5.16.9-200.fc35.src.rpm
rpm -i kernel-5.16.9-200.fc35.src.rpm
# prepare the build in case you wish to add modifications.
rpmbuild -bp --target aarch64-fedora-linux --with cross kernel.spec
rpmbuild -bb --target aarch64-fedora-linux --with cross --noprep kernel.spec
If you wish to build in one run simply omit the --noprep flag.