Based on the Mender OTA client. Written in C and optimized for low memory usage so it can be used on low power devices like MCUs.
- cmake v2.8 or higher
- http_parser (Ubuntu: libhttp-parser-dev)
- mbedtls (Ubuntu: libmbedtls-dev)
- jsmn
- Testing (optional):
- cmocka v1.1.2 or higher
- Sanitizers (optional):
- No dynamic memory allocation
- Everything is based on non-blocking eventloop callbacks
- Platform abstractions with sample implementations for POSIX (select-eventloop, sockets, mbedtls)
- Supports both TCP and SSL, including server-certificate verification
- The statemachine is a port from the Go-client at version 1.5.0 with state-scripts being the only missing feature
- Clone repo and make sure that all dependencies are met
- Create build directory inside root-dir of the repo:
mkdir build && cd build
- Configure:
CFLAGS="-I<repo-dir>/jsmn" LDFLAGS="-L<repo-dir>/jsmn" cmake -DCMAKE_BUILD_TYPE=Debug ..
- Compile:
make
Please see sanitizers-cmake on what sanitizers can be enabled.
- Configure with memory sanitizer:
CFLAGS="-I<repo-dir>/jsmn" LDFLAGS="-L<repo-dir>/jsmn" cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON -DENABLE_SANITIZER=ON -DSANITIZER_DIR="<repo-dir>/sanitizers-cmake" -DSANITIZE_MEMORY=On ..
- Compile:
make
- Run tests:
./tests/mender_test
- Keep in mind that
SANITIZE_MEMORY
state is cached and if you want to enable another sanitizer you first have to turnSANITIZE_MEMORY
off.
- Build the client
- Create menderstore directory:
mkdir -p <data-dir>/menderstore
- Create a client certificate:
openssl s_client -showcerts -connect <server-url>:443 </dev/null
- Copy the last Root CA into a file named
cert.crt
- Some servers don't send the CA cert. In that case you have to obtain it using a different way.
- Convert the client certificate from PEM to DER format:
openssl x509 -outform der -in cert.crt -out <data-dir>/cert.der
After building the project successfully and setting up the folder structure start the test client with the following command and display the help:
./platform/linux/test_tool/test_tool -h
After a deployment the test tool exits instead of a reboot a real device would do. Start the test tool again but set the artifact name to the deployed version. After that the server should indicate a successful deployment.
- Deployment failed because artifact name does not match.
This might happen if the artifact name does not match the deployed artifact
name. After this you have to delete the file
upgrade_available
located indata/menderstore/
or set it's contents to 0x00 using a hex-editor. - Device does not show up to server. If you try to authorize a new device make sure to change the MAC-address. Your device wont show up if you already have a device authorized with the same MAC-address.
CMender is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Apache v2.0 © grandcentrix GmbH