Add missing blank lines after variable declarations and fix
alignment in preprocessor conditionals. These are pre-existing
style issues exposed by the latest nxstyle version.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Add a serial transport alongside the existing USB and TCP backends.
The serial backend reuses the TCP v1 wire framing (FB01 handshake
plus an 8-byte big-endian length prefix) so the host side needs no
new tool: socat bridges the UART to a TCP socket and the standard
fastboot tool connects via tcp:.
The serial port path is configured at build time through Kconfig
SYSTEM_FASTBOOTD_SERIAL_PORT.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Extract fastboot_framed_read() that handles TCP v1 wire framing:
handshake detection (FB01 exchange) and 8-byte big-endian length
prefix parsing. Simplify fastboot_tcp_read() to reuse this helper
for both initial handshake and subsequent data frames.
This prepares for adding a serial transport that shares the same
framed protocol.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
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>
The read loop was passing the original buf pointer and full length on
every iteration, causing subsequent reads to overwrite previous data
and potentially request more bytes than the remaining buffer space.
Update buf and len after each successful read to advance through the
buffer correctly.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Parse the filedump path token into the existing PATH_MAX-sized buffer
before reading the optional offset and size arguments. This bounds the
write without constructing a scanf format string at runtime.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
SOCK_CLOEXEC and SOCK_NONBLOCK were incorrectly passed as the
third argument (protocol) instead of being OR'd into the second
argument (type). This caused socket() to fail with EPROTONOSUPPORT
(errno 93) on NuttX.
Move SOCK_CLOEXEC | SOCK_NONBLOCK to the type parameter and set
protocol to 0.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be truncated writing up to 63 bytes into a region of size 60 [-Werror=format-truncation=] ...... apps/system/fastboot/fastboot.c:351:3: note: 'snprintf' output between 5 and 68 bytes into a destination of size 64 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be truncated writing up to 63 bytes into a region of size 60 [-Werror=format-truncation=] ...... apps/system/fastboot/fastboot.c:351:3: note: 'snprintf' output between 5 and 68 bytes into a destination of size 64 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
Add TCP backlog dependence for poll(),
network related configurations referenced to may has not enable it,
without which the TCP handshake will fail.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Add qualifier "const" to the declaration of `memdump_print_t`,
the value of the 2nd argument will not be changed.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Move initialization of usbdev to after help().
This patch fix that even users just run `fastbootd -h`,
the usbdev will also be (re)initialized,
and if the daemon is running the status will be broken.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
usage in bootloader
if [flag == bootloader]
fastbootd
else
fastbootd 500
fi
host:
$fastboot flash app app.bin
< waiting for any device >
let board enter booloader,use <reboot bootloader> or hard reset
then will flash it.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>