spl: fix incorrect dependency for SPL_NET
PATCH v2 1/1 spl: fix incorrect dependency for SPL_NET
From: Quentin Schulz <[email protected]>
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.
---
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.
---
Changes in v2:
- Added Rb from Jerome,
- Reworded commit log,
- Added question on whether this is the proper fix now that I spent a
bit more time looking at it,
- Rebased on top of master,
- Link to v1: https://patch.msgid.link/[email protected]
--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/Kconfig +1 -1
@@ -1153,7 +1153,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" - depends on !NET_LWIP + depends on NET select SPL_USE_TINY_PRINTF_POINTER_SUPPORT if SPL_USE_TINY_PRINTF help Enable support for network devices (such as Ethernet) in SPL.
---
base-commit: 141be72e2a9d43aa4e3d1a6a6e0ab8f9eb8784c6
change-id: 20251218-spl_net-deps-62072f51243a
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
Quoted 19 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
When
SPL_NETis included,scripts/Makefile.xplincludesnet/. However, in this directory, theMakefileonly compiles things ifCONFIG_NETorCONFIG_NET_LWIPis 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 (sinceinclude/net-common.hdoes check withCONFIG_IS_ENABLED(NET)which would be true forSPL_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 <[email protected]>Signed-off-by Quentin Schulz <[email protected]>
Quoted 9 lines
---
I'm wondering if this is the proper fix... Maybe we should migrate net/Makefile to use $(PHASE_) there instead? This would allowSPL_NET(haven't checked the whole codebase, maybe we still haveCONFIG_NETchecks instead ofIS_ENABLED(NET)where we shouldn't) to build without any network stack in proper (meaning thatSPL_NETis 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:
lib/Makefile +1 -1
@@ -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
Signature · 1 line
Tom
Quoted 6 lines · Quentin Schulz
When
SPL_NETis included,scripts/Makefile.xplincludesnet/. However, in this directory, theMakefileonly compiles things ifCONFIG_NETorCONFIG_NET_LWIPis defined (it doesn't use $(PHASE_)). Therefore, at least one networking stack needs to be enabled for SPL_NET=y to do anything meaningful.
Quoted 6 lines
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 (sinceinclude/net-common.hdoes check withCONFIG_IS_ENABLED(NET)which would be true forSPL_NET, but the implementation wouldn't be compiled).[...]
Applied to u-boot/master, thanks!
[1/1] spl: fix incorrect dependency for SPL_NET
commit: cb1d775d253c84a0eee0db94d8bf4145d9fd7bd3
Signature · 1 line
Tom