From 5eae4c8f15d5d142ea31e65f8865c7655ff0531d Mon Sep 17 00:00:00 2001 From: yangsong8 Date: Sun, 27 Jul 2025 21:08:05 +0800 Subject: [PATCH] apps/fastboot: Enable network via ioctl during fastboot initialization Bring up the network when do fastboot tcp init. Signed-off-by: yangsong8 --- system/fastboot/Kconfig | 7 +++++++ system/fastboot/fastboot.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/system/fastboot/Kconfig b/system/fastboot/Kconfig index f5b14cd02..0842bcb0d 100644 --- a/system/fastboot/Kconfig +++ b/system/fastboot/Kconfig @@ -45,4 +45,11 @@ config SYSTEM_FASTBOOTD_SHELL e.g. fastboot oem shell ps e.g. fastboot oem shell "mkrd -m 10 -s 512 640" +config SYSTEM_FASTBOOTD_NET_INIT + bool "Network initialization" + default n + select NETUTILS_NETINIT + ---help--- + This option enables/disables all network initialization in fastboot server. + endif # SYSTEM_FASTBOOTD diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index b20be6b7d..2a24e9b9f 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -52,6 +52,10 @@ #include #include +#ifdef CONFIG_SYSTEM_FASTBOOTD_NET_INIT +# include "netutils/netinit.h" +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -1259,6 +1263,12 @@ static int fastboot_tcp_initialize(FAR struct fastboot_ctx_s *ctx) { struct sockaddr_in addr; +#ifdef CONFIG_SYSTEM_FASTBOOTD_NET_INIT + /* Bring up the network */ + + netinit_bringup(); +#endif + ctx->tran_fd[0] = socket(AF_INET, SOCK_STREAM, SOCK_CLOEXEC | SOCK_NONBLOCK); if (ctx->tran_fd[0] < 0)