mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-09 23:15:25 +00:00
system/fastboot: add per-transport Kconfig options for USB and TCP
Add SYSTEM_FASTBOOTD_USB (default y) and SYSTEM_FASTBOOTD_TCP (default y) to allow disabling individual transports independently. Replace direct CONFIG_USBFASTBOOT / CONFIG_NET_TCP guards in the transport code with the new fastbootd-level Kconfig symbols. Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
parent
06ceed1afb
commit
bac662c215
2 changed files with 30 additions and 11 deletions
|
|
@ -8,33 +8,51 @@ menuconfig SYSTEM_FASTBOOTD
|
|||
default n
|
||||
depends on USBFASTBOOT || (NET_TCP && NET_TCPBACKLOG)
|
||||
---help---
|
||||
Enable Fastboot daemon.
|
||||
Fastboot daemon supporting multiple transports concurrently.
|
||||
Enable at least one transport (USB, TCP).
|
||||
The USB transport depends on USBFASTBOOT.
|
||||
The TCP network transport depends on NET_TCP and NET_TCPBACKLOG.
|
||||
Each transport can be individually disabled via
|
||||
SYSTEM_FASTBOOTD_USB / SYSTEM_FASTBOOTD_TCP below.
|
||||
|
||||
if SYSTEM_FASTBOOTD
|
||||
|
||||
config SYSTEM_FASTBOOTD_PRIORITY
|
||||
int "USB-fastboot task priority"
|
||||
int "fastboot task priority"
|
||||
default 100
|
||||
|
||||
config SYSTEM_FASTBOOTD_STACKSIZE
|
||||
int "USB-fastboot stack size"
|
||||
int "fastboot stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
|
||||
config SYSTEM_FASTBOOTD_DOWNLOAD_MAX
|
||||
int "USB-fastboot download buffer size"
|
||||
int "fastboot download buffer size"
|
||||
default 40960
|
||||
|
||||
config SYSTEM_FASTBOOTD_USB
|
||||
bool "Fastboot USB transport"
|
||||
default y
|
||||
depends on USBFASTBOOT
|
||||
---help---
|
||||
Enable USB transport for fastboot daemon.
|
||||
|
||||
config SYSTEM_FASTBOOTD_USB_BOARDCTL
|
||||
bool "USB Board Control"
|
||||
default n
|
||||
depends on BOARDCTL
|
||||
depends on BOARDCTL_USBDEVCTRL
|
||||
depends on USBFASTBOOT
|
||||
depends on SYSTEM_FASTBOOTD_USB
|
||||
---help---
|
||||
Connect usbdev before running fastboot daemon.
|
||||
|
||||
config SYSTEM_FASTBOOTD_TCP
|
||||
bool "Fastboot TCP transport"
|
||||
default y
|
||||
depends on NET_TCP
|
||||
depends on NET_TCPBACKLOG
|
||||
---help---
|
||||
Enable TCP network transport for fastboot daemon.
|
||||
|
||||
config SYSTEM_FASTBOOTD_SHELL
|
||||
bool "Execute custom commands"
|
||||
default n
|
||||
|
|
@ -48,6 +66,7 @@ config SYSTEM_FASTBOOTD_SHELL
|
|||
config SYSTEM_FASTBOOTD_NET_INIT
|
||||
bool "Network initialization"
|
||||
default n
|
||||
depends on SYSTEM_FASTBOOTD_TCP
|
||||
select NETUTILS_NETINIT
|
||||
---help---
|
||||
This option enables/disables all network initialization in fastboot server.
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ static void fastboot_switchboot(FAR struct fastboot_ctx_s *context,
|
|||
|
||||
/* USB transport */
|
||||
|
||||
#ifdef CONFIG_USBFASTBOOT
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_USB
|
||||
static int fastboot_usbdev_initialize(FAR struct fastboot_ctx_s *ctx);
|
||||
static void fastboot_usbdev_deinit(FAR struct fastboot_ctx_s *ctx);
|
||||
static ssize_t fastboot_usbdev_read(FAR struct fastboot_ctx_s *ctx,
|
||||
|
|
@ -244,7 +244,7 @@ static int fastboot_usbdev_write(FAR struct fastboot_ctx_s *ctx,
|
|||
|
||||
/* TCP transport */
|
||||
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_TCP
|
||||
static int fastboot_tcp_initialize(FAR struct fastboot_ctx_s *ctx);
|
||||
static void fastboot_tcp_deinit(FAR struct fastboot_ctx_s *ctx);
|
||||
static ssize_t fastboot_tcp_read(FAR struct fastboot_ctx_s *ctx,
|
||||
|
|
@ -290,7 +290,7 @@ static const struct memory_region_s g_memory_region[] =
|
|||
|
||||
static const struct fastboot_transport_ops_s g_tran_ops[] =
|
||||
{
|
||||
#ifdef CONFIG_USBFASTBOOT
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_USB
|
||||
{
|
||||
.init = fastboot_usbdev_initialize,
|
||||
.deinit = fastboot_usbdev_deinit,
|
||||
|
|
@ -298,7 +298,7 @@ static const struct fastboot_transport_ops_s g_tran_ops[] =
|
|||
.write = fastboot_usbdev_write,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_TCP
|
||||
{
|
||||
.init = fastboot_tcp_initialize,
|
||||
.deinit = fastboot_tcp_deinit,
|
||||
|
|
@ -1170,7 +1170,7 @@ static void fastboot_free_publish(FAR struct fastboot_ctx_s *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USBFASTBOOT
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_USB
|
||||
static int fastboot_open_usb(int index, int flags)
|
||||
{
|
||||
int try = FASTBOOT_EP_RETRY_TIMES;
|
||||
|
|
@ -1301,7 +1301,7 @@ static int fastboot_usbdev_write(FAR struct fastboot_ctx_s *ctx,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#ifdef CONFIG_SYSTEM_FASTBOOTD_TCP
|
||||
static int fastboot_tcp_initialize(FAR struct fastboot_ctx_s *ctx)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue