net, common: add NET_SKIP_BOOT_INIT for gadget-only
PATCH 1/1 net, common: add NET_SKIP_BOOT_INIT for gadget-only
Gate the initr_net() INITCALL on CONFIG_NET_SKIP_BOOT_INIT at the call site in initcall_run_r(), so boards with no wired NIC can skip the boot-time probe and "Net:" banner without touching initr_net() itself.
Signed-off-by Petr Hodina <[email protected]>
---initr_net() probes for Ethernet and prints a "Net:" banner when NET option is enabled, which is not relevant for boards that use USB gadgets for networking.
Add CONFIG_NET_SKIP_BOOT_INIT to skip that boot-time probe. Later invocations still probe UCLASS_ETH normally. Defaults to n.
--- common/board_r.c | 6 ++++-- net/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
common/board_r.c +4 -2
@@ -761,8 +761,10 @@ static void initcall_run_r(void)INITCALL (pci_ep_init);#endif #if CONFIG_IS_ENABLED (NET ) -WATCHDOG_RESET (); -INITCALL (initr_net); +if (!IS_ENABLED (CONFIG_NET_SKIP_BOOT_INIT )) { +WATCHDOG_RESET (); +INITCALL (initr_net); + }#endif #if CONFIG_IS_ENABLED (POST )INITCALL (initr_post);
net/Kconfig +7 -0
@@ -14,6 +14,13 @@ menuconfig NET if NET +config NET_SKIP_BOOT_INIT + bool "Skip the boot-time ethernet probe + 'Net:' banner" + help + By default init runs eth_initialize() if `NET` option is enabled. + Some boards do not have a wired NIC but use RNDIS or CDC-NCM + gadgets on the USB to provide network connectivity. + choice prompt "Networking stack" default NET_LEGACY
---
base-commit: ece349ade2973e220f524ce59e59711cc919263f
change-id: 20260611-b4-net-skip-boot-init-86fcfcc0674d
Best regards,
Signature · 1 line
Petr Hodina <[email protected]>