Deploy Over-the-Air Updates to Linux Target
R2026bThis example shows how to use over-the-air (OTA) updates with the Embedded Coder(R) Support Package for Service-Oriented Applications on Linux(R) to update deployed AUTOSAR(R) adaptive applications on a target machine. OTA updates enable remote software deployment without physical access to the device, using an Eclipse(TM) hawkBit server to roll out updates to target machines.
This example uses an AUTOSAR adaptive architecture model LightControlSystem with three components: OutdoorLightSensor, LightController, and LightActuator. You deploy this model, then update it by adding a BrakeSensor component and push the update over the air.
In this example, you:
Deploy the
LightControlSystemarchitecture model to the Linux target and verify that headlight control operates correctlySet up an Eclipse hawkBit server and configure the OTA client on the target for remote updates
Create an application package from the updated model that includes the new
BrakeSensorcomponentRoll out the update via hawkBit and verify that the target receives the updated application
Deploy the Initial Architecture Model
To establish a baseline application on the target before performing an OTA update, deploy the initial LightControlSystem model. The model contains three AUTOSAR adaptive components that communicate using adaptive events and methods:
OutdoorLightSensorprocesses ambient light data and sends the result toLightControllervia an adaptive event.LightControllerreceives the event and calls a method onLightActuatorto issue a headlight on/off command.LightActuatorreceives the method call and drives the headlight output.
Navigate to the LightControlSystem folder in the example directory and open the LightControlSystem model. From the model toolstrip, select Apps > Linux Runtime Manager to open the Linux Runtime Manager app.
In the Target Configuration pane, specify the target details and connect to the target machine. For more information on setting up the target computer, see Set Up Linux Target Computer.
In the Linux Runtime Manager toolstrip, click Prepare > Create & Deploy Application Package and select the LightControlSystem model. This builds one executable per component and deploys them to the target. For more information, see Build Simulink Model and Deploy Application.
After a successful deployment, the Targets Tree pane displays the deployed application and its executables. To verify the application operates correctly, select LightControlSystem in the Targets Tree and click Run on Target > Start Application. The Linux Runtime Manager logs show the headlight status, confirming that adaptive events and methods flow correctly between the three components. Click Stop Application to stop the executables after verification.
Set Up the Eclipse hawkBit Server
To enable OTA updates, you need a hawkBit server that acts as the central update management system. OTA clients on target machines connect to this server to poll for and download updates.
Install the hawkBit server on a Linux x86_64 machine by creating a Docker container. Run this command in a Linux terminal:
docker run -p 8080:8080 hawkbit/hawkbit-update-server:0.3.0
Port 8080 is the default port through which OTA clients connect to the hawkBit server. Change this port number if your network requires a different value. You can ignore any connection-related logs in the Docker container. For more installation options, see Eclipse hawkBit.
To access the hawkBit Server Management user interface, navigate to http://IpAddress:8080 where IpAddress is the IP address of the machine running the hawkBit server. Log in with the default credentials: username admin, password admin.
To generate a gateway token for OTA client authentication, go to System Config > Authentication Configuration and select the Allow a gateway to authenticate and manage multiple targets through a gateway security token checkbox. The gateway token appears below the checkbox. Click Save to apply the settings.
The gateway token authenticates OTA clients running on target machines when they connect to the hawkBit server. Record this token for use in the next step.
Configure the OTA Client on the Target
To allow the target machine to receive OTA updates, enable and configure the OTA client. The OTA client polls the hawkBit server at a specified interval to check for available updates.
In the Linux Runtime Manager, enable the OTA client on the target by specifying the target name and poll interval in seconds. A poll interval of 10 seconds means the client checks for updates every 10 seconds. For production systems, use a longer interval (such as 3600 seconds) to reduce network traffic.
enableOTAClient("targetName", 10)
Configure the OTA server connection details by calling:
setupOTAServerConfiguration()
In the dialog box that opens, enter the hawkBit server details:
IP Address — The IPv4 address of the machine running the hawkBit server.
Port — The port number used by the hawkBit server (default 8080).
Gateway Token — The gateway token from the hawkBit Server Management user interface.
Click OK to apply the configuration. Then disconnect and reconnect the target in the Linux Runtime Manager. Reconnecting may display an error with an option to restart the Docker container — use that option to restart and connect again.
To provide the required permissions for the OTA client, find the deployment location and grant access. Use these commands to retrieve the deployment path:
tg = linuxTarget("targetName")
tg.DeploymentLocation
Log in to the target machine and run this command in a terminal, replacing <deploymentLocation> with the path returned above:
sudo chmod -R 777 <deploymentLocation>
After reconnecting, the hostname of the target machine appears in the Targets table of the Deployment section in the hawkBit Server Management user interface. This confirms that the OTA client successfully registered with the server.
Create the Updated Application Package
To prepare the software update, create an application package from the updated architecture model. The updated LightControlSystem model adds a BrakeSensor component that sends brake sensor data to LightController via an adaptive event. LightController uses this data to call a method on LightActuator to control brake lights independently from headlights.
Navigate to the LightControlSystemUpdated folder in the example directory. In the Linux Runtime Manager toolstrip, click Prepare > Create & Deploy Application Package > Create and select the LightControlSystem model from the LightControlSystemUpdated folder. This generates an application package (.mldatx file) containing the executables for all four components without deploying it directly to the target.
The build process produces a .mldatx application package file. This file contains the updated executables and AUTOSAR adaptive manifest files needed to replace the previously deployed three-component application with the new four-component version.
Roll Out the Update via hawkBit
To deliver the updated application package to the target over the air, upload it to the hawkBit server and create a rollout campaign.
Upload the Application Package: In the hawkBit Server Management user interface, go to the Upload section. Create a software module of type Application, specify a name and version, then click Save. Click Upload file and select the .mldatx application package created in the previous step.
Create a Distribution: Go to the Distributions section. Create a distribution of type App(s) only, specify a name and version. Drag and drop the software module onto the created distribution to associate them.
Create a Target Filter: Go to the Target Filters section. Create a new filter with the name "Default filter" and query name==*. Click Save. This filter matches all registered targets and is reusable for future rollouts.
Create and Activate the Rollout: Go to the Rollout section. Create a new rollout campaign, select the distribution set, set the Custom Target Filter to "Default filter", specify Number of groups as 1, and click Save. Click Run on the right side of your rollout campaign to activate the deployment.
The OTA client on the target polls the hawkBit server at the configured interval. When the client detects the new rollout campaign, it downloads and installs the updated application package. The hawkBit Server Management user interface shows the rollout campaign status change from "Running" to "Finished" when the update completes successfully.
Verify the Update and Disable the OTA Client
To confirm the update applied successfully, check the Linux Runtime Manager. The deployed application in the Targets Tree now shows four components instead of the original three, indicating that the BrakeSensor component is included in the updated deployment.
After verifying the update, disable the OTA client on the target to stop polling the hawkBit server:
disableOTAClient("targetName")
See Also
Linux Runtime Manager | linux.createApplicationPackage | deployApplicationPackage