diff options
-rw-r--r-- | README.adoc | 5 | ||||
-rw-r--r-- | classes/sota_raspberrypi.bbclass | 15 | ||||
-rw-r--r-- | conf/distro/sota.conf.inc | 6 | ||||
-rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 96 | ||||
-rw-r--r-- | recipes-sota/fit-conf/fit-conf.bb | 22 |
5 files changed, 90 insertions, 54 deletions
diff --git a/README.adoc b/README.adoc index ea9bb21..27ecabf 100644 --- a/README.adoc +++ b/README.adoc | |||
@@ -81,6 +81,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w | |||
81 | * `OSTREE_COMMIT_BODY` - Message attached to OSTree commit. Empty by default. | 81 | * `OSTREE_COMMIT_BODY` - Message attached to OSTree commit. Empty by default. |
82 | * `OSTREE_COMMIT_SUBJECT` - Commit subject used by OSTree. Defaults to `Commit-id: ${IMAGE_NAME}` | 82 | * `OSTREE_COMMIT_SUBJECT` - Commit subject used by OSTree. Defaults to `Commit-id: ${IMAGE_NAME}` |
83 | * `OSTREE_UPDATE_SUMMARY` - Set this to '1' to update summary of OSTree repository on each commit. '0' by default. | 83 | * `OSTREE_UPDATE_SUMMARY` - Set this to '1' to update summary of OSTree repository on each commit. '0' by default. |
84 | * `OSTREE_DEPLOY_DEVICETREE` - Set this to '1' to include devicetree(s) to boot | ||
84 | * `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. | 85 | * `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. |
85 | * `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]. | 86 | * `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]. |
86 | * `SOTA_DEPLOY_CREDENTIALS` - when set to '1' (default value), deploys credentials to the built image. Override it in `local.conf` to built a generic image that can be provisioned manually after the build. | 87 | * `SOTA_DEPLOY_CREDENTIALS` - when set to '1' (default value), deploys credentials to the built image. Override it in `local.conf` to built a generic image that can be provisioned manually after the build. |
@@ -88,7 +89,9 @@ Although we have used U-Boot so far, other boot loaders can be configured work w | |||
88 | * `SOTA_CLIENT_FEATURES` - extensions to aktualizr. The only valid options are `hsm` (to build with HSM support) and `secondary-network` (to set up a simulated 'in-vehicle' network with support for a primary node with a DHCP server and a secondary node with a DHCP client). | 89 | * `SOTA_CLIENT_FEATURES` - extensions to aktualizr. The only valid options are `hsm` (to build with HSM support) and `secondary-network` (to set up a simulated 'in-vehicle' network with support for a primary node with a DHCP server and a secondary node with a DHCP client). |
89 | * `SOTA_SECONDARY_CONFIG_DIR` - a directory containing JSON configuration files for virtual secondaries on the host. These will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr. | 90 | * `SOTA_SECONDARY_CONFIG_DIR` - a directory containing JSON configuration files for virtual secondaries on the host. These will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr. |
90 | * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. | 91 | * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. |
91 | * `OSTREE_DEPLOY_DEVICETREE` - Set this to '1' to include devicetree(s) to boot | 92 | * `SOTA_MAIN_DTB` - base device tree to use with the kernel. Used together with FIT images. You can change it, and the device tree will also be changed after the update. |
93 | * `SOTA_DT_OVERLAYS` - whitespace-separated list of used device tree overlays for FIT image. This list is OSTree-updateable as well. | ||
94 | * `SOTA_EXTRA_CONF_FRAGS` - extra https://lxr.missinglinkelectronics.com/uboot/doc/uImage.FIT/overlay-fdt-boot.txt[configuration fragments] for FIT image. | ||
92 | 95 | ||
93 | == Usage | 96 | == Usage |
94 | 97 | ||
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 600f9e9..e1c0054 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass | |||
@@ -5,6 +5,13 @@ KERNEL_IMAGETYPE_sota = "fitImage" | |||
5 | INITRAMFS_FSTYPES = "cpio.gz" | 5 | INITRAMFS_FSTYPES = "cpio.gz" |
6 | OSTREE_KERNEL = "${KERNEL_IMAGETYPE}-${INITRAMFS_IMAGE}-${MACHINE}-${KERNEL_FIT_LINK_NAME}" | 6 | OSTREE_KERNEL = "${KERNEL_IMAGETYPE}-${INITRAMFS_IMAGE}-${MACHINE}-${KERNEL_FIT_LINK_NAME}" |
7 | 7 | ||
8 | # DTB needs to be relocated to apply overlays | ||
9 | UBOOT_DTB_LOADADDRESS = "0x05000000" | ||
10 | UBOOT_DTBO_LOADADDRESS = "0x06000000" | ||
11 | |||
12 | # Deploy config fragment list to OSTree root fs | ||
13 | IMAGE_INSTALL_append = " fit-conf" | ||
14 | |||
8 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" | 15 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" |
9 | UBOOT_ENTRYPOINT_sota ?= "0x00008000" | 16 | UBOOT_ENTRYPOINT_sota ?= "0x00008000" |
10 | 17 | ||
@@ -18,7 +25,13 @@ IMAGE_BOOT_FILES_sota = "bcm2835-bootfiles/* u-boot.bin;${SDIMG_KERNELIMAGE}" | |||
18 | KERNEL_DEVICETREE_raspberrypi2_sota ?= " bcm2709-rpi-2-b.dtb " | 25 | KERNEL_DEVICETREE_raspberrypi2_sota ?= " bcm2709-rpi-2-b.dtb " |
19 | KERNEL_DEVICETREE_raspberrypi3_sota ?= " bcm2710-rpi-3-b.dtb overlays/vc4-kms-v3d.dtbo overlays/rpi-ft5406.dtbo" | 26 | KERNEL_DEVICETREE_raspberrypi3_sota ?= " bcm2710-rpi-3-b.dtb overlays/vc4-kms-v3d.dtbo overlays/rpi-ft5406.dtbo" |
20 | 27 | ||
28 | SOTA_MAIN_DTB_raspberrypi2 ?= "bcm2709-rpi-2-b.dtb" | ||
29 | SOTA_MAIN_DTB_raspberrypi3 ?= "bcm2710-rpi-3-b.dtb" | ||
30 | |||
31 | SOTA_DT_OVERLAYS_raspberrypi3 ?= "vc4-kms-v3d.dtbo rpi-ft5406.dtbo" | ||
32 | |||
21 | # Kernel args normally provided by RPi's internal bootloader. Non-updateable | 33 | # Kernel args normally provided by RPi's internal bootloader. Non-updateable |
22 | OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " | 34 | OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=614 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " |
23 | 35 | ||
24 | SOTA_CLIENT_FEATURES_append = " ubootenv" | 36 | SOTA_CLIENT_FEATURES_append = " ubootenv" |
37 | |||
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 8de9597..f6111bf 100644 --- a/conf/distro/sota.conf.inc +++ b/conf/distro/sota.conf.inc | |||
@@ -10,4 +10,10 @@ INHERIT += " sota" | |||
10 | # Prelinking increases the size of downloads and causes build errors | 10 | # Prelinking increases the size of downloads and causes build errors |
11 | USER_CLASSES_remove = "image-prelink" | 11 | USER_CLASSES_remove = "image-prelink" |
12 | 12 | ||
13 | # Enable reproducible builds. Use 0 as mtime, the same as OSTree is using. | ||
14 | INHERIT += "reproducible_build_simple" | ||
15 | |||
16 | export SOURCE_DATE_EPOCH ?= "0" | ||
17 | REPRODUCIBLE_TIMESTAMP_ROOTFS ?= "0" | ||
18 | |||
13 | HOSTTOOLS_append = " sync sha256sum" | 19 | HOSTTOOLS_append = " sync sha256sum" |
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index eb65ae0..fbc1bca 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -5,16 +5,12 @@ SECTION = "base" | |||
5 | LICENSE = "MPL-2.0" | 5 | LICENSE = "MPL-2.0" |
6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" | 6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" |
7 | 7 | ||
8 | DEPENDS = "boost curl openssl libarchive libsodium asn1c-native sqlite3 " | 8 | require garage-sign-version.inc |
9 | DEPENDS_append_class-target = "ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} " | ||
10 | DEPENDS_append_class-native = "glib-2.0-native " | ||
11 | |||
12 | RDEPENDS_${PN}_class-target = "lshw " | ||
13 | RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', ' slcand-start', '', d)} " | ||
14 | RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' u-boot-fw-utils aktualizr-uboot-env-rollback', '', d)} " | ||
15 | 9 | ||
16 | RDEPENDS_${PN}_append_class-target = " ${PN}-tools " | 10 | DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" |
17 | RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " | 11 | RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" |
12 | RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" | ||
13 | RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" | ||
18 | 14 | ||
19 | PV = "1.0+git${SRCPV}" | 15 | PV = "1.0+git${SRCPV}" |
20 | PR = "7" | 16 | PR = "7" |
@@ -32,29 +28,28 @@ BRANCH ?= "master" | |||
32 | 28 | ||
33 | S = "${WORKDIR}/git" | 29 | S = "${WORKDIR}/git" |
34 | 30 | ||
35 | inherit cmake | 31 | inherit pkgconfig cmake systemd |
36 | |||
37 | inherit systemd | ||
38 | 32 | ||
39 | SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" | 33 | SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" |
40 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" | 34 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" |
41 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" | 35 | SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" |
42 | 36 | ||
43 | BBCLASSEXTEND =+ "native" | 37 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" |
44 | 38 | ||
45 | require garage-sign-version.inc | 39 | GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ |
40 | ${@ '-DGARAGE_SIGN_SHA256=%s' % d.getVar('GARAGE_SIGN_SHA256') if d.getVar('GARAGE_SIGN_SHA256') is not None else ''} \ | ||
41 | " | ||
46 | 42 | ||
47 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \ | 43 | PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" |
48 | -DCMAKE_BUILD_TYPE=Release \ | 44 | PACKAGECONFIG_class-native = "sota-tools" |
49 | -DAKTUALIZR_VERSION=${PV} \ | 45 | PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF," |
50 | -DBUILD_LOAD_TESTS=OFF" | 46 | PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," |
51 | EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON \ | 47 | PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," |
52 | ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " | 48 | PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," |
53 | EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON \ | 49 | PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd," |
54 | -DBUILD_OSTREE=OFF \ | 50 | PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," |
55 | -DBUILD_SYSTEMD=OFF \ | 51 | PACKAGECONFIG[serialcan] = ",,,slcand-start" |
56 | -DGARAGE_SIGN_VERSION=${GARAGE_SIGN_VERSION} \ | 52 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" |
57 | -DGARAGE_SIGN_SHA256=${GARAGE_SIGN_SHA256}" | ||
58 | 53 | ||
59 | do_install_append () { | 54 | do_install_append () { |
60 | install -d ${D}${libdir}/sota | 55 | install -d ${D}${libdir}/sota |
@@ -84,49 +79,45 @@ do_install_append () { | |||
84 | fi | 79 | fi |
85 | fi | 80 | fi |
86 | 81 | ||
87 | } | ||
88 | |||
89 | do_install_append_class-target () { | ||
90 | install -m 0755 -d ${D}${systemd_unitdir}/system | 82 | install -m 0755 -d ${D}${systemd_unitdir}/system |
91 | aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} | 83 | aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} |
92 | install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service | 84 | install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service |
85 | |||
86 | if ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'true', 'false', d)}; then | ||
87 | install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} | ||
88 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} | ||
89 | fi | ||
93 | } | 90 | } |
94 | 91 | ||
95 | do_install_append_class-native () { | 92 | PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " |
96 | install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} | 93 | |
97 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} | 94 | python split_hosttools_packages () { |
95 | bindir = d.getVar('bindir') | ||
96 | |||
97 | # Split all binaries to their own packages except aktualizr-info, | ||
98 | # aktualizr-info should stay in main package aktualizr. | ||
99 | do_split_packages(d, bindir, r'^((?!(aktualizr-info)).*)$', '%s', 'Aktualizr tool - %s', extra_depends='aktualizr-configs', prepend=False) | ||
98 | } | 100 | } |
99 | 101 | ||
100 | PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " | 102 | PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" |
103 | |||
104 | PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" | ||
105 | |||
106 | ALLOW_EMPTY_${PN}-host-tools = "1" | ||
101 | 107 | ||
102 | FILES_${PN} = " \ | 108 | FILES_${PN} = " \ |
103 | ${bindir}/aktualizr \ | 109 | ${bindir}/aktualizr \ |
104 | ${bindir}/aktualizr-info \ | 110 | ${bindir}/aktualizr-info \ |
105 | ${bindir}/aktualizr-check-discovery \ | ||
106 | ${systemd_unitdir}/system/aktualizr.service \ | 111 | ${systemd_unitdir}/system/aktualizr.service \ |
107 | ${libdir}/sota/conf.d \ | ||
108 | ${sysconfdir}/sota/conf.d \ | ||
109 | ${sysconfdir}/sota/ecus/* \ | ||
110 | " | 112 | " |
111 | 113 | ||
112 | FILES_${PN}-examples = " \ | 114 | FILES_${PN}-configs = " \ |
113 | ${bindir}/hmi-stub \ | 115 | ${sysconfdir}/sota/* \ |
116 | ${libdir}/sota/* \ | ||
114 | " | 117 | " |
115 | 118 | ||
116 | FILES_${PN}-host-tools = " \ | 119 | FILES_${PN}-examples = " \ |
117 | ${bindir}/aktualizr-repo \ | 120 | ${bindir}/hmi-stub \ |
118 | ${bindir}/aktualizr-cert-provider \ | ||
119 | ${bindir}/garage-deploy \ | ||
120 | ${bindir}/garage-push \ | ||
121 | ${libdir}/sota/sota_autoprov.toml \ | ||
122 | ${libdir}/sota/sota_autoprov_primary.toml \ | ||
123 | ${libdir}/sota/sota_hsm_prov.toml \ | ||
124 | ${libdir}/sota/sota_implicit_prov_ca.toml \ | ||
125 | ${libdir}/sota/sota_uboot_env.toml \ | ||
126 | " | ||
127 | |||
128 | FILES_${PN}-tools = " \ | ||
129 | ${bindir}/aktualizr-check-discovery \ | ||
130 | " | 121 | " |
131 | 122 | ||
132 | FILES_${PN}-secondary = " \ | 123 | FILES_${PN}-secondary = " \ |
@@ -135,5 +126,6 @@ FILES_${PN}-secondary = " \ | |||
135 | ${systemd_unitdir}/system/aktualizr-secondary.socket \ | 126 | ${systemd_unitdir}/system/aktualizr-secondary.socket \ |
136 | ${systemd_unitdir}/system/aktualizr-secondary.service \ | 127 | ${systemd_unitdir}/system/aktualizr-secondary.service \ |
137 | " | 128 | " |
129 | BBCLASSEXTEND = "native" | ||
138 | 130 | ||
139 | # vim:set ts=4 sw=4 sts=4 expandtab: | 131 | # vim:set ts=4 sw=4 sts=4 expandtab: |
diff --git a/recipes-sota/fit-conf/fit-conf.bb b/recipes-sota/fit-conf/fit-conf.bb new file mode 100644 index 0000000..c6cecec --- /dev/null +++ b/recipes-sota/fit-conf/fit-conf.bb | |||
@@ -0,0 +1,22 @@ | |||
1 | SUMMARY = "FIT image configuration for u-boot to use" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | |||
5 | do_install() { | ||
6 | mkdir -p ${D}${libdir} | ||
7 | echo -n "fit_conf=" >${D}${libdir}/fit_conf | ||
8 | |||
9 | if [ -n ${SOTA_MAIN_DTB} ]; then | ||
10 | echo -n "#conf@${SOTA_MAIN_DTB}" >> ${D}${libdir}/fit_conf | ||
11 | fi | ||
12 | |||
13 | for ovrl in ${SOTA_DT_OVERLAYS}; do | ||
14 | echo -n "#conf@overlays_${ovrl}" >> ${D}${libdir}/fit_conf | ||
15 | done | ||
16 | |||
17 | for conf_frag in ${SOTA_EXTRA_CONF_FRAGS}; do | ||
18 | echo -n "#${conf_frag}" >> ${D}${libdir}/fit_conf | ||
19 | done | ||
20 | } | ||
21 | |||
22 | FILES_${PN} += "${libdir}/fit_conf" | ||