OBSW Update Commands #302

Merged
meierj merged 42 commits from mueller/obsw-update-cmds into develop 2022-09-29 13:24:17 +02:00
3 changed files with 63 additions and 0 deletions
Showing only changes of commit 2ddd95c7fd - Show all commits

View File

@ -152,6 +152,57 @@ When using Windows, run theses steps in MSYS2.
cmake --build . -j
```
## Preparing and executing an OBSW update
A OBSW update consists of the following two files
1. Stripped OBSW binary compressed with `xz` with the name `eive-obsw.tar.xz`
2. OBSW version text file with the name `obsw_version.txt`
These files can be created manually:
1. Build the release image and then switch into the build directory
2. Run the following command: `tar -cJvf eive-obsw.tar.xz eive-obsw-stripped`
3. Run the following command to create the version file
```sh
git describe --tags --always --exclude docker_* > obsw_version.txt
```
You can also use the helper script `prepare-obsw-update.sh` inside the build folder
after sourcing the `q7s-env.sh` helper script to perform all three steps.
After creating these files, they need to be transferred onto the Q7S
to either the `/mnt/sd0/bin` or to the `/mnt/sd1/bin` folder depending on which
SD card is used.
After both files are in place (this is checked by the OBSW), the example command
sequence is used by the OBSW to write the OBSW update to the QSPI chip 0 and
slot 0 using SD card 0:
```sh
tar -xJvf eive-obsw.tar.xz
cp-to-other-slots.sh 0 0 /mnt/sd0/bin/eive-obsw-stripped /usr/bin/eive-obsw --np
cp-to-other-slots.sh 0 0 /mnt/sd0/bin/obsw_update.txt /usr/share/obsw_update.txt
```
The helper script `cp-to-other-slots.sh` performs the following steps:
1. It mounts the target chip and copy combination into the `/tmp` folder
using the `xsc_mount_copy` utility. This also unlocks the
writeprotection for the chip. The mount point name inside `/tmp` depends
on which chip and copy is used
- Chip 0 Copy 0: `/tmp/mntupdate-xdi-qspi0-nom-rootfs`
- Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs`
- Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs`
- Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-rootfs`
2. It writes the file with a regular `cp <source> <target>` command
3. It enables the writeprotection using the `writeprotect` utility.
This script also has an additional `--np` arguments to disable the
re-application of write-protection after the mount and copy operation.
## Build for the Q7S target root filesystem with `yocto`
The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component.

9
scripts/compress-obsw.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ -d eive-obsw-stripped ]; then
echo "No file eive-obsw-stripped found. Please ensure you are in the build folder"
fi
cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped"
echo "Running command ${cmd} to generate compressed OBSW"
eval ${cmd}

3
scripts/prepare-obsw-update.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
source create-version-file.sh
source compress-obsw.sh