[Midnightbsd-cvs] [MidnightBSD/src] 8a27bf: Fix remaining Cross-build Kernel CI failures (#524)

Lucas Holt noreply at github.com
Fri Sep 25 17:26:46 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/src
  Commit: 8a27bffe3556498a770776bdc8d5f11bb121eb29
      https://github.com/MidnightBSD/src/commit/8a27bffe3556498a770776bdc8d5f11bb121eb29
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M Makefile.inc1
    M sys/compat/linuxkpi/common/include/linux/kernel.h
    M sys/dev/drm2/drm_os_freebsd.h
    M sys/sys/libkern.h

  Log Message:
  -----------
  Fix remaining Cross-build Kernel CI failures (#524)

* Makefile.inc1: define __MidnightBSD__ for external cross compilers

An external toolchain (upstream clang on Linux/macOS CI) is driven with
-target *-unknown-freebsd13.4 and predefines __FreeBSD__ but not
__MidnightBSD__. The tree keys on __MidnightBSD__ throughout the kernel
(ACPICA's acenv.h, netmap, ipfilter, dtrace, sys/param.h, ...), so the
cross build died in the first ACPICA header:

    contrib/dev/acpica/include/platform/acenv.h:365:2: error: Unknown target environment

When bsd.compiler.mk reports the external compiler does not know
__MidnightBSD_cc_version, add -D__MidnightBSD__=<N> to XCFLAGS, using the
same value our own clang derives from the triple's OS major version.

AI-Assisted-by: Claude Fable 5.1
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>

* libkern: add abs64() and drop the private copies in linuxkpi and drm2

cpufreq_dt.c calls abs64(), which this tree only defined privately in
linuxkpi's <linux/kernel.h> and drm2's drm_os_freebsd.h. Every arm64
GENERIC build therefore fails:

    sys/dev/cpufreq/cpufreq_dt.c:116:10: error: call to undeclared function 'abs64'

Provide abs64() in <sys/libkern.h> next to qabs(), as FreeBSD does, and
remove the two duplicate static inlines so headers that include both do
not hit a redefinition error.

Verified: cpufreq_dt.o cross-compiles for aarch64; translation units
including <linux/kernel.h> and <dev/drm2/drmP.h> build with amd64 kernel
flags; sys/modules/linuxkpi linux_compat.o/linux_kmod.o build natively.

AI-Assisted-by: Claude Fable 5.1
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>

---------

Signed-off-by: Lucas Holt <luke at foolishgames.com>
Co-authored-by: Claude Fable 5.1 <noreply at anthropic.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications


More information about the Midnightbsd-cvs mailing list