[Skiboot] [PATCH] external/opal-prd: generate path to opal-prd in its service file

Dan Horák dan at danny.cz
Tue Feb 4 05:55:09 AEDT 2025


Currently the path where to install the opal-prd binary is defined in
the Makefile by the $sbindir variable, but its service files hard-codes
the path to /usr/sbin/opal-prd. The build should generate the service
file based on the actual $sbindir value.

Also strip the trailing slash from the $prefix variable.

Signed-off-by: Dan Horák <dan at danny.cz>
---
 external/opal-prd/Makefile                                 | 7 +++++--
 .../opal-prd/{opal-prd.service => opal-prd.service.in}     | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
 rename external/opal-prd/{opal-prd.service => opal-prd.service.in} (87%)

diff --git a/external/opal-prd/Makefile b/external/opal-prd/Makefile
index fb9402f8f..c85aa3a3f 100644
--- a/external/opal-prd/Makefile
+++ b/external/opal-prd/Makefile
@@ -4,12 +4,12 @@ LDFLAGS += -m64
 ASFLAGS = -m64
 CPPFLAGS += -I. -I../../include -I../../
 
-prefix = /usr/local/
+prefix = /usr/local
 sbindir = $(prefix)/sbin
 datadir = $(prefix)/share
 mandir = $(datadir)/man
 
-all: links arch_links | opal-prd
+all: links arch_links | opal-prd opal-prd.service
 
 GET_ARCH = ../../external/common/get_arch.sh
 include ../../external/common/rules.mk
@@ -51,6 +51,9 @@ version.c: ../../make_version.sh .version
 	echo "const char version[] = \"$(OPAL_PRD_VERSION)\";" ;\
 	fi) > $@
 
+opal-prd.service: opal-prd.service.in
+	sed -e 's|@sbindir@|$(sbindir)|g' $< > $@
+
 .PHONY: VERSION-always
 .version: VERSION-always
 	@echo $(OPAL_PRD_VERSION) > $@.tmp
diff --git a/external/opal-prd/opal-prd.service b/external/opal-prd/opal-prd.service.in
similarity index 87%
rename from external/opal-prd/opal-prd.service
rename to external/opal-prd/opal-prd.service.in
index dce0dd262..724e51061 100644
--- a/external/opal-prd/opal-prd.service
+++ b/external/opal-prd/opal-prd.service.in
@@ -4,7 +4,7 @@ ConditionVirtualization=false
 ConditionPathExists=/sys/firmware/devicetree/base/ibm,opal/diagnostics
 
 [Service]
-ExecStart=/usr/sbin/opal-prd
+ExecStart=@sbindir@/opal-prd
 Restart=always
 
 [Install]
-- 
2.48.1



More information about the Skiboot mailing list