From 0ccd10c27fbf94778553cea02f67d269df7c2854 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 16 Jan 2018 18:51:19 +0100 Subject: Deploy startup.nsh before composing flashable image Additionally don't create extra images to save space and not confuse the user --- classes/sota_minnowboard.bbclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/sota_minnowboard.bbclass b/classes/sota_minnowboard.bbclass index 8417348..63510e3 100644 --- a/classes/sota_minnowboard.bbclass +++ b/classes/sota_minnowboard.bbclass @@ -4,4 +4,7 @@ EFI_PROVIDER_sota = "grub-efi" WKS_FILE_sota = "efiimage-sota.wks" IMAGE_BOOT_FILES_sota = "" +IMAGE_FSTYPES_remove_sota = "live hddimg" OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" + +IMAGE_INSTALL_append = " minnowboard-efi-startup" -- cgit v1.2.3-54-g00ecf From 9e6d437d73aa990aff85d2cf456b77367be01920 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Fri, 19 Jan 2018 16:38:13 +0100 Subject: Deploy initial primary version information --- classes/image_types_ostree.bbclass | 4 +++- classes/image_types_ota.bbclass | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index cf2e52f..dcc376d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -12,6 +12,8 @@ IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ export OSTREE_REPO export OSTREE_BRANCHNAME +export GARAGE_TARGET_NAME + RAMDISK_EXT ?= ".ext4.gz" RAMDISK_EXT_arm ?= ".ext4.gz.u-boot" @@ -205,7 +207,7 @@ IMAGE_CMD_garagesign () { push_success=0 for push_retries in $( seq 3 ); do garage-sign targets pull --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} - garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${OSTREE_BRANCHNAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} + garage-sign targets add --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --name ${GARAGE_TARGET_NAME} --format OSTREE --version ${ostree_target_hash} --length 0 --url "https://example.com/" --sha256 ${ostree_target_hash} --hardwareids ${MACHINE} garage-sign targets sign --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} --key-name=targets errcode=0 garage-sign targets push --repo tufrepo --home-dir ${GARAGE_SIGN_REPO} || errcode=$? diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 5dc4811..be9a017 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -53,6 +53,8 @@ export OSTREE_BRANCHNAME export OSTREE_REPO export OSTREE_BOOTLOADER +export GARAGE_TARGET_NAME + IMAGE_CMD_otaimg () { if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then if [ -z "$OSTREE_REPO" ]; then @@ -106,6 +108,9 @@ IMAGE_CMD_otaimg () { mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local + # Set package version for the first deployment + echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${ostree_target_hash}\"}" > ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/installed_versions + rm -rf ${HOME_TMP} # Calculate image type -- cgit v1.2.3-54-g00ecf From fbfdf91079a93b446a7502851ab9508b38146eef Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 18 Jan 2018 12:36:21 +0100 Subject: Add PR = "1" to ostree to fix annoying caching problem. --- recipes-sota/ostree/ostree_git.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 00559b6..ad85775 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb @@ -11,6 +11,7 @@ SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" SRCREV="854a823e05d6fe8b610c02c2a71eaeb2bf1e98a6" PV = "v2017.13" +PR = "1" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From bb25b4540fbe15fbc638087e8e7b86939c65db85 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Fri, 19 Jan 2018 17:02:27 +0100 Subject: Rename all instances of hsm-test and use latest aktualizr. --- README.adoc | 2 +- recipes-sota/aktualizr/aktualizr-hsm-prov.bb | 31 +++++++++++++++++++++++ recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb | 31 ----------------------- recipes-sota/aktualizr/aktualizr_git.bb | 4 +-- 4 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 recipes-sota/aktualizr/aktualizr-hsm-prov.bb delete mode 100644 recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb diff --git a/README.adoc b/README.adoc index e82b904..fbd3239 100644 --- a/README.adoc +++ b/README.adoc @@ -69,7 +69,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w * `OSTREE_OSNAME` - OS deployment name on your target device. For more information about deployments and osnames see the https://ostree.readthedocs.io/en/latest/manual/deployment/[OSTree documentation]. Defaults to "poky". * `OSTREE_INITRAMFS_IMAGE` - initramfs/initrd image that is used as a proxy while booting into OSTree deployment. Do not change this setting unless you are sure that your initramfs can serve as such a proxy. * `SOTA_PACKED_CREDENTIALS` - when set, your ostree commit will be pushed to a remote repo as a bitbake step. This should be the path to a zipped credentials file in https://github.com/advancedtelematic/aktualizr/blob/master/docs/credentials.adoc[the format accepted by garage-push]. -* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are https://github.com/advancedtelematic/aktualizr/blob/master/docs/automatic-provisioning.adoc[`aktualizr-auto-prov`], https://github.com/advancedtelematic/aktualizr/blob/master/docs/implicit-provisioning.adoc[`aktualizr-implicit-prov`], and `aktualizr-hsm-test-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. +* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are https://github.com/advancedtelematic/aktualizr/blob/master/docs/automatic-provisioning.adoc[`aktualizr-auto-prov`], https://github.com/advancedtelematic/aktualizr/blob/master/docs/implicit-provisioning.adoc[`aktualizr-implicit-prov`], and `aktualizr-hsm-prov`. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. * `SOTA_CLIENT_FEATURES` - extensions to aktualizr. Multiple can be specified if separated by spaces. Valid options are `hsm` (to build with HSM support) and `secondary-example` (to install an example https://github.com/advancedtelematic/aktualizr/blob/master/docs/legacysecondary.adoc[legacy secondary interface] in the image). * `SOTA_LEGACY_SECONDARY_INTERFACE` - path to a legacy secondary interface installed on the device. To use the example interface from the Aktualizr repo, use `/usr/bin/example-interface` and make sure `SOTA_CLIENT_FEATURES = "secondary-example"`. * `SOTA_SECONDARY_ECUS` - a list of paths separated by spaces of JSON configuration files for virtual secondaries on the host. These will be installed into `/var/sota/ecus` on the device. diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb new file mode 100644 index 0000000..944607c --- /dev/null +++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb @@ -0,0 +1,31 @@ +SUMMARY = "Aktualizr configuration with HSM support" +DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" +HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" +SECTION = "base" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" + +DEPENDS = "aktualizr-native" +RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" + +SRC_URI = " \ + file://LICENSE \ + " +PV = "1.0" +PR = "6" + + +require environment.inc +require credentials.inc + +do_install() { + install -d ${D}${libdir}/sota + aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ + -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_prov.toml -o ${D}${libdir}/sota/sota.toml -p ${D} +} + +FILES_${PN} = " \ + ${libdir}/sota/sota.toml \ + " + +# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb deleted file mode 100644 index 1e893fa..0000000 --- a/recipes-sota/aktualizr/aktualizr-hsm-test-prov.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "Aktualizr configuration with HSM support" -DESCRIPTION = "Systemd service and configurations for Aktualizr, the SOTA Client application written in C++" -HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" -SECTION = "base" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" - -DEPENDS = "aktualizr-native" -RDEPENDS_${PN} = "aktualizr softhsm softhsm-testtoken" - -SRC_URI = " \ - file://LICENSE \ - " -PV = "1.0" -PR = "6" - - -require environment.inc -require credentials.inc - -do_install() { - install -d ${D}${libdir}/sota - aktualizr_implicit_writer -c ${SOTA_PACKED_CREDENTIALS} --no-root-ca \ - -i ${STAGING_DIR_NATIVE}${libdir}/sota/sota_hsm_test.toml -o ${D}${libdir}/sota/sota.toml -p ${D} -} - -FILES_${PN} = " \ - ${libdir}/sota/sota.toml \ - " - -# vim:set ts=4 sw=4 sts=4 expandtab: diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 3925922..67ec104 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -21,7 +21,7 @@ SRC_URI = " \ file://aktualizr.service \ file://aktualizr-serialcan.service \ " -SRCREV = "37fbf0dfd88d42d76301890818dc4e83b35d9fa4" +SRCREV = "07d73645231681848bd943074498581e930d8582" BRANCH ?= "master" S = "${WORKDIR}/git" @@ -58,7 +58,7 @@ do_install_append_class-native () { rm -f ${D}${bindir}/example-interface install -d ${D}${libdir}/sota install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml - install -m 0644 ${S}/config/sota_hsm_test.toml ${D}/${libdir}/sota/sota_hsm_test.toml + install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir} -- cgit v1.2.3-54-g00ecf