summaryrefslogtreecommitdiffstats
path: root/meta-phosphor
diff options
context:
space:
mode:
authorRatan <ratagupt@in.ibm.com>2016-11-17 16:06:21 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-01-12 15:23:39 +0000
commit269c5e05f2a65e3f01db1c719500812185562be4 (patch)
tree329ba1711379b39f08c12e80d1c0716bd56284c0 /meta-phosphor
parente4c152ae356094a361322661e7ebe9c80d3721ae (diff)
downloadtalos-openbmc-269c5e05f2a65e3f01db1c719500812185562be4.tar.gz
talos-openbmc-269c5e05f2a65e3f01db1c719500812185562be4.zip
slpd-lite:Create Recipe
-Create the slpd-lite.conf through the bbclass -Create the service file which starts the slpd Change-Id: I10b23bb81492270337e02470c75094eff30b4190 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'meta-phosphor')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass51
-rw-r--r--meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite.bb19
-rw-r--r--meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite/slpd-lite.service11
-rw-r--r--meta-phosphor/conf/distro/openbmc-phosphor.conf1
4 files changed, 72 insertions, 10 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass
index 8dc6fdc04..9b66e7ea9 100644
--- a/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-discovery-service.bbclass
@@ -4,17 +4,25 @@ DISCOVERY_SVC_PACKAGES ?= "${PN}"
python() {
avahi_enabled = bb.utils.contains(
'DISTRO_FEATURES', 'avahi', 'true', 'false', d)
- slp_enabled = False # later
+ slp_enabled = bb.utils.contains(
+ 'DISTRO_FEATURES', 'slp', 'true', 'false', d)
+
if not avahi_enabled and slp_enabled:
return
syscnfdir = d.getVar('sysconfdir', True)
dest_dir = d.getVar('D', True)
+
set_append(d, 'AVAHI_SERVICES_DIR', os.path.join(
dest_dir+syscnfdir,
'avahi',
'services'))
+ set_append(d, 'SLP_SERVICES_DIR', os.path.join(
+ dest_dir+syscnfdir,
+ 'slp',
+ 'services'))
+
for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg):
@@ -26,24 +34,39 @@ python() {
'avahi',
'services',
'%s.service' % svc_name))
+
+ if slp_enabled:
+ set_append(d, 'RRECOMMENDS_%s' % pkg, 'slpd-lite')
+ svc_name, svc_type, svc_port = service.split(':')
+ set_append(d, 'FILES_%s' % pkg, os.path.join(
+ syscnfdir,
+ 'slp',
+ 'services',
+ '%s.service' % svc_name))
+
}
python discovery_services_postinstall() {
avahi_enabled = bb.utils.contains(
'DISTRO_FEATURES', 'avahi', 'true', 'false', d)
- slp_enabled = False # later
+ slp_enabled = bb.utils.contains(
+ 'DISTRO_FEATURES', 'slp', 'true', 'false', d)
if not avahi_enabled and slp_enabled:
return
- service_dir = d.getVar('AVAHI_SERVICES_DIR', True)
+ avahi_service_dir = d.getVar('AVAHI_SERVICES_DIR', True)
+ slp_service_dir = d.getVar('SLP_SERVICES_DIR', True)
+
+ if not os.path.exists(avahi_service_dir):
+ os.makedirs(avahi_service_dir)
- if not os.path.exists(service_dir):
- os.makedirs(service_dir)
+ if not os.path.exists(slp_service_dir):
+ os.makedirs(slp_service_dir)
def register_service_avahi(d, service_name, service_type, service_port):
service_file = os.path.join(
- service_dir,
+ avahi_service_dir,
'%s.service' % service_name)
with open(service_file, 'w') as fd:
fd.write('<?xml version="1.0" ?>\n')
@@ -56,21 +79,29 @@ python discovery_services_postinstall() {
fd.write(' </service>\n')
fd.write('</service-group>\n')
+
+ def register_service_slp(d, service_name, service_type, service_port):
+ service_file = os.path.join(
+ slp_service_dir,
+ '%s.service' % service_name)
+ with open(service_file, 'w') as fd:
+ fd.write('%s %s %s' % (service_name, service_type, service_port))
+
def register_services(d,pkg):
for service in listvar_to_list(d, 'REGISTERED_SERVICES_%s' % pkg):
svc_info = service.split(":")
try:
svc_name, svc_type, svc_port = svc_info
- svc_type = "_" + svc_name + "._" + svc_type
except:
continue
if avahi_enabled:
- register_service_avahi(d, svc_name, svc_type, svc_port)
+ avahi_svc_type = "_" + svc_name + "._" + svc_type
+ register_service_avahi(d, svc_name, avahi_svc_type, svc_port)
+ if slp_enabled:
+ register_service_slp(d, svc_name, svc_type, svc_port)
for pkg in listvar_to_list(d, 'DISCOVERY_SVC_PACKAGES'):
register_services(d, pkg)
}
do_install[postfuncs] += "discovery_services_postinstall"
-
-
diff --git a/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite.bb b/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite.bb
new file mode 100644
index 000000000..0f3ac5c2f
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite.bb
@@ -0,0 +1,19 @@
+SUMMARY = "Lightweight SLP Server"
+DESCRIPTION = "Lightweight Unicast-only SLP Server"
+HOMEPAGE = "http://github.com/openbmc/slpd-lite"
+PR = "r1"
+
+inherit autotools pkgconfig
+inherit obmc-phosphor-license
+inherit obmc-phosphor-systemd
+
+SYSTEMD_SERVICE_${PN} += "slpd-lite.service"
+
+DEPENDS += "systemd"
+DEPENDS += "autoconf-archive-native"
+
+SRC_URI += "git://github.com/openbmc/slpd-lite"
+
+SRCREV = "70b8527104281ffd927c087480fbe1168a75fe93"
+
+S = "${WORKDIR}/git"
diff --git a/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite/slpd-lite.service b/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite/slpd-lite.service
new file mode 100644
index 000000000..02d593c19
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/slpd-lite/slpd-lite/slpd-lite.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Lightweight SLP Server
+
+After=network.target
+
+[Service]
+ExecStart={sbindir}/slpd
+Restart=always
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/conf/distro/openbmc-phosphor.conf b/meta-phosphor/conf/distro/openbmc-phosphor.conf
index 2355dca26..cc5edbdbe 100644
--- a/meta-phosphor/conf/distro/openbmc-phosphor.conf
+++ b/meta-phosphor/conf/distro/openbmc-phosphor.conf
@@ -33,6 +33,7 @@ DISTRO_FEATURES = "\
obmc-logging-mgmt \
obmc-host-ctl \
avahi \
+ slp \
${DISTRO_FEATURES_LIBC} \
"
OpenPOWER on IntegriCloud