Subject: bug#76988: Architecture-specific kernels (arm64-generic) built for x86_64

From: Vagrant Cascadian <[email-masked]>
Date: Wed, 12 Mar 2025 16:18:26 -0700

In trying to create an alternate kernel configuration, I noticed that
the various kernels on x86_64 that are targeted at various specific
architectures (e.g. linux-libre-arm64-generic) ... are actually built
for X86_64:

  $ file $(guix build linux-libre-arm64-generic)/bzImage
  gnu/packages/linux.scm:989:2: warning: package [email-masked] does not support x86_64-linux
  /gnu/store/2jj1jxirrgiq972xbfk8cz8b9i642qq5-linux-libre-arm64-generic-6.13.6/bzImage: Linux kernel x86 boot executable bzImage, version 6.13.6-arm64-generic (guix@guix) #1 SMP PREEMPT_DYNAMIC 1, RO-rootFS, swap_dev 0XF, Normal VGA
  
  $ grep ^CONFIG_X86_64= $(guix build linux-libre-arm64-generic)/.config
  gnu/packages/linux.scm:989:2: warning: package [email-masked] does not support x86_64-linux
  CONFIG_X86_64=y

Those were downloaded from the substitute servers... and guix even
helpfully warns me that something is fishy... so it is not like I was
holding it wrong, per se! :)

These packages should either refuse to build (e.g. it does not match the
architecture, so should not even try to build) or attempt to cross build
when building on a non-native architecture.

I swear they used to cross-build for the appropriate architecture on
x86_64 out-of-the box ages ago, but there have been probably significant
changes to how cross-compilation and/or linux-libre packaging is done
since then...

  $ git grep -E 'define-public linux-libre.*(generic|honey|mips|arm)' gnu/packages/linux.scm | nl
     1  gnu/packages/linux.scm:(define-public linux-libre-arm-generic
     2  gnu/packages/linux.scm:(define-public linux-libre-arm-generic-5.10
     3  gnu/packages/linux.scm:(define-public linux-libre-arm-generic-5.4
     4  gnu/packages/linux.scm:(define-public linux-libre-arm-omap2plus
     5  gnu/packages/linux.scm:(define-public linux-libre-arm64-generic
     6  gnu/packages/linux.scm:(define-public linux-libre-lts-arm64-generic
     7  gnu/packages/linux.scm:(define-public linux-libre-arm64-generic-5.10
     8  gnu/packages/linux.scm:(define-public linux-libre-arm64-generic-5.4
     9  gnu/packages/linux.scm:(define-public linux-libre-arm64-honeycomb
    10  gnu/packages/linux.scm:(define-public linux-libre-riscv64-generic
    11  gnu/packages/linux.scm:(define-public linux-libre-mips64el-fuloong2e

Building all those package variants is a waste of build resources when
the result is not usable for the intended purpose...

Thanks for maintaining linux-libre in Guix! :)

live well,
  vagrant