Create send files over UART

steps for how to upgrade firmware if we do not have SD card or network available
pull/127/head
naksper 2023-08-26 09:10:09 +02:00 committed by GitHub
parent 571c11f0d3
commit 3bf25c236b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,58 @@
# OpenIPC Wiki
[Table of Content](../README.md)
How to send files over UART
---------------------------
If SD card reader failt and there is no network configured on your cam you may need to send a new firmware over UART interface to update the camera.
__Sender:__
First we encode the files
```bash
base64 uImage > uImage.b
```
Now make sure your com send-file command is, ascii-xfr, this was my connection command line
```bash
picocom -f n -p n -d 8 -b 115200 --send-cmd "ascii-xfr -snv" /dev/ttyUSB0
```
Normally we want ascii-xfr on the receiving side, but since we don't have it, that -n works around this by maintaining correct line endings.
__Receiver::__
Now that we've connected, go to the directory where you want the received file.
```bash
cd /tmp/
```
```bash
cat > uImage.b
```
On picocom, I just CTRL+a+s, and enter the full path of the file I'm sending. Once the transfer completes, you'll need to CTRL+c to break that cat.
Now we decode the file,
```bash
base64 -d uImage.b > uImage
```
```bash
base64 -d rootfs.squashfs.b > rootfs.squashfs
```
Do whatever you can to verify that file is IDENTICAL to the one you sent, because an ASCII transfer has no checksum protection. Openipc had sha512sum, but any checksum command would suffice. Once you manually confirm the sums match, you can assume the transfer was successful!
```bash
sha256sum uImage
```
Repeat for rootfs, and now you will be able to upgrade with sysupgrade
```bash
sysupgrade --kernel=/tmp/uImage --rootfs=/tmp/rootfs.squashfs --force_ver -z
```