我有一个使用ramdisk启动的嵌入式Linux系统,所以它的运行时间没有可用的持久存储空间(它有Flash来存储内核和ramdisk)。如何使用串行控制台将二进制闪存文件发送到嵌入式系统?
唯一的连接是RS-232串行登录控制台。所以我受限于其内置的busybox提供的内容。我想检索虚拟盘,修改它,然后重写虚拟盘。内核没有内置的Flash文件系统支持。 ramdisk分区大小约为10 MB。当删除用户目录中的所有文件时,免费ramdisk大小约为14 MB。
命令dd可用,因此我可以将ramdisk分区复制到ramdisk,并且可以从ramdisk文件写入闪存。 flashcp也可用。
所以我的问题是现在如何通过RS-232串行控制台接收和发送二进制文件?
我研究以下内容并没有对我来说是非常有用的:
- Linux命令二进制文件发送到串行端口硬件流控制?上stackoverflow
- 上superuser.com
- 上k.japko.eu
- 文件传输传输使用串行控制台文件通过串口线如何获得文件到一个主机通过串行终端stackoverflow
- 二进制数据时,你已经是一个串行安慰? on stackexchange
主要是因为x/y/zmodem在busybox中不可用。
有什么想法?谢谢!
根据要求,这里是我应该包括在第一位。
可用的u-boot命令:
U-Boot >?
? - alias for 'help'
askenv - get environment variables from stdin
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootm - boot application image from memory
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
crc32_chk_uimage- checksum calculation of an image for u-boot
echo - echo args to console
editenv - edit environment variable
env - environment handling commands
exit - exit script
false - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fatwrite- write file into a dos filesystem
go - start application at address 'addr'
gpio - input/set/clear/toggle gpio pins
help - print command description/usage
i2c - I2C sub-system
iminfo - print header information for application image
imxtract- extract a part of a multi-image
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
md - memory display
mdc - memory display cyclic
mm - memory modify (auto-incrementing address)
mw - memory write (fill)
mwc - memory write cyclic
nm - memory modify (constant address)
printenv- print environment variables
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
saves - save S-Record file over serial line
setenv - set environment variables
sf - SPI flash sub-system
showvar - print local hushshell variables
sleep - delay execution for some time
source - run script from memory
sspi - SPI utility command
test - minimal test like /bin/sh
true - do nothing, successfully
usb - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
U-Boot >
可用busybox的命令:
BusyBox v1.13.2 (2015-03-16 10:50:56 EDT) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
Usage: busybox [function] [arguments]...
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as!
Currently defined functions:
[, [[, addgroup, adduser, ar, ash, awk, basename, blkid,
bunzip2, bzcat, cat, chattr, chgrp, chmod, chown, chpasswd,
chroot, chvt, clear, cmp, cp, cpio, cryptpw, cut, date,
dc, dd, deallocvt, delgroup, deluser, df, dhcprelay, diff,
dirname, dmesg, du, dumpkmap, dumpleases, echo, egrep, env,
expr, false, fbset, fbsplash, fdisk, fgrep, find, free,
freeramdisk, fsck, fsck.minix, fuser, getopt, getty, grep,
gunzip, gzip, halt, head, hexdump, hostname, httpd, hwclock,
id, ifconfig, ifdown, ifup, inetd, init, insmod, ip, kill,
killall, klogd, last, less, linuxrc, ln, loadfont, loadkmap,
logger, login, logname, logread, losetup, ls, lsmod, makedevs,
md5sum, mdev, microcom, mkdir, mkfifo, mkfs.minix, mknod,
mkswap, mktemp, modprobe, more, mount, mv, nc, netstat,
nice, nohup, nslookup, od, openvt, passwd, patch, pidof,
ping, ping6, pivot_root, poweroff, printf, ps, pwd, rdate,
rdev, readahead, readlink, readprofile, realpath, reboot,
renice, reset, rm, rmdir, rmmod, route, rtcwake, run-parts,
sed, seq, setconsole, setfont, sh, showkey, sleep, sort,
start-stop-daemon, strings, stty, su, sulogin, swapoff,
swapon, switch_root, sync, sysctl, syslogd, tail, tar, tcpsvd,
tee, telnet, telnetd, test, tftp, tftpd, time, top, touch,
tr, traceroute, true, tty, udhcpc, udhcpd, udpsvd, umount,
uname, uniq, unzip, uptime, usleep, vconfig, vi, vlock,
watch, wc, wget, which, who, whoami, xargs, yes, zcat
*“主要是因为x/y/zmodem在busybox中不可用。”* - 不是负面描述,而是让我们玩20个问题的游戏,请发布可用的Busybox命令。你用U-Boot开机?如果是,则列出其可用命令。 – sawdust
*“唯一的连接是RS-232”* - 要说清楚,你声称没有USB,没有MMC或SD卡,没有以太网?如果SBC无法从闪存启动,那么如何恢复? IOW是否有备用的引导方式? – sawdust
那么,以及将'rz' /'sz'添加到busybox有什么问题?只需在Busybox的配置文件中启用它即可。 – 0andriy