apps/fastboot: Enable network via ioctl during fastboot initialization

Bring up the network when do fastboot tcp init.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8 2025-07-27 21:08:05 +08:00 committed by Xiang Xiao
parent 641f7ced84
commit 5eae4c8f15
2 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -52,6 +52,10 @@
#include <sys/types.h>
#include <sys/wait.h>
#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)