OBSW Update Commands #302
39
README.md
39
README.md
@ -154,42 +154,53 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
|
|
||||||
## Preparing and executing an OBSW update
|
## Preparing and executing an OBSW update
|
||||||
|
|
||||||
A OBSW update consists of the following two files
|
A OBSW update consists of a `xz` compressed file `eive-sw-update.tar.xz`
|
||||||
|
which contains the following two files:
|
||||||
|
|
||||||
1. Stripped OBSW binary compressed with `xz` with the name `eive-obsw.tar.xz`
|
1. Stripped OBSW binary `eive-obsw-stripped`
|
||||||
2. OBSW version text file with the name `obsw_version.txt`
|
2. OBSW version text file with the name `obsw_version.txt`
|
||||||
|
|
||||||
These files can be created manually:
|
These files can be created manually:
|
||||||
|
|
||||||
1. Build the release image and then switch into the build directory
|
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`
|
2. Run the following command to create the version file
|
||||||
3. Run the following command to create the version file
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git describe --tags --always --exclude docker_* > obsw_version.txt
|
git describe --tags --always --exclude docker_* > obsw_version.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
3. Run the following command to create the compressed archive
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt
|
||||||
|
```
|
||||||
|
|
||||||
You can also use the helper script `prepare-obsw-update.sh` inside the build folder
|
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 sourcing the `q7s-env.sh` helper script to perform all three steps.
|
||||||
|
|
||||||
After creating these files, they need to be transferred onto the Q7S
|
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
|
to either the `/mnt/sd0/bin` or `/mnt/sd1/bin` folder if the OBSW update
|
||||||
SD card is used.
|
is performed from the SD card. It can also be transferred to the `/tmp` folder
|
||||||
|
to perform the update from a temporary directory, which does not rely on any
|
||||||
|
of the SD cards being on and mounted. However, all files in the temporary
|
||||||
|
directory will be deleted if the Linux OS is rebooted for any reason.
|
||||||
|
|
||||||
After both files are in place (this is checked by the OBSW), the example command
|
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
|
sequence is used by the OBSW to write the OBSW update to the QSPI chip 0 and
|
||||||
slot 0 using SD card 0:
|
slot 0 using SD card 0:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
tar -xJvf eive-obsw.tar.xz
|
tar -xJvf eive-update.tar.xz
|
||||||
cp-to-other-slots.sh 0 0 /mnt/sd0/bin/eive-obsw-stripped /usr/bin/eive-obsw --np
|
xsc_mount_copy 0 0
|
||||||
cp-to-other-slots.sh 0 0 /mnt/sd0/bin/obsw_update.txt /usr/share/obsw_update.txt
|
cp eive-obsw-stripped /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/bin/eive-obsw
|
||||||
|
cp obsw_update.txt /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/share/obsw_update.txt
|
||||||
|
writeprotect 0 0 1
|
||||||
```
|
```
|
||||||
|
|
||||||
The helper script `cp-to-other-slots.sh` performs the following steps:
|
Some context information about the used commands:
|
||||||
|
|
||||||
1. It mounts the target chip and copy combination into the `/tmp` folder
|
1. It mounts the target chip and copy combination into the `/tmp` folder
|
||||||
using the `xsc_mount_copy` utility. This also unlocks the
|
using the `xsc_mount_copy <chip> <copy>` utility. This also unlocks the
|
||||||
writeprotection for the chip. The mount point name inside `/tmp` depends
|
writeprotection for the chip. The mount point name inside `/tmp` depends
|
||||||
on which chip and copy is used
|
on which chip and copy is used
|
||||||
|
|
||||||
@ -197,11 +208,9 @@ The helper script `cp-to-other-slots.sh` performs the following steps:
|
|||||||
- Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-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-nom-rootfs`
|
||||||
- Slot 0 Copy 0: `/tmp/mntupdate-xdi-qspi1-gold-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
|
2. Writing the file with a regular `cp <source> <target>` command
|
||||||
re-application of write-protection after the mount and copy operation.
|
3. Enabling the writeprotection using the `writeprotect <chip> <copy> 1` utility.
|
||||||
|
|
||||||
## Build for the Q7S target root filesystem with `yocto`
|
## Build for the Q7S target root filesystem with `yocto`
|
||||||
|
|
||||||
|
@ -198,6 +198,9 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
}
|
}
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
case(OBSW_UPDATE_FROM_SD_0): {
|
||||||
|
break;
|
||||||
|
}
|
||||||
case (SWITCH_IMG_LOCK): {
|
case (SWITCH_IMG_LOCK): {
|
||||||
if (size != 3) {
|
if (size != 3) {
|
||||||
return HasActionsIF::INVALID_PARAMETERS;
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
|
@ -51,6 +51,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh";
|
static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh";
|
||||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||||
|
static constexpr char OBSW_COMPRESSED_NAME[] = "eive-obsw.tar.xz";
|
||||||
static constexpr char CONF_FOLDER[] = "conf";
|
static constexpr char CONF_FOLDER[] = "conf";
|
||||||
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
||||||
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
||||||
@ -61,6 +62,11 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||||
const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME);
|
const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME);
|
||||||
|
|
||||||
|
static constexpr char CHIP_0_COPY_0_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-nom-rootfs";
|
||||||
|
static constexpr char CHIP_0_COPY_1_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi0-gold-rootfs";
|
||||||
|
static constexpr char CHIP_1_COPY_0_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi1-nom-rootfs";
|
||||||
|
static constexpr char CHIP_1_COPY_1_MOUNT_DIR = "/tmp/mntupdate-xdi-qspi1-gold-rootfs";
|
||||||
|
|
||||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||||
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||||
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/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}
|
|
17
scripts/create-sw-update.sh
Executable file
17
scripts/create-sw-update.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -f eive-obsw-stripped ]; then
|
||||||
|
echo "No file eive-obsw-stripped found. Please ensure you are in the "
|
||||||
|
echo "build folder and the OBSW was built properly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f obsw_version.txt ]; then
|
||||||
|
echo "No OBSW version file found."
|
||||||
|
echo "You can use the create-version-file.sh script to create it"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd="tar -cJvf eive-obsw.tar.xz eive-obsw-stripped obsw_version.txt"
|
||||||
|
echo "Running command ${cmd} to generate compressed SW update archive"
|
||||||
|
eval ${cmd}
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source create-version-file.sh
|
source create-version-file.sh
|
||||||
source compress-obsw.sh
|
source create-sw-update.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user