我有一个使用ramdisk启动的嵌入式Linux系统,因此它有运行时没有可用的持久存储(它有Flash存储内核和ramdisk)。
唯一的连接是RS-232串行登录控制台。所以我受内置busybox提供的内容的限制。我想检索ramdisk,修改它,并重写ramdisk。内核没有内置的Flash文件系统支持。 ramdisk分区大小约为10 MB。当删除用户目录中的所有文件时,空闲的ramdisk大小约为14 MB。
命令dd可用,因此我可以将ramdisk分区复制到ramdisk,并可以从ramdisk文件写入闪存。 flashcp也可用。
所以我现在的问题是如何通过RS-232串口控制台接收和发送二进制文件?
我研究以下内容,没有一个对我有用:
主要是因为忙碌盒中没有x / y / zmodem。
有什么想法吗?谢谢!
根据请求,这是我应该首先包含的内容。
可用的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
答案 0 :(得分:3)
在uboot中,您可以使用loady/loadx
通过uart从pc获取文件。我通常使用teraterm发送文件。
这个过程应该是这样的:
答案 1 :(得分:0)
我独立地找到了一种通过Linux控制台上传二进制文件的方法,并且我会记录这里的步骤,以防其他人发现它有用,因为我很难在网上查找这些信息。
以下是理论:将控制台模式更改为raw,因此所有二进制流量都被解释为控制台命令,例如:按Ctrl-C。关闭回声,这样就不会增加额外的串行流量。运行tar以接受来自stdin的输入。由于ctrl-C不能正常工作,并且tar不知道何时终止,因此使用后台任务来终止登录shell,这样你就可以再次登录来做你的员工。
步骤:
创建bg文件:
myvar=120
while [ $myvar -gt 0 ]
do
myvar=$(( $myvar-1 ))
echo -e " $myvar \n"
ls -l
sleep 10
done
kill -9 808
在控制台类型中:
source ./bg &
在控制台类型中:
stty raw -echo
在控制台类型中,以ctrl-j结尾,而不是:
tar zx -f - 1> 1.log 2> 2.log
启动Teraterm发送二进制文件
等待完成和新的登录提示