sys-apps/opal-utils: new package, open-power firmware utils
authorGeorgy Yakovlev <gyakovlev@gentoo.org>
Sun, 25 Aug 2019 00:44:18 +0000 (17:44 -0700)
committerGeorgy Yakovlev <gyakovlev@gentoo.org>
Sun, 25 Aug 2019 01:34:26 +0000 (18:34 -0700)
Package-Manager: Portage-2.3.73, Repoman-2.3.17
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
sys-apps/opal-utils/Manifest [new file with mode: 0644]
sys-apps/opal-utils/files/opal-prd.confd [new file with mode: 0644]
sys-apps/opal-utils/files/opal-prd.initd [new file with mode: 0644]
sys-apps/opal-utils/metadata.xml [new file with mode: 0644]
sys-apps/opal-utils/opal-utils-6.5.ebuild [new file with mode: 0644]

diff --git a/sys-apps/opal-utils/Manifest b/sys-apps/opal-utils/Manifest
new file mode 100644 (file)
index 0000000..76e3988
--- /dev/null
@@ -0,0 +1 @@
+DIST opal-utils-6.5.tar.gz 2080841 BLAKE2B cd8bda3b7f3bcbc620f922a6baa69f452a95c60a96eb9adf67d781dc5d1a75fc43cba7aa3ed82105de7a04041cfb61f43e909794702564819cda6f11afd23815 SHA512 f756307403ec49f24e5dbc06dbe8fe52898da27f2a0fa761164b1d85efd33dae8a8f96de3859eb7b11f85f43a790c9c213f9ebf0c7f4a859b590dcfb35e38571
diff --git a/sys-apps/opal-utils/files/opal-prd.confd b/sys-apps/opal-utils/files/opal-prd.confd
new file mode 100644 (file)
index 0000000..a61415e
--- /dev/null
@@ -0,0 +1,4 @@
+# /etc/conf.d/opal-prd: config file for /etc/init.d/opal-prd
+# see OPAL-PRD(8) 
+
+#OPAL_PRD_OPTS=""
diff --git a/sys-apps/opal-utils/files/opal-prd.initd b/sys-apps/opal-utils/files/opal-prd.initd
new file mode 100644 (file)
index 0000000..935d39f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+name="OPAL PRD daemon"
+description="Processor RunTime Diagnostics daemon"
+command=/usr/sbin/opal-prd
+command_args="${OPAL_PRD_OPTS}"
+command_background="true"
+pidfile="/run/${RC_SVCNAME}.pid"
+
+depend() {
+       need dev-mount sysfs
+       use logger
+       keyword -containers
+
+}
+
+required_dirs="/sys/firmware/devicetree/base/ibm,opal/diagnostics"
+required_files="/dev/opal-prd"
diff --git a/sys-apps/opal-utils/metadata.xml b/sys-apps/opal-utils/metadata.xml
new file mode 100644 (file)
index 0000000..308277e
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>gyakovlev@gentoo.org</email>
+               <name>Georgy Yakovlev</name>
+       </maintainer>
+       <longdescription lang="en">
+               This package contains utility programs for OpenPower systems:
+               'opal-prd' provides a daemon to load and run the OpenPower firmware's Processor Recovery Diagnostics binary.
+                       It's responsible for run time maintenance of OpenPower Systems hardware.
+               
+               'gard' utility can read, parse and clear hardware gard partitions on OpenPower platforms.
+               
+               'getscom' and 'putscom' utilities provide an interface to query or modify the registers of the different chipsets of an OpenPower system.
+               
+               'pflash' is a tool to access the flash modules on such systems and update the OpenPower firmware.
+       </longdescription>
+       <upstream>
+               <remote-id type="github">open-power/skiboot</remote-id>
+       </upstream>
+</pkgmetadata>
diff --git a/sys-apps/opal-utils/opal-utils-6.5.ebuild b/sys-apps/opal-utils/opal-utils-6.5.ebuild
new file mode 100644 (file)
index 0000000..a4dc62f
--- /dev/null
@@ -0,0 +1,83 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
+
+inherit linux-info python-any-r1 systemd toolchain-funcs
+
+DESCRIPTION="OPAL firmware utilities"
+HOMEPAGE="https://github.com/open-power/skiboot"
+SRC_URI="https://github.com/open-power/skiboot/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~ppc64"
+IUSE="doc"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+BDEPEND="doc? (
+       $(python_gen_any_dep '
+               dev-python/sphinx[${PYTHON_USEDEP}]
+               dev-python/recommonmark[${PYTHON_USEDEP}]
+       ')
+)"
+
+CONFIG_CHECK="~MTD_POWERNV_FLASH ~OPAL_PRD ~PPC_DT_CPU_FTRS ~SCOM_DEBUGFS"
+ERROR_MTD_POWERND_FLASH="CONFIG_MTD_POWERND_FLASH is required to use pflash and opal-gard"
+ERROR_OPAL_PRD="CONFIG_OPAL_PRD is required to run opal-prd daemon"
+ERROR_SCOM_DEBUGFS="CONFIG_SCOM_DEBUGFS is required to use xscom-utils"
+
+S="${WORKDIR}/skiboot-${PV}"
+
+python_check_deps() {
+       has_version "dev-python/recommonmark[${PYTHON_USEDEP}]" &&
+       has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       linux-info_pkg_setup
+       use doc && python-any-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+       sed -i '/^CFLAGS +=/ s/-g2 -ggdb//' external/opal-prd/Makefile || die
+}
+
+src_configure() {
+       tc-export CC LD
+       export OPAL_PRD_VERSION="${PV}"
+       export GARD_VERSION="${PV}"
+       export PFLASH_VERSION="${PV}"
+       export XSCOM_VERSION="${PV}"
+}
+
+src_compile() {
+       emake V=1 -C external/opal-prd
+       emake V=1 -C external/gard
+       emake V=1 -C external/pflash
+       emake V=1 -C external/xscom-utils
+
+       use doc && emake V=1 -C doc html
+}
+
+src_install() {
+       emake -C external/opal-prd DESTDIR="${D}" prefix="${EPREFIX}/usr" install
+       emake -C external/gard DESTDIR="${D}" prefix="${EPREFIX}/usr" install
+       emake -C external/pflash DESTDIR="${D}" prefix="${EPREFIX}/usr" install
+       emake -C external/xscom-utils DESTDIR="${D}" prefix="${EPREFIX}/usr" install
+
+       newinitd "${FILESDIR}"/opal-prd.initd opal-prd
+       newconfd "${FILESDIR}"/opal-prd.confd opal-prd
+
+       systemd_dounit external/opal-prd/opal-prd.service
+
+       if use doc; then
+
+               local HTML_DOCS=( doc/_build/html/. )
+       fi
+       einstalldocs
+}