由于默认的busybox没有支持microcom工具,也没有提供源码,所以需要自己交叉编译microcom工具。
microcom工具
https://packages.ubuntu.com/zh-cn/plucky/microcom
下载ubuntu带的软件包microcom,下载microcom_2023.09.0.orig.tar.xz版本,
设置编译链环境变量,配置./configure --host=arm-linux --build=x86_64-linux-gnu
./microcom -s 115200 -p /dev/ttyS1,发现不好用放弃。
busybox工具
查看目标机的版本:BusyBox v1.34.1 () multi-call binary.
下载busybox-1.34.1.tar.bz2版本,设置编译环境变量,设置默认配置:make defconfig
查看配置CONFIG_MICROCOM=y是否已经选中,修改.config配置文件的编译链:
CONFIG_CROSS_COMPILER_PREFIX="aarch64-zxic-linux-"
CONFIG_SYSROOT="/home/wangyb/sda3/zm9300c-V2XR240060/toolchain/sysroots/aarch64-zxic-linux"
make编译成功,
busybox: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=9dbb06951e6969491375cfe8fb89c80cf31f78c3, for GNU/Linux 3.14.0, stripped
busybox修改名称为microcom,拷贝到目标机运行。
linux_genvict:root# ./microcom
BusyBox v1.34.1 (2026-03-09 14:22:05 CST) multi-call binary.
Usage: microcom [-d DELAY_MS] [-t TIMEOUT_MS ] [-s SPEED] [-X] TTY
Copy bytes from stdin to TTY and from TTY to stdout
-d DELAY Wait up to DELAY ms for TTY output before sending
every next byte to it
-t TIMEOUT Exit if both stdin and TTY are silent for TIMEOUT ms
-s SPEED Set serial line to SPEED
-X Disable special meaning of NUL and Ctrl-X from stdin
linux_genvict:root#
./microcom -s 115200 /dev/ttyS1,可输出gnss模组的NMEA数据。