Skip to content

Commit

Permalink
Update README for swupdate
Browse files Browse the repository at this point in the history
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
  • Loading branch information
gylstorffq committed Aug 4, 2021
1 parent 76e8da8 commit b7bba39
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions README.md
Expand Up @@ -31,6 +31,12 @@ Using 3rd-party mirrors, for example
./kas-container build kas-iot2050-example.yml:kas/opt/mirror-example.yml
```

Using SWUpdate with a A/B rootfs configuration, for example

```shell
./kas-container build kas-iot2050-example.yml:kas/opt/swupdate-example.yml
```

After build complete, the final image is under

```text
Expand Down Expand Up @@ -145,3 +151,60 @@ device.

NOTE: This selection is not persistent. The boot loader will fall back to its
default boot order after reset.

## Building with SWUpdate support

The option `kas/opt/swupdate-example.yml` will create an image with a
[double copy root file system](https://sbabic.github.io/swupdate/overview.html#double-copy-with-fall-back)
You can find the image under
`build/tmp/deploy/images/iot2050/iot2050-image-swu-example-iot2050-debian-iot2050.wic.img`

NOTE: The image has a size of 7 Gigabytes.

It also will create a binary for updating the system at
This call will write the image to the unused root partition`build/tmp/deploy/images/iot2050/iot2050-image-swu-examp
le-iot2050-debian-iot2050.swu`

The binary can be uploaded to the device and be applied by executing:

```shell
$ swupdate -i iot2050-image-swu-example-iot2050-debian-iot2050.swu
```
SWUpdate will write the image to the unused root partition and
sets the necessary U-Boot variables.

After a reboot, the device boots into the new root file system. If the boot is
successful the update process needs to be completed by calling:

```
$ confirm_update.sh success
```

The script sets the update state in the U-Boot environment to the initial state.

If the update is not successful, a reboot will roll back to the previous root file system.
This rollback is confirmed by calling:

```
$ confirm_update.sh failed
```

This call reverts the U-Boot environment to the initial state.

### U-Boot environment

The bootloader environment needs to be adapted to select the correct
root file system during boot. This adaptation occurs during the first
boot by executing the `patch-u-boot-env.service`. This systemd-service writes the necessary variables to the
U-Boot environment. After writing the U-Boot environment, an update with SWUpdate is possible.

#### Revert to the default environment

If it is necessary to revert to the default U-Boot environment, reset the device and
interrupt the boot when it counts down ("Hit any key to stop autoboot").
Then type

```shell
=> env default -a -f
=> saveenv
```

0 comments on commit b7bba39

Please sign in to comment.