summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md107
-rw-r--r--classes/image_types_ostree.bbclass19
-rw-r--r--recipes-sota/sota-tools/sota-tools_git.bb24
3 files changed, 150 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 @@
1meta-sota
2=========
3
4This 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
7system upgrades with rollback capability. Main advantage of OSTree compared
8to traditional dual partition model is that OSTree minimizes network bandwidth
9and data storage footprint by sharing files with the same contents across file
10system deployments.
11
12[RVI SOTA client](https://github.com/advancedtelematic/rvi_sota_client) adds
13authentication and provisioning capabilities to OTA and is integrated with
14OSTree.
15
16Build
17-----
18
19With AGL you can just add agl-sota feature while configuring your build
20environment as in
21
22 source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-appfw-smack agl-devel agl-sota
23
24you can then just run
25
26 bitbake agl-demo-platform
27
28and get as a result "ostree_repo" folder in your images directory
29(tmp/deploy/images/${MACHINE}/ostree_repo) containing your OSTree repository
30with rootfs committed as an OSTree deployment, 'otaimg' bootstrap image which
31is an OSTree physical sysroot as a burnable filesystem image and optionally
32some machine-dependent live images (e.g. '*.rpi-sdimg-ota' for Raspberry Pi or
33'*.porter-sdimg-ota' Renesas Porter board).
34
35Although aglsetup.sh hooks provide reasonable defaults for SOTA-related
36variables you may want to tune some of them.
37
38SOTA-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
58Usage
59-----
60
61### OSTree ###
62OSTree includes its own simple http server. It just exposes the whole OSTree
63repository to the network so that any remote device can pull data from it to
64device's local repository. To use OSTree http server you need OSTree installed
65on your build machine. Alternatively, you could run version built inside Yocto
66using bitbake's [devshell](http://www.openembedded.org/wiki/Devshell).
67
68To 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
72You can then run from inside your device or QEMU emulation, provided your
73network 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
84After restart you should boot into the newly deployed OS image.
85
86E.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 ###
98SOTA tools now contains only one tool, garage-push that lets you push the
99changes in OSTree repository generated by bitbake process. It communicates with
100an http server capable of querying files with HEAD requests and uploading them
101with 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
105You can set OSTREE_REMOTE_URL, OSTREE_REMOTE_USER and OSTREE_REMOTE_PASSWORD in
106your local.conf to make your build results be automatically synchronized with a
107remote server.
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index fcba6d9..453692e 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -124,3 +124,22 @@ IMAGE_CMD_ostree () {
124 rm -rf ${OSTREE_ROOTFS} 124 rm -rf ${OSTREE_ROOTFS}
125} 125}
126 126
127IMAGE_TYPEDEP_ostreepush = "ostree"
128IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot"
129IMAGE_CMD_ostreepush () {
130 if [ ${OSTREE_REMOTE_URL} ]; then
131 if [ -z ${OSTREE_REMOTE_USER} ]; then
132 bberror "OSTREE_REMOTE_PASSWORD isn't set"
133 fi
134
135 if [ -z ${OSTREE_REMOTE_PASSWORD} ]; then
136 bberror "OSTREE_REMOTE_PASSWORD isn't set"
137 fi
138
139 garage-push --repo=${OSTREE_REPO} \
140 --ref=${OSTREE_BRANCHNAME} \
141 --url=${OSTREE_REMOTE_URL} \
142 --user=${OSTREE_REMOTE_USER} \
143 --password=${OSTREE_REMOTE_PASSWORD}
144 fi
145}
diff --git a/recipes-sota/sota-tools/sota-tools_git.bb b/recipes-sota/sota-tools/sota-tools_git.bb
new file mode 100644
index 0000000..acd8e4a
--- /dev/null
+++ b/recipes-sota/sota-tools/sota-tools_git.bb
@@ -0,0 +1,24 @@
1DESCRIPTION = "Utility to push data to a server"
2LICENSE = "MPL-2.0"
3
4LIC_FILES_CHKSUM = "file://LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
5
6S = "${WORKDIR}/git"
7
8SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master"
9SRCREV = "7ff1d92c161ba4fb047a1e1e4cba5424b4adca00"
10
11inherit cmake
12
13DEPENDS = "boost"
14
15BBCLASSEXTEND = "native"
16
17FILES_${PN} = "${bindir}/garage-push"
18
19EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF"
20
21do_install() {
22 install -d ${D}/${bindir}
23 install -m 755 garage-push ${D}/${bindir}
24}