[PATCH v2] spl: fix incorrect dependency for SPL_NET

Tom Rini trini at konsulko.com
Thu Jan 8 15:15:09 CET 2026


On Thu, Jan 08, 2026 at 01:28:36PM +0100, Quentin Schulz wrote:

> From: Quentin Schulz <quentin.schulz at cherry.de>
> 
> When SPL_NET is included, scripts/Makefile.xpl includes net/. However,
> in this directory, the Makefile only compiles things if CONFIG_NET or
> CONFIG_NET_LWIP is defined (it doesn't use $(PHASE_)). Therefore, at
> least one networking stack needs to be enabled for SPL_NET=y to do
> anything meaningful.
> 
> In certain cases (e.g. am62px_evm_r5_ethboot_defconfig + NO_NET=y via
> menuconfig), it is possible to fail the build with undefined references
> (since include/net-common.h does check with CONFIG_IS_ENABLED(NET) which
> would be true for SPL_NET, but the implementation wouldn't be compiled).
> 
> Fix this oversight by making sure a network stack (and the legacy one)
> is available when selecting SPL_NET.
> 
> Fixes: 8cb330355bd5 ("net: introduce alternative implementation as net/lwip/")
> Reviewed-by: Jerome Forissier <jerome.forissier at linaro.org>
> Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
> ---
> I'm wondering if this is the proper fix... Maybe we should migrate
> net/Makefile to use $(PHASE_) there instead? This would allow SPL_NET
> (haven't checked the whole codebase, maybe we still have CONFIG_NET
> checks instead of IS_ENABLED(NET) where we shouldn't) to build without
> any network stack in proper (meaning that SPL_NET is selecting the
> legacy networking stack for SPL only), and maybe even that would allow
> us to have legacy stack in SPL and lwip stack in proper? This seems like
> a much bigger task than this simple patch here.

The $(PHASE_) way is probably the right way, I had noticed there's a few
other things that get compiled (but, discarded) too because of this. At
least:
diff --git a/lib/Makefile b/lib/Makefile
index 70667f3728c2..a247aa0331b9 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -133,7 +133,7 @@ obj-y += string.o
 obj-y += tables_csum.o
 obj-y += time.o
 obj-y += hexdump.o
-obj-$(CONFIG_GETOPT) += getopt.o
+obj-$(CONFIG_$(PHASE_)GETOPT) += getopt.o
 obj-$(CONFIG_TRACE) += trace.o
 obj-$(CONFIG_LIB_UUID) += uuid.o
 obj-$(CONFIG_LIB_RAND) += rand.o

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260108/6abe1ce5/attachment.sig>


More information about the U-Boot mailing list