Skip to content

Commit 4ad5ccc

Browse files
author
GHA
committed
update b0854a4
0 parents  commit 4ad5ccc

File tree

316 files changed

+17083
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+17083
-0
lines changed

.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 49effde65b106711a3ed041296389730
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

.nojekyll

Whitespace-only changes.

_images/summary.png

55.2 KB
Loading

_sources/api.rst.txt

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
RDFM Server API Reference
3+
-------------------------
4+
5+
API Authentication
6+
~~~~~~~~~~~~~~~~~~
7+
8+
By default, the RDFM server expects all API requests to be authenticated.
9+
Depending on the type of the API, this can be either:
10+
11+
* Device Token
12+
* Management Token
13+
14+
In either case, the server expects the token to be passed as part of the request, in the HTTP Authorization header.
15+
An example authenticated request is shown below:
16+
17+
.. sourcecode:: http
18+
19+
GET /api/v1/groups HTTP/1.1
20+
Host: rdfm-server:5000
21+
User-Agent: python-requests/2.31.0
22+
Accept-Encoding: gzip, deflate
23+
Accept: */*
24+
Connection: keep-alive
25+
Authorization: Bearer token=eyJhbGciOiJSUzI1NiIsInR5cC<...truncated...>RpPonb7-IAsk89YpGayxg
26+
27+
Any request that was not successfully authenticated (because of a missing or otherwise invalid token) will return the 401 Unauthorized status code.
28+
Additionally, in the case of management tokens, if the given token does not provide sufficient access to the requested resource, the request will be rejected with a 403 Forbidden status code.
29+
This can happen if the token does not claim all scopes required by the target endpoint (for example: trying to upload a package using a read-only token).
30+
31+
Error Handling
32+
~~~~~~~~~~~~~~
33+
34+
Should an error occur during the handling of an API request, either because of incorrect request data or other endpoint-specific scenarios, the server will return an error structure containing a user-friendly description of the error.
35+
An example error response is shown below:
36+
37+
.. sourcecode:: json
38+
39+
{
40+
"error": "delete failed, the package is assigned to at least one group"
41+
}
42+
43+
44+
Packages API
45+
~~~~~~~~~~~~
46+
47+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
48+
:modules: api.v1.packages
49+
:undoc-static:
50+
:order: path
51+
52+
Group API
53+
~~~~~~~~~
54+
55+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
56+
:modules: api.v2.groups
57+
:undoc-static:
58+
:order: path
59+
60+
Group API (legacy)
61+
~~~~~~~~~~~~~~~~~~
62+
63+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
64+
:modules: api.v1.groups
65+
:undoc-static:
66+
:order: path
67+
68+
Update API
69+
~~~~~~~~~~
70+
71+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
72+
:modules: api.v1.update
73+
:undoc-static:
74+
:order: path
75+
76+
Device Management API
77+
~~~~~~~~~~~~~~~~~~~~~
78+
79+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
80+
:modules: api.v2.devices
81+
:undoc-static:
82+
:order: path
83+
84+
Device Management API (legacy)
85+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86+
87+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
88+
:modules: api.v1.devices
89+
:undoc-static:
90+
:order: path
91+
92+
Device Authorization API
93+
~~~~~~~~~~~~~~~~~~~~~~~~
94+
95+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
96+
:modules: api.v1.auth
97+
:undoc-static:
98+
:order: path
99+
100+
Permissions API
101+
~~~~~~~~~~~~~~~
102+
103+
.. autoflask:: rdfm_mgmt_server:create_docs_app()
104+
:modules: api.v1.permissions
105+
:undoc-static:
106+
:order: path

_sources/index.md.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# {{project}}
2+
3+
```{toctree}
4+
:maxdepth: 2
5+
6+
introduction
7+
system_overview
8+
rdfm_linux_device_client
9+
rdfm_android_device_client
10+
rdfm_mcumgr_device_client
11+
rdfm_artifact
12+
rdfm_manager
13+
rdfm_mgmt_server
14+
rdfm_ota_manual
15+
server_operation
16+
rdfm_frontend
17+
api
18+
```

_sources/introduction.md.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Introduction
2+
3+
RDFM - Remote Device Fleet Manager - is an open-source ecosystem of tools that enable Over-The-Air (OTA) update delivery and fleet management for systems of embedded devices.
4+
5+
This manual describes the main components of RDFM. It is divided into the following chapters:
6+
7+
- System Architecture - a short overview of the system architecture, and how each component of the system interacts with the other
8+
- RDFM Linux Device Client - build instructions and manual for the Linux RDFM Client, used for installing updates on a device
9+
- RDFM Android Device Client - integration guide and user manual for the RDFM Android Client/app used for providing OTA updates via RDFM on embedded Android devices
10+
- RDFM MCUmgr Device Client - build instructions and manual for the RDFM MCUmgr Client app, used for providing updates via RDFM on embedded devices running ZephyrRTOS
11+
- RDFM Artifact utility - instruction manual for the `rdfm-artifact` utility used for generating update packages for use with the RDFM Linux device client
12+
- RDFM Manager utility - instruction manual for the `rdfm-mgmt` utility, which allows management of devices connected to the RDFM server
13+
- RDFM Management Server - build instructions and deployment manual for the RDFM Management Server
14+
- RDFM Server API Reference - comprehensive reference of the HTTP APIs exposed by the RDFM Management Server
15+
- RDFM OTA Manual - introduces key concepts of the RDFM OTA system and explains it's basic operation principles
16+
- RDFM Frontend - build instructions for the RDFM Frontend application
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# RDFM Android Device Client
2+
3+
## Introduction
4+
5+
The RDFM Android Device Client allows for integrating an Android-based device with the RDFM server.
6+
Currently, only OTA update functionality is implemented.
7+
8+
## Integrating the app
9+
10+
This app is **not meant to be built separately** (i.e in Android Studio), but as part of the source tree for an existing device.
11+
The app integrates with the Android UpdateEngine to perform the actual update installation, which requires it to be a system app.
12+
Some configuration is required to the existing system sources.
13+
14+
### Copying the sources
15+
16+
First, copy the sources of the app to the root directory of the AOSP source tree.
17+
After cloning this repository, run the following:
18+
```
19+
mkdir -v -p <path-to-aosp-tree>/vendor/antmicro/rdfm
20+
cd devices/android-client/
21+
cp -r app/src/main/* <path-to-aosp-tree>/vendor/antmicro/rdfm
22+
```
23+
24+
### Configuring the device Makefile
25+
26+
The [product Makefile](https://source.android.com/docs/setup/create/new-device#build-a-product) must be configured to build the RDFM app into the system image.
27+
To do this, add `rdfm` to the `PRODUCT_PACKAGES` variable in the target device Makefile:
28+
```
29+
PRODUCT_PACKAGES += rdfm
30+
```
31+
32+
### Building the app
33+
34+
Afterwards, [the usual Android build procedure](https://source.android.com/docs/setup/build/building) can be used to build just the app.
35+
From an already configured build environment, run:
36+
```
37+
mma rdfm
38+
```
39+
The resulting signed APK is in `out/target/product/<product-name>/system/app/rdfm/rdfm.apk`.
40+
41+
### Using HTTPS for server requests
42+
43+
The default Android system CA certificates are used when validating the certificate presented by the server.
44+
If the RDFM server that is configured in the app uses a certificate that is signed by a custom Certificate Authority, the CA certificate must be added to the system roots.
45+
46+
## System versioning
47+
48+
The app performs update check requests to the configured RDFM server.
49+
The build version and device type are retrieved from the system properties:
50+
- `ro.build.version.incremental` - the current software version (matches `rdfm.software.version`)
51+
- `ro.build.product` - device type (matches `rdfm.hardware.devtype`)
52+
53+
When uploading an OTA package to the RDFM server, currently these values must be **manually** extracted from the update package, and passed as arguments to `rdfm-mgmt`:
54+
```
55+
rdfm-mgmt packages upload --path ota.zip --version <ro.build.version.incremental> --device <ro.build.product>
56+
```
57+
58+
You can extract the values from the [package metadata file](https://source.android.com/docs/core/ota/tools#ota-package-metadata) by unzipping the OTA package.
59+
60+
## Configuring the app
61+
62+
The application will automatically start on system boot.
63+
Available configuration options are shown below.
64+
65+
### Build-time app configuration
66+
67+
The default build-time configuration can be modified by providing a custom `conf.xml` file in the `app/src/main/res/values/` folder, similar to the one shown below:
68+
69+
```xml
70+
<?xml version="1.0" encoding="utf-8"?>
71+
<resources>
72+
<!--
73+
This is an example overlay configuration file for the RDFM app.
74+
To modify the default server address, you can do:
75+
76+
<string name="default_rdfm_server_address">http://rdfm.example.local:6000/</string>
77+
78+
Likewise, overlaying the default update check interval can be done similarly:
79+
80+
<string name="default_update_check_interval_seconds">240</string>
81+
82+
NOTE: These settings are only used during the app's first startup. To change them afterwards,
83+
you must delete the existing configuration file.
84+
-->
85+
</resources>
86+
```
87+
88+
This build-time configuration is applied **only once, at first startup of the app**, as the main use case for this is first-time configuration for newly provisioned devices.
89+
Modifying it afterwards (for example, via an update containing a new version of the RDFM app) will not result in the change of existing configuration.
90+
91+
### Runtime app configuration
92+
93+
It is possible to change the app's configuration at runtime by simply starting the RDFM app from the drawer and selecting `Settings` from the context menu.
94+
95+
### Configuration options
96+
97+
The following configuration options are available:
98+
- RDFM server URL (`http`/`https` scheme)
99+
- Update check interval (in seconds)
100+
- Maximum amount of concurrent shell sessions (set to `0` to disable reverse shell functionality)
101+
102+
## Available intents
103+
104+
### Update check intent
105+
106+
This intent allows an external app to force perform an update check outside of the usual automatic update check interval.
107+
To do this, the app that wants to perform the update check must have the `com.antmicro.update.rdfm.permission.UPDATE_CHECK` permission defined in its `AndroidManifest.xml` file:
108+
109+
```xml
110+
<uses-permission android:name="com.antmicro.update.rdfm.permission.UPDATE_CHECK" />
111+
```
112+
113+
Afterwards, an update check can then be forced like so:
114+
```java
115+
Intent configIntent = new Intent("com.antmicro.update.rdfm.startUpdate");
116+
mContext.sendBroadcast(configIntent);
117+
```
118+
119+
### External configuration via intents
120+
121+
The app settings can also be configured via intents, for example in order to change between different deployment environments.
122+
To do this, the app that performs the configuring step must have the `com.antmicro.update.rdfm.permission.CONFIGURATION` permission defined in its `AndroidManifest.xml` file:
123+
```xml
124+
<uses-permission android:name="com.antmicro.update.rdfm.permission.CONFIGURATION" />
125+
```
126+
127+
To configure the app, use the `com.antmicro.update.rdfm.configurationSet` intent and set extra values on the intent to the settings you wish to change.
128+
For example, to set the server address:
129+
```java
130+
Intent configIntent = new Intent("com.antmicro.update.rdfm.configurationSet");
131+
configIntent.putExtra("ota_server_address", "http://CUSTOM-OTA-ADDRESS/");
132+
mContext.sendBroadcast(configIntent);
133+
```
134+
135+
The supported configuration key names can be found in the `res/values/strings.xml` file with the `preference_` prefix.
136+
137+
Aside from setting the configuration, you can also fetch the current configuration of the app:
138+
```java
139+
Intent configIntent = new Intent("com.antmicro.update.rdfm.configurationGet");
140+
mContext.sendBroadcast(configIntent);
141+
142+
// Now listen for `com.antmicro.update.rdfm.configurationResponse` broadcast intent
143+
// The intent's extras bundle will contain the configuration keys and values
144+
```
145+
146+
## Development
147+
148+
The provided Gradle files can be used for development purposes, simply open the `devices/android-client` directory in Android Studio.
149+
Missing references to the `UpdateEngine` class are expected, but they do not prevent regular use of the IDE.
150+
151+
Do note however that **the app is not buildable from Android Studio**, as it requires integration with the aforementioned system API.
152+
To test the app, an existing system source tree must be used.
153+
Copy the modified sources to the AOSP tree, and re-run the [application build](#building-the-app).
154+
The modified APK can then be uploaded to the device via ADB by running:
155+
```
156+
adb install <path-to-rdfm.apk>
157+
```
158+
159+
### Restarting the app
160+
161+
With the target device connected via ADB, run:
162+
```
163+
adb shell am force-stop com.antmicro.update.rdfm
164+
adb shell am start -n com.antmicro.update.rdfm/.MainActivity
165+
```
166+
167+
### Fetching app logs
168+
169+
To view the application logs, run:
170+
```
171+
adb logcat --pid=`adb shell pidof -s com.antmicro.update.rdfm`
172+
```

0 commit comments

Comments
 (0)