Skip to content

Commit 91db3d1

Browse files
authored
Merge pull request #85 from OpenIPC/BlackFox-org-patch-9
Create sysupgrade.mdx
2 parents 851c2c9 + 49e2940 commit 91db3d1

File tree

1 file changed

+224
-0
lines changed

1 file changed

+224
-0
lines changed
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
---
2+
title: "Sysupgrade"
3+
description: "What is and how to use sysupgrade."
4+
---
5+
6+
Once the initial installation of the OpenIPC software for your camera is complete it is possible to upgrade it either via the web interface or manually via a terminal window.
7+
8+
This article is about how to manually perform an update using a terminal window using the sysupgrade command.
9+
```bash
10+
root@openipc-${soc}:~# sysupgrade --help
11+
OpenIPC System Updater v1.0.48
12+
13+
Vendor sigmastar
14+
SoC ssc338q
15+
Kernel 04:02:47 2025-07-06
16+
RootFS master+3674581, 2025-07-06
17+
18+
Usage: /usr/sbin/sysupgrade [options]
19+
Where:
20+
-k Update kernel from online repository.
21+
-r Update rootfs from online repository.
22+
--url=[URL] Custom URL to update from (.tgz format).
23+
--archive=[FILE] Custom archive to update from (.tgz format).
24+
--kernel=[FILE] Update kernel from file (uImage format).
25+
--rootfs=[FILE] Update rootfs from file (squashfs format).
26+
-f, --force_all Do not validate anything.
27+
-n, --wipe_overlay Wipe overlay partition.
28+
-x, --no_reboot Do not reboot after updating.
29+
-z, --no_update Do not update self.
30+
-h, --help Display this help and exit.
31+
```
32+
33+
:::
34+
By default, sysupgrade will reboot the camera to complete the update. If you don't wish to do that then use the -x option.
35+
:::
36+
## Upgrading from the GitHub latest release.
37+
By default, running sysupgrade will attempt to download the latest software for your camera model from the github sources.
38+
39+
There are other options available so you can use a local copy of the Linux kernel (uImage) and camera software (rootfs.squashfs).
40+
41+
For old firmware running `sysupgrade` without parameters is enough. For newer firmware, run `sysupgrade -k -r` to update both kernel and rootfs is required.
42+
:::caution
43+
Upgrading firmware can lead to "bricking" your camera. Make sure you are prepared both morally and skill wise. Have your rescue SD card and/or UART adapter ready. Be prepared to de-solder and reprogram flash chip as the last resort. Do not upgrade production cameras unless you really have to!__
44+
:::
45+
### Using sysupgrade
46+
Typically running sysupgrade will give you the latest release for your camera, as described above, however if you wish to revert to a previous image, or load your own updates, then use any the options described below.
47+
48+
Remember once you are ready to run sysupgrade you must use the syntax
49+
```sysupgrade --kernel=/tmp/uImage.${soc} --rootfs=/tmp/rootfs.squashfs.${soc} -z``` where ```${soc}``` is your camera specific soc e.g. gk7205v300
50+
otherwise the latest release on Github will be downloaded.
51+
52+
## Using a TFTP server
53+
### On your host machine:
54+
If you haven't already got a TFTP server running on your host machine then take a look at the Wiki article [Set up a TFTP server](installation-tftpd.md).
55+
56+
If you don't already have the uImage and rootfs.squashfs images for your camera then go to <https://github.com/OpenIPC/firmware/releases/tag/latest> and download the latest firmware bundle for your SoC and extract the content of the bundle into the root directory of your TFTP server.
57+
58+
```bash
59+
tar xvf <firmware.tgz>
60+
```
61+
62+
If you have built your own versions using a copy of the [firmware repository](https://github.com/OpenIPC/firmware) then your uImage and rootsfs.squashfs images will be in your _output/images_ folder. Copy these to the root of your tftp server.
63+
64+
### On the camera:
65+
You can either update the images from a Linux terminal session or from the U-Boot prompt, if you have a UART serial connection and interrupted Linux loading.
66+
67+
Check that your camera environment variable for the TFTP server is correct by looking for the _serverip_ entry when listing them with _fw_printenv_.
68+
69+
If it needs updating use _fw_setenv serverip <your.tftp.ip.address>_ command.
70+
71+
#### From Linux
72+
```bash
73+
soc=$(fw_printenv -n soc)
74+
serverip=$(fw_printenv -n serverip)
75+
cd /tmp
76+
busybox tftp -r rootfs.squashfs.${soc} -g ${serverip}
77+
busybox tftp -r uImage.${soc} -g ${serverip}
78+
sysupgrade --kernel=/tmp/uImage.${soc} --rootfs=/tmp/rootfs.squashfs.${soc} -z
79+
```
80+
81+
#### From U-Boot
82+
83+
for 8MB image
84+
85+
```bash
86+
tftp ${baseaddr} uImage.${soc}
87+
sf probe 0; sf erase 0x50000 0x200000; sf write ${baseaddr} 0x50000 ${filesize}
88+
89+
tftp ${baseaddr} rootfs.squashfs.${soc}
90+
sf probe 0; sf erase 0x250000 0x500000; sf write ${baseaddr} 0x250000 ${filesize}
91+
```
92+
93+
for 16MB image
94+
95+
```bash
96+
tftp ${baseaddr} uImage.${soc}
97+
sf probe 0; sf erase 0x50000 0x200000; sf write ${baseaddr} 0x50000 ${filesize}
98+
99+
tftp ${baseaddr} rootfs.squashfs.${soc}
100+
sf probe 0; sf erase 0x250000 0xA00000; sf write ${baseaddr} 0x250000 ${filesize}
101+
```
102+
103+
Now restart the camera to load the new images.
104+
105+
## Using scp
106+
### On your host machine:
107+
If you don't already have the uImage and rootfs.squashfs images for your camera then go to <https://github.com/OpenIPC/firmware/releases/tag/latest> and download the latest firmware bundle for your SoC and extract the contents.
108+
109+
```bash
110+
tar xvf <firmware.tgz>
111+
```
112+
113+
If you have built your own versions using a copy of the [firmware repository](https://github.com/OpenIPC/firmware) then your uImage and rootsfs.squashfs images will be in your _output/images_ folder.
114+
115+
Now copy these to the camera using scp.
116+
117+
```bash
118+
scp uImage* rootfs* root@<yourcameraip>:/tmp/
119+
```
120+
121+
**Note:** If you get an error that '/usr/libexec/sftp-server could not be found' it is because in later versions of scp sftp is now used behind the scenes and this is not built into the busybox implementation currently. To force scp to use the legacy behavour use the -O option so
122+
```bash
123+
scp -O uImage* rootfs* root@<yourcameraip>:/tmp/
124+
```
125+
126+
### On the camera:
127+
Now create a terminal session with the camera e.g. ssh [email protected] and run the sysupgrade command pointing at your new images in /tmp.
128+
129+
```bash
130+
soc=$(fw_printenv -n soc)
131+
sysupgrade --kernel=/tmp/uImage.${soc} --rootfs=/tmp/rootfs.squashfs.${soc} -z
132+
```
133+
134+
## Upgrading from an SD card
135+
### On your host machine
136+
If you don't already have the uImage and rootfs.squashfs images for your camera then go to <https://github.com/OpenIPC/firmware/releases/tag/latest> and download the latest firmware bundle for your SoC and extract the contents
137+
138+
If you have built your own versions using a copy of the [firmware repository](https://github.com/OpenIPC/firmware) then your uImage and rootsfs.squashfs images will be in your _output/images_ folder.
139+
140+
Insert an SD card into your host machine and copy the uImage and squashfs files to the card e.g.
141+
142+
```bash
143+
cp uImage* rootfs* /media/<username>/<card-id>/
144+
```
145+
146+
### On your camera
147+
Insert the SD card into your camera.
148+
149+
Create a terminal session and run the following
150+
151+
```bash
152+
soc=$(fw_printenv -n soc)
153+
sysupgrade --kernel=/mnt/mmcblk0p1/uImage.${soc} --rootfs=/mnt/mmcblk0p1/rootfs.squashfs.${soc} --force_ver -z
154+
```
155+
156+
### SD Card: Alternatively, from U-Boot
157+
158+
for 8MB image
159+
160+
```bash
161+
mw.b ${baseaddr} 0xff 0x200000
162+
fatload mmc 0:1 ${baseaddr} uImage.${soc}
163+
sf probe 0; sf erase 0x50000 0x200000; sf write ${baseaddr} 0x50000 ${filesize}
164+
165+
mw.b ${baseaddr} 0xff 0x500000
166+
fatload mmc 0:1 ${baseaddr} rootfs.squashfs.${soc}
167+
sf probe 0; sf erase 0x250000 0x500000; sf write ${baseaddr} 0x250000 ${filesize}
168+
```
169+
170+
for 16MB image
171+
172+
```bash
173+
mw.b ${baseaddr} 0xff 0x300000
174+
fatload mmc 0:1 ${baseaddr} uImage.${soc}
175+
sf probe 0; sf erase 0x50000 0x300000; sf write ${baseaddr} 0x50000 ${filesize}
176+
177+
mw.b ${baseaddr} 0xff 0x500000
178+
fatload mmc 0:1 ${baseaddr} rootfs.squashfs.${soc}
179+
sf probe 0; sf erase 0x350000 0xa00000; sf write ${baseaddr} 0x350000 ${filesize}
180+
```
181+
182+
## Flashing U-Boot via ymodem
183+
184+
Clean 320K of RAM and load bootloader file into it:
185+
186+
```bash
187+
mw.b ${baseaddr} 0xff 0x50000
188+
loady
189+
```
190+
191+
> _(press "Ctrl-a" followed by ":", then type)_
192+
193+
```bash
194+
exec !! sz --ymodem u-boot.bin
195+
```
196+
197+
After the file if uploaded, write it into ROM:
198+
199+
```bash
200+
sf probe 0
201+
sf erase 0x0 0x50000
202+
sf write ${baseaddr} 0x0 ${filesize}
203+
```
204+
205+
## Troubleshooting
206+
207+
If you got this error:
208+
209+
```console
210+
losetup: /tmp/rootfs.squashfs.${soc}: No such file or directory
211+
Rootfs: Unable to get hostname, execution was interrupted...
212+
```
213+
214+
then try to update only kernel first:
215+
`sysupgrade -k`
216+
217+
If it doesn't help, use `--force` option:
218+
`sysupgrade -r --force`
219+
220+
If you caught a glitch, retrieve the most recent version of the utility:
221+
222+
```bash
223+
curl -k -L -o /usr/sbin/sysupgrade "https://raw.githubusercontent.com/OpenIPC/firmware/master/general/overlay/usr/sbin/sysupgrade"
224+
```

0 commit comments

Comments
 (0)