Skip to main content

Bort CLI

Bort CLI is a command-line utility for preparing the AOSP integration, validating the AOSP build, and sending commands to the connected device for the purposes of the Memfault SDK integration.

Useful links:

Basic Usage

Running bort_cli.py --help shows the available commands:

Usage: bort_cli.py <command> [<args>]

Commands:
patch-aosp Apply Memfault's optional patches to the AOSP repository
patch-bort Configure Bort application IDs and feature names in the AOSP repository
validate-sdk-integration
Validate the SDK integration on a connected device
request-bug-report Request an immediate bug report from a connected device
request-metrics Request a metrics collection from a connected device
request-update-config Request the latest device configuration from a connected device
enable-bort Enable Bort SDK operation from a connected device
ota-check Request an OTA update check from a connected device
dev-mode Enable or disable developer mode from a connected device
generate-keystore Generate a keystore for signing the Bort APKs in the AOSP repository

Commands

patch-aosp

Apply Memfault's optional patches to the AOSP repository

Usage: bort_cli.py patch-aosp [-h] --android-release {8,9,10,11,12,13,14,15}
[--check-patch-command CHECK_PATCH_COMMAND]
[--apply-patch-command APPLY_PATCH_COMMAND]
[--force] [--exclude EXCLUDE]
[--patch-dir PATCH_DIR]
aosp_root

Options:
aosp_root The path of the checked out AOSP repository
--android-release Android platform version
--check-patch-command Command to check whether patch is applied
--apply-patch-command Command to apply patch
--force Apply patch, even when already applied
--exclude Directories to exclude from patching
--patch-dir Directory containing versioned patches to apply

patch-bort

Configure Bort application IDs and feature names in the AOSP repository

Usage: bort_cli.py patch-bort [-h] --bort-app-id BORT_APP_ID
[--bort-ota-app-id BORT_OTA_APP_ID]
[--vendor-feature-name VENDOR_FEATURE_NAME]
path

Options:
path The path to the MemfaultPackages folder from the SDK
--bort-app-id Application ID for the main Bort application
--bort-ota-app-id Application ID for the Bort OTA application
--vendor-feature-name Custom feature name (defaults to bort-app-id)

validate-sdk-integration

Validate the SDK integration on a connected device. This command checks if the integration was most likely successful, by checking:

  • File permissions and SELinux contexts
  • Application installations and permissions
  • Package versions
  • Idle whitelist status
  • Bort internal diagnostics
  • WorkManager Jobs
Usage: bort_cli.py validate-sdk-integration [-h] --bort-app-id BORT_APP_ID
[--bort-ota-app-id BORT_OTA_APP_ID]
[--device DEVICE]
[--vendor-feature-name VENDOR_FEATURE_NAME]
[--ignore-enabled]

Options:
--bort-app-id Application ID for the main Bort application
--bort-ota-app-id Application ID for the Bort OTA application
--device Optional device ID passed to ADB's `-s` flag
--vendor-feature-name Custom feature name
--ignore-enabled Skip checking if Bort is enabled

request-bug-report

Request an immediate bug report from a connected device

Usage: bort_cli.py request-bug-report [-h] --bort-app-id BORT_APP_ID
[--device DEVICE]

Options:
--bort-app-id Application ID for the main Bort application
--device Optional device ID passed to ADB's `-s` flag

request-metrics

Request a metrics collection from a connected device

Usage: bort_cli.py request-metrics [-h] --bort-app-id BORT_APP_ID
[--device DEVICE]

Options:
--bort-app-id Application ID for the main Bort application
--device Optional device ID passed to ADB's `-s` flag

request-update-config

Request the latest device configuration from a connected device

Usage: bort_cli.py request-update-config [-h] --bort-app-id BORT_APP_ID
[--device DEVICE]

Options:
--bort-app-id Application ID for the main Bort application
--device Optional device ID passed to ADB's `-s` flag

enable-bort

Enable Bort SDK operation from a connected device

Usage: bort_cli.py enable-bort [-h] --bort-app-id BORT_APP_ID
[--device DEVICE]

Options:
--bort-app-id Application ID for the main Bort application
--device Optional device ID passed to ADB's `-s` flag

ota-check

Request an OTA update check from a connected device

Usage: bort_cli.py ota-check [-h] --bort-ota-app-id BORT_OTA_APP_ID
[--device DEVICE]

Options:
--bort-ota-app-id Application ID for the Bort OTA application
--device Optional device ID passed to ADB's `-s` flag

dev-mode

Enable or disable developer mode from a connected device

Usage: bort_cli.py dev-mode [-h] --bort-app-id BORT_APP_ID
--enabled {true,false}
[--device DEVICE]

Options:
--bort-app-id Application ID for the main Bort application
--enabled Enable or disable developer mode
--device Optional device ID passed to ADB's `-s` flag

generate-keystore

Generate a keystore for signing the Bort APKs in the AOSP repository

Usage: bort_cli.py generate-keystore [-h] [--keytool-path KEYTOOL_PATH]
[--ota-keystore] --password PASSWORD
path

Options:
path The path to the MemfaultPackages folder from the SDK
--keytool-path Path to the Java Keytool binary
--ota-keystore Generates a keystore for the OTA application
--password Password for the keystore and key