|
Veethree D7 SDK
|
Please refer to Creating software updates to understand Software Update images.
SWU Template App example shows an easy to configure template for creating a Software Update (SWU) image. The app demonstrates how to include application binaries and custom data files into a target install directory and package them to an SWU image.
The template application is a QML application that displays IP addresses of all network interfaces on the D7 and build timestamp of the application. The target install folder also includes a .txt file that contains the build timestamp that is shown on the UI. This timestamp file is generated as a part of the CMake build step for convenience. The target-install folder included in this example can be used as a template folder structure to generate a packaged image. The template folder contains a systemd .service file and .conf file to mark the service as non critical. Application binary is installed in the bin folder after building the app. This folder will be packaged as is when generating the SWU image. The same folder structure will be replicated on the /app partition of the D7 when applying the software update.
The target-install folder generated by this application after build steps, has the following structure:
To generate an SWU image from this app, simply build and install application binary targets using CMake. The build command requires the cache variable: CMAKE_BUILD_TYPE- to generate either a 'Debug' or 'Release' image.
To get started, open a new terminal (on linux) or CMD window (on windows) and navigate to the base directory of this example ~/d7-sdk/examples/gui/qml-swu-template/.
Source the target toolchain as:
on windows:
Generate build files in the build directory using the CMake command:
Build and install the target using:
The install step copies the template files from the target-install folder to the install directory, installs the app binary in the bin folder and creates the SWU image using the swugen utility. If the build is successful, the SWU image file swu-template-{sdk-version}+{sdk-build-number}.swu would be generated in the build directory created. Use this file to apply a software update to the D7 using either a USB-C drive or the SWUpdate web interface.
Library files or data files (like text, JSON, XML, etc) can also be packaged in the SWU image file to be deployed to the D7. This example generates a .txt file containing the application build timestamp in the bin directory during the CMake install step and it is automatically included in the SWU image. To include files apart from the app binary files, simply add them to the target-install directory. No additional steps or flags are required to include these extra files in the final image while using the swugen utility.
To include CMake SWU image generation to your target application, copy the target-install template folder from this example to your application's directory.
After copying the folder, rename the systemd .service file in target-install to your application service name and edit the file to run your application binary instead of qml-swu-template-app. Also edit the description.
The application included in this example is marked as non-critical by the file target-install/sys/etc/systemd/non-critical.d/app.conf. If you would like to retain this, edit the app.conf file to use your app name. Otherwise delete the file.
To automatically install the application binaries to the target-install folder, create a target in the CMakeLists.txt file of your application by including the lines:
Add these lines for all the targets your app generates. Set CMAKE_INSTALL_PREFIX to the path of target-install folder.
To automatically install library files in target-install folder, use:
This application runs the swugen utility as a custom installation logic from the CMake install step. To the run the utility on the shell combine install(CODE ...) with execute_process as:
The same build commands as above can be used to build and install the app. Make sure all the paths are modified to match your application.
The example code below highlights the CMakeLists.txt used to generate SWU image. Please refer to the full example in /examples/gui/qml-swu-template in the SDK installation folder.