diff options
-rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 26 | ||||
-rw-r--r-- | recipes-sota/aktualizr/files/10-resource-control.conf | 6 |
2 files changed, 31 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 49c4e5e..f2f62b5 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -25,6 +25,7 @@ SRC_URI = " \ | |||
25 | file://aktualizr-secondary.service \ | 25 | file://aktualizr-secondary.service \ |
26 | file://aktualizr-secondary.socket \ | 26 | file://aktualizr-secondary.socket \ |
27 | file://aktualizr-serialcan.service \ | 27 | file://aktualizr-serialcan.service \ |
28 | file://10-resource-control.conf \ | ||
28 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ | 29 | ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \ |
29 | " | 30 | " |
30 | 31 | ||
@@ -62,6 +63,15 @@ PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," | |||
62 | PACKAGECONFIG[serialcan] = ",,,slcand-start" | 63 | PACKAGECONFIG[serialcan] = ",,,slcand-start" |
63 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" | 64 | PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" |
64 | 65 | ||
66 | # can be overriden in configuration with `RESOURCE_xxx_pn-aktualizr` | ||
67 | # see `man systemd.resource-control` for details | ||
68 | |||
69 | # can be used to lower aktualizr priority, default is 100 | ||
70 | RESOURCE_CPU_WEIGHT = "100" | ||
71 | # will be slowed down when it reaches 'high', killed when it reaches 'max' | ||
72 | RESOURCE_MEMORY_HIGH = "100M" | ||
73 | RESOURCE_MEMORY_MAX = "80%" | ||
74 | |||
65 | do_compile_ptest() { | 75 | do_compile_ptest() { |
66 | cmake_runcmake_build --target build_tests | 76 | cmake_runcmake_build --target build_tests |
67 | } | 77 | } |
@@ -118,6 +128,15 @@ do_install_append () { | |||
118 | install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} | 128 | install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} |
119 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} | 129 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} |
120 | fi | 130 | fi |
131 | |||
132 | # resource control | ||
133 | install -d ${D}/${systemd_system_unitdir}/aktualizr.service.d | ||
134 | install -m 0644 ${WORKDIR}/10-resource-control.conf ${D}/${systemd_system_unitdir}/aktualizr.service.d | ||
135 | |||
136 | sed -i -e 's|@CPU_WEIGHT@|${RESOURCE_CPU_WEIGHT}|g' \ | ||
137 | -e 's|@MEMORY_HIGH@|${RESOURCE_MEMORY_HIGH}|g' \ | ||
138 | -e 's|@MEMORY_MAX@|${RESOURCE_MEMORY_MAX}|g' \ | ||
139 | ${D}${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf | ||
121 | } | 140 | } |
122 | 141 | ||
123 | PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " | 142 | PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " |
@@ -132,7 +151,7 @@ python split_hosttools_packages () { | |||
132 | 151 | ||
133 | PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" | 152 | PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" |
134 | 153 | ||
135 | PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" | 154 | PACKAGES =+ "${PN}-resource-control ${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" |
136 | 155 | ||
137 | ALLOW_EMPTY_${PN}-host-tools = "1" | 156 | ALLOW_EMPTY_${PN}-host-tools = "1" |
138 | 157 | ||
@@ -142,6 +161,10 @@ FILES_${PN} = " \ | |||
142 | ${systemd_unitdir}/system/aktualizr.service \ | 161 | ${systemd_unitdir}/system/aktualizr.service \ |
143 | " | 162 | " |
144 | 163 | ||
164 | FILES_${PN}-resource-control = " \ | ||
165 | ${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf \ | ||
166 | " | ||
167 | |||
145 | FILES_${PN}-configs = " \ | 168 | FILES_${PN}-configs = " \ |
146 | ${sysconfdir}/sota/* \ | 169 | ${sysconfdir}/sota/* \ |
147 | ${libdir}/sota/* \ | 170 | ${libdir}/sota/* \ |
@@ -157,6 +180,7 @@ FILES_${PN}-secondary = " \ | |||
157 | ${systemd_unitdir}/system/aktualizr-secondary.socket \ | 180 | ${systemd_unitdir}/system/aktualizr-secondary.socket \ |
158 | ${systemd_unitdir}/system/aktualizr-secondary.service \ | 181 | ${systemd_unitdir}/system/aktualizr-secondary.service \ |
159 | " | 182 | " |
183 | |||
160 | BBCLASSEXTEND = "native" | 184 | BBCLASSEXTEND = "native" |
161 | 185 | ||
162 | # vim:set ts=4 sw=4 sts=4 expandtab: | 186 | # vim:set ts=4 sw=4 sts=4 expandtab: |
diff --git a/recipes-sota/aktualizr/files/10-resource-control.conf b/recipes-sota/aktualizr/files/10-resource-control.conf new file mode 100644 index 0000000..254713c --- /dev/null +++ b/recipes-sota/aktualizr/files/10-resource-control.conf | |||
@@ -0,0 +1,6 @@ | |||
1 | [Service] | ||
2 | CPUAccounting=true | ||
3 | CPUWeight=@CPU_WEIGHT@ | ||
4 | MemoryAccounting=true | ||
5 | MemoryHigh=@MEMORY_HIGH@ | ||
6 | MemoryMax=@MEMORY_MAX@ | ||