arm64 buildkernel broken

From: Lexi Winter <lexi_at_le-fay.org>
Date: Thu, 25 Apr 2024 01:14:48 UTC
hello,

using this kernel config:

https://github.com/llfw/freebsd-src/blob/lf/main/sys/arm64/conf/LF

i can't buildkernel on main 71b2ba9099115db3c63f15e5085c0a677511f8b8:

Building /src/obj/src/freebsd/src/main/arm64.aarch64/sys/LF/kernel.full
--- kernel.full ---
linking kernel.full
ld: error: undefined symbol: virtio_scmi_transport_get
>>> referenced by scmi_virtio.c:271 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:271)
>>>               scmi_virtio.o:(scmi_virtio_attach)

ld: error: undefined symbol: virtio_scmi_channel_size_get
>>> referenced by scmi_virtio.c:125 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:125)
>>>               scmi_virtio.o:(scmi_virtio_transport_init)
>>> referenced by scmi_virtio.c:127 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:127)
>>>               scmi_virtio.o:(scmi_virtio_transport_init)

ld: error: undefined symbol: virtio_scmi_message_enqueue
>>> referenced by scmi_virtio.c:97 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:97)
>>>               scmi_virtio.o:(scmi_virtio_transport_init)
>>> referenced by scmi_virtio.c:201 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:201)
>>>               scmi_virtio.o:(scmi_virtio_xfer_msg)
>>> referenced by scmi_virtio.c:113 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:113)
>>>               scmi_virtio.o:(scmi_virtio_clear_channel)

ld: error: undefined symbol: virtio_scmi_channel_callback_set
>>> referenced by scmi_virtio.c:147 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:147)
>>>               scmi_virtio.o:(scmi_virtio_transport_init)
>>> referenced by scmi_virtio.c:159 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:159)
>>>               scmi_virtio.o:(scmi_virtio_transport_init)
>>> referenced by scmi_virtio.c:185 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:185)
>>>               scmi_virtio.o:(scmi_virtio_transport_cleanup)
>>> referenced 1 more times

ld: error: undefined symbol: virtio_scmi_message_poll
>>> referenced by scmi_virtio.c:221 (/src/freebsd/src/main/sys/dev/firmware/arm/scmi_virtio.c:221)
>>>               scmi_virtio.o:(scmi_virtio_poll_msg)
*** [kernel.full] Error code 1

make[2]: stopped in /src/obj/src/freebsd/src/main/arm64.aarch64/sys/LF

this patch appears to fix the problem:

From 295c20c1fa56bf995bf085a6aa68067132fd9ca0 Mon Sep 17 00:00:00 2001
From: Lexi Winter <lexi@le-Fay.ORG>
Date: Thu, 25 Apr 2024 01:57:34 +0100
Subject: [PATCH] scmi: only build virtio_scmi.c if virtio_scmi is defined

---
 sys/conf/files.arm64 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index c7468b577dd8..c001b88dacde 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -275,7 +275,7 @@ dev/firmware/arm/scmi_clk.c			optional fdt scmi
 dev/firmware/arm/scmi_if.m			optional fdt scmi
 dev/firmware/arm/scmi_mailbox.c			optional fdt scmi
 dev/firmware/arm/scmi_smc.c			optional fdt scmi
-dev/firmware/arm/scmi_virtio.c			optional fdt scmi
+dev/firmware/arm/scmi_virtio.c			optional fdt scmi virtio_scmi
 dev/firmware/arm/scmi_shmem.c			optional fdt scmi

 dev/gpio/pl061.c				optional pl061 gpio
--
2.44.0

however, i'm not sure if this is the correct fix.