From: Youngjae Cho Date: Mon, 21 Oct 2024 02:48:21 +0000 (+0900) Subject: halcc: Move execution of halcc from generator to sysinit.target X-Git-Tag: accepted/tizen/9.0/unified/20241108.065613~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27882833f0ce77cd0530ff5fbec7f7b60170893d;p=platform%2Fhal%2Fapi%2Fcommon.git halcc: Move execution of halcc from generator to sysinit.target systemd generator is executed in serialized order, not in parallel like systemd services. So the time consumed by a program run by systemd generator will throughly added up to the overall booting time. Therefore, convert hal-compatibility-checker into a systemd service and make it be pulled in by sysinit.target so it can run in parallel, improving booting time. On top of this, as the service has change to run as system_fw/system_fw (uid/gid), the permission of directory /opt/etc/hal created by the service has changed to 0755 to make it be able to write a file on that directory. Change-Id: Ia56b8c2ed845c3321db0d9304a0cb182134f0e75 Signed-off-by: Youngjae Cho (cherry picked from commit ded5f2c6b1af7911466283727038cc47b1e9d833) --- diff --git a/packaging/hal-api-common.spec b/packaging/hal-api-common.spec index aba731c..708cc99 100644 --- a/packaging/hal-api-common.spec +++ b/packaging/hal-api-common.spec @@ -13,7 +13,7 @@ Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest Source2: libhal-api.conf Source3: systemd-hal-firmware-generator -Source4: systemd-hal-compatibility-checker-generator +Source4: hal-compatibility-checker.service Source5: macros.hal-api Source6: haltest.target Source7: reboot-haltest @@ -71,10 +71,12 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} %make_install +mkdir -p %{buildroot}%{_unitdir} +cp %{SOURCE4} %{buildroot}%{_unitdir} + mkdir -p %{buildroot}/hal install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/ld.so.conf.d/libhal-api.conf install -D -m 0755 %{SOURCE3} %{buildroot}%{_systemdgeneratordir}/systemd-hal-firmware-generator -install -D -m 0755 %{SOURCE4} %{buildroot}%{_systemdgeneratordir}/systemd-hal-compatibility-checker-generator install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/rpm/macros.hal-api install -D -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/haltest.target install -D -m 0755 %{SOURCE7} %{buildroot}%{_bindir}/reboot-haltest @@ -86,9 +88,11 @@ rm -rf %{buildroot} %post /sbin/ldconfig +ln -sf %{_unitdir}/hal-compatibility-checker.service %{_unitdir}/sysinit.target.wants/ %postun /sbin/ldconfig +rm -f %{_unitdir}/sysinit.target.wants/hal-compatibility-checker.service ### contain files to package ######### %files -n %{name} @@ -101,7 +105,7 @@ rm -rf %{buildroot} %{_bindir}/hal-compatibility-checker %{_sysconfdir}/ld.so.conf.d/libhal-api.conf %{_systemdgeneratordir}/systemd-hal-firmware-generator -%{_systemdgeneratordir}/systemd-hal-compatibility-checker-generator +%{_unitdir}/hal-compatibility-checker.service %{_datadir}/upgrade/scripts/500.%{name}.sh %files -n %{devel_name} diff --git a/packaging/hal-compatibility-checker.service b/packaging/hal-compatibility-checker.service new file mode 100644 index 0000000..819c3e2 --- /dev/null +++ b/packaging/hal-compatibility-checker.service @@ -0,0 +1,16 @@ +[Unit] +Description=Generate compatibility information between platform and hal +DefaultDependencies=no +Before=sysinit.target +ConditionPathExists=!/opt/etc/hal/.hal-backend-compatibility + +[Service] +Type=oneshot +SmackProcessLabel=System +ExecStart=/usr/bin/hal-compatibility-checker --skip-if-result-exist +RemainAfterExit=yes +User=system_fw +Group=system_fw + +[Install] +WantedBy=sysinit.target diff --git a/packaging/systemd-hal-compatibility-checker-generator b/packaging/systemd-hal-compatibility-checker-generator deleted file mode 100644 index 089071c..0000000 --- a/packaging/systemd-hal-compatibility-checker-generator +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -PATH=/bin:/usr/bin:/sbin:/usr/sbin - -hal-compatibility-checker --skip-if-result-exist diff --git a/src/hal-api-compatibility-checker.c b/src/hal-api-compatibility-checker.c index c941103..65ea562 100644 --- a/src/hal-api-compatibility-checker.c +++ b/src/hal-api-compatibility-checker.c @@ -291,7 +291,7 @@ static int create_directory(const char *path) break; *p = '\0'; - ret = mkdir_one(directory_path, 0644); + ret = mkdir_one(directory_path, 0755); if (ret < 0) return ret; *p = '/'; @@ -299,7 +299,7 @@ static int create_directory(const char *path) p = strchr(p + 1, '/'); } - return mkdir_one(directory_path, 0644); + return mkdir_one(directory_path, 0755); }