-
Notifications
You must be signed in to change notification settings - Fork 178
Add documentation about mbed dm
#681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0dd6a93
a01cdbb
e987f72
3985136
3bbde13
8b3053a
40a757f
72f1710
6137ca5
91cee41
3d9066d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
### Updating Devices with Mbed CLI | ||
|
||
Mbed CLI includes features that help prepare and ship updates for devices managed through Pelion. The Mbed CLI uses the subcommands starting with `mbed device-management`, `mbed dev-mgmt` or `mbed dm` to manage devices. | ||
|
||
Start by configuring your Mbed Cloud SDK API Key, target and toolchain. Obtain the API Key from the Pelion portal. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now, it's the Device Management Portal. Yes, this is a mouthful. :/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API key (not Key) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Start what? It would help if you explained the process you're going to detail. |
||
|
||
``` | ||
$ mbed config -G CLOUD_SDK_API_KEY ak_... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We normally use something like <API_KEY>, not ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I'd drop the |
||
$ mbed target K64F | ||
$ mbed toolchain GCC_ARM | ||
``` | ||
|
||
Next, initialize the device management feature of Mbed CLI with the following command: | ||
|
||
``` | ||
$ mbed device-management init -d "<company domain name>" -m "<product model identifier>" | ||
``` | ||
|
||
First, this command asks for information about your update certificate. When Mbed CLI has enough information, it creates several files: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need "first" here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Total nit pick: The line "When Mbed CLI has enough information" tripped up my brain for a second (enough information from the command line args? Where is it coming from?). How do you feel about this as an alternative:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||
* A certificate in `.update-certificates/default.der`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think this will render as a list without an empty line before the first bullet |
||
* A matching private key in `.update-certificates/default.key.pem`. | ||
* A set of default settings in `.manifest_tool.json`. | ||
* Mbed Cloud settings in `.mbed_cloud_config.json`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Device Management settings (though the filenames are still the same...) |
||
* Mbed Cloud developer credentials in `mbed_cloud_dev_credentials.c` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is only for development? What about production flows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is in the Mbed OS docs, it should (as part of the intro way up there around line 1) link to the Pelion docs. As an Mbed OS user, I've no idea what all these concepts mean. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no production flow yet. That's not part of the requirement as far as I know. |
||
* Mbed Cloud update credentials in `update_defalut_resources.c` | ||
|
||
The default settings include: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the default settings in mbed_cloud_config.json? Would help to make them sub-bullets of that, rather than make the reader go back to figure out where default settings come in (this is only obvious to people who already know - most readers won't remember that they've just read about default settings two lines ago). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And needs an empty line to render the bullets |
||
* A unique vendor identifier, based on the domain name supplied to `init`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When did I supply things to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You supplied them to |
||
* A unique model identifier, based on the vendor identifier and the model name supplied to `init`. | ||
* The path of the certificate and private key. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which certificate? Developer? Update? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update. |
||
|
||
If you do not want to enter the subject information for your update certificate (country, state, city, organization and so on), add the `-q` flag to the command above. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How far above? Why not add this as a note right below the command? |
||
|
||
As `device-management` is very long to type, the remainder of this document will use the `mbed dm` alias for all device management subcommands. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should have said that right after you listed the three possible forms and never used the full form again. It's so random here. |
||
|
||
<span class="notes">**Note:** The certificate created in `mbed dm init` is not suitable for production. Use it for testing and development only. To create a certificate for production purposes, please use an air-gapped computer or a Hardware Security Module. When going to production, conduct a security review on your manifest signing infrastructure, as it is the core of the security guarantees for update client.</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like someone from Update to look at this note. @bremoran ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also it should come earlier (right around where I asked about a production flow) |
||
|
||
#### Single-device update | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need empty line after headers, too |
||
Once you have run `mbed device-management init`, you can perform updates on a single device by: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Device Management isn't shortened here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also haven't been 'allowed' to shorten it on our side, but I'm not sure that requirements still stands for what things are named in code. Also not willing to risk making that decision myself 😑 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code is its own thing; they need to sort it out between them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like using "once you have x". Also, why is single-device hyphenated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iriark01 I'll reword it. |
||
|
||
``` | ||
$ mbed compile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But what am I compiling? Where should I be at this point? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably immediately after |
||
$ mbed dm update device -D <device ID> | ||
``` | ||
theotherjimmy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This will perform several actions: | ||
1. Upload the payload, generated by `mbed compile`, to Mbed Cloud. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Device Management There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That applies for all instances of Mbed Cloud in this list. |
||
1. Hash the payload and create a manifest that links to its location in Mbed Cloud. | ||
1. Create an update campaign for the supplied device ID, with the newly created manifest. | ||
1. Start the campaign. | ||
1. Wait for the campaign to complete. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's waiting? Even though devices could take ages to come on line and receive an update? What happens if it fails? Do I see that here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole point of the command is to update a device. so, yes it waits for that to happen, and yes that can take a while. |
||
1. Delete the payload, manifest and update campaign out of Mbed Cloud. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deletes the update campaign seems odd - don't we show all finished campaigns in the portal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's intended for development, so I would expect a developer to do this flow 4-40 times/hour. That would flood the campaign list. |
||
|
||
This allows development with a device for testing purposes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That should come before you start giving me commands - I want to know why I'm bothering to compile and run things. |
||
|
||
#### Multidevice update | ||
If you need to update more than one device, you can use the Mbed Cloud portal to create device filters that can include many devices into an update campaign. First, you need a manifest. Once you have run `mbed device-management init`, you can create manifests by: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Device Management Portal |
||
|
||
``` | ||
$ mbed compile | ||
$ mbed dm update prepare | ||
``` | ||
|
||
Optionally, a name and description for the payload and corresponding manifest can be provided: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why passive? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy paste. |
||
|
||
``` | ||
$ mbed dm update prepare -n <PAYLOAD_NAME> -d <PAYLOAD_DESCRIPTION>\ | ||
--manifest-name <MANIFEST_NAME> --manifest-description <MANIFEST_DESCRIPTION> | ||
``` | ||
|
||
Both methods of creating a manifest use the defaults created in `mbed dm init`. You can override each default using an input file or command-line arguments. See below for more details. | ||
|
||
Once you execute `mbed dm update prepare`, Mbed CLI automatically uploads to Mbed Cloud and you can then create and start an update campaign using the Mbed Cloud portal. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Device Management, Device Management Portal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A link to where we explain that (in the Pelion docs) would help massively. Also, it's not obvious that the commands you give me have nothing to do with the filter you sent me to create a second before. |
||
|
||
### Advanced usage | ||
Mbed CLI allows for significantly more flexibility than the model above shows in exactly the same way as Manifest Tool. You can override each of the defaults that `mbed dm init` sets by using the command-line or an input file. Mbed CLI supports a variety of commands. You can print a full list of commands by using `manifest-tool --help`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mbed CLI keeps its name as far as I'm aware. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also looks like in our manifest tool documentation, it's not capitalized, and instead referred to as "the manifest tool." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link to the tool's docs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seeing how this is the first mention of the manifest tool, I would provide a link to the tool's page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /docs/working/updating-firmware/manifest-tool.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mbed CLI doesn't take "the"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd also clarify that these are all the same command, that they're just aliases. I'd suggest something along these lines (but feel free to tweak):