diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e47cf6 --- /dev/null +++ b/README.md | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | meta-sota | ||
| 2 | ========= | ||
| 3 | |||
| 4 | This layer enables over-the-air updates with OSTree and RVI SOTA client. | ||
| 5 | |||
| 6 | [OSTree](https://github.com/ostreedev/ostree) is a tool for atomic full file | ||
| 7 | system upgrades with rollback capability. Main advantage of OSTree compared | ||
| 8 | to traditional dual partition model is that OSTree minimizes network bandwidth | ||
| 9 | and data storage footprint by sharing files with the same contents across file | ||
| 10 | system deployments. | ||
| 11 | |||
| 12 | [RVI SOTA client](https://github.com/advancedtelematic/rvi_sota_client) adds | ||
| 13 | authentication and provisioning capabilities to OTA and is integrated with | ||
| 14 | OSTree. | ||
| 15 | |||
| 16 | Build | ||
| 17 | ----- | ||
| 18 | |||
| 19 | With AGL you can just add agl-sota feature while configuring your build | ||
| 20 | environment as in | ||
| 21 | |||
| 22 | source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-appfw-smack agl-devel agl-sota | ||
| 23 | |||
| 24 | you can then just run | ||
| 25 | |||
| 26 | bitbake agl-demo-platform | ||
| 27 | |||
| 28 | and get as a result "ostree_repo" folder in your images directory | ||
| 29 | (tmp/deploy/images/${MACHINE}/ostree_repo) containing your OSTree repository | ||
| 30 | with rootfs committed as an OSTree deployment, 'otaimg' bootstrap image which | ||
| 31 | is an OSTree physical sysroot as a burnable filesystem image and optionally | ||
| 32 | some machine-dependent live images (e.g. '*.rpi-sdimg-ota' for Raspberry Pi or | ||
| 33 | '*.porter-sdimg-ota' Renesas Porter board). | ||
| 34 | |||
| 35 | Although aglsetup.sh hooks provide reasonable defaults for SOTA-related | ||
| 36 | variables you may want to tune some of them. | ||
| 37 | |||
| 38 | SOTA-related variables in local.conf | ||
| 39 | ------------------------------------ | ||
| 40 | |||
| 41 | * OSTREE_REPO - path to your OSTree repository. | ||
| 42 | Defaults to "${DEPLOY_DIR_IMAGE}/ostree_repo" | ||
| 43 | * OSTREE_BRANCHNAME - the branch your rootfs will be committed to. | ||
| 44 | Defaults to "agl-ota" | ||
| 45 | * OSTREE_OSNAME - OS deployment name on your target device. For more | ||
| 46 | information about deployments and osnames see | ||
| 47 | [OSTree documentation](https://ostree.readthedocs.io/en/latest/manual/deployment/) | ||
| 48 | Defaults to "agl". | ||
| 49 | * OSTREE_INITRAMFS_IMAGE - initramfs/initrd image that is used as a proxy while | ||
| 50 | booting into OSTree deployment. Do not change this setting unless you are | ||
| 51 | sure that your initramfs can serve as such proxy. | ||
| 52 | * OSTREE_REMOTE_URL - when set adds pushing your ostree commit to a remote | ||
| 53 | repo. Defaults to an empty string. | ||
| 54 | * OSTREE_REMOTE_USER and OSTREE_REMOTE_PASSWORD - should be set if | ||
| 55 | OSTREE_REMOTE_URL is set. Used to authenticate to the server set in | ||
| 56 | OSTREE_REMOTE_URL. Both default to an empty string. | ||
| 57 | |||
| 58 | Usage | ||
| 59 | ----- | ||
| 60 | |||
| 61 | ### OSTree ### | ||
| 62 | OSTree includes its own simple http server. It just exposes the whole OSTree | ||
| 63 | repository to the network so that any remote device can pull data from it to | ||
| 64 | device's local repository. To use OSTree http server you need OSTree installed | ||
| 65 | on your build machine. Alternatively, you could run version built inside Yocto | ||
| 66 | using bitbake's [devshell](http://www.openembedded.org/wiki/Devshell). | ||
| 67 | |||
| 68 | To expose your repo run ostree trivial-httpd using any free port. | ||
| 69 | |||
| 70 | ostree trivial-httpd tmp/deploy/images/qemux86-64/ostree_repo -P 57556 | ||
| 71 | |||
| 72 | You can then run from inside your device or QEMU emulation, provided your | ||
| 73 | network is set up correctly. | ||
| 74 | |||
| 75 | # agl-remote identifies the remote server in your local repo | ||
| 76 | ostree remote add --no-gpg-verify agl-remote http://192.168.7.1:57556 agl-ota | ||
| 77 | |||
| 78 | # agl-ota is a branch name in the remote repo, set in OSTREE_BRANCHNAME | ||
| 79 | ostree pull agl-remote agl-ota | ||
| 80 | |||
| 81 | # agl is OS name as set in OSTREE_OSNAME | ||
| 82 | ostree admin deploy --os=agl agl-remote:agl-ota | ||
| 83 | |||
| 84 | After restart you should boot into the newly deployed OS image. | ||
| 85 | |||
| 86 | E.g. for the raspberrypi3 you can try this sequence: | ||
| 87 | |||
| 88 | # add remote | ||
| 89 | ostree remote add --no-gpg-verify agl-snapshot https://download.automotivelinux.org/AGL/snapshots/master/latest/raspberrypi3/deploy/images/raspberrypi3/ostree_repo/ agl-ota | ||
| 90 | |||
| 91 | # pull | ||
| 92 | ostree pull agl-snapshot agl-ota | ||
| 93 | |||
| 94 | # deploy | ||
| 95 | ostree admin deploy --os=agl agl-snapshot:agl-ota | ||
| 96 | |||
| 97 | ### SOTA tools ### | ||
| 98 | SOTA tools now contains only one tool, garage-push that lets you push the | ||
| 99 | changes in OSTree repository generated by bitbake process. It communicates with | ||
| 100 | an http server capable of querying files with HEAD requests and uploading them | ||
| 101 | with POST requests. garage-push is used as following: | ||
| 102 | |||
| 103 | garage-push --repo=/path/to/ostree-repo --ref=mybranch --url=https://my.ostree.server/ --user=username --password=password | ||
| 104 | |||
| 105 | You can set OSTREE_REMOTE_URL, OSTREE_REMOTE_USER and OSTREE_REMOTE_PASSWORD in | ||
| 106 | your local.conf to make your build results be automatically synchronized with a | ||
| 107 | remote server. | ||
