%global project skiboot
Name: opal-prd
Version: 6.2
Release: 3%{?dist}
Summary: OPAL Processor Recovery Diagnostics Daemon
Group: System Environment/Daemons
License: ASL 2.0
URL: http://github.com/open-power/skiboot
# Presently opal-prd is supported on ppc64le architecture only.
ExclusiveArch: ppc64le
BuildRequires: systemd
BuildRequires: gcc
%if 0%{?fedora}
BuildRequires: gcc-powerpc64-linux-gnu
%endif
BuildRequires: openssl-devel
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Source0: https://github.com/open-power/%{project}/archive/v%{version}/%{project}-%{version}.tar.gz
Source1: opal-prd-rsyslog
Source2: opal-prd-logrotate
%description
This package provides a daemon to load and run the OpenPower firmware's
Processor Recovery Diagnostics binary. This is responsible for run time
maintenance of OpenPower Systems hardware.
%package -n opal-utils
Summary: OPAL firmware utilities
Group: Applications/System
%description -n opal-utils
This package contains utility programs.
The 'gard' utility, can read, parse and clear hardware gard partitions
on OpenPower platforms. The '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.
%package -n opal-firmware
Summary: OPAL firmware
BuildArch: noarch
%description -n opal-firmware
OPAL firmware, aka skiboot, loads the bootloader and provides runtime
services to the OS (Linux) on IBM Power and OpenPower systems.
%prep
%setup -q -n %{project}-%{version}
%build
OPAL_PRD_VERSION=%{version} make V=1 CC="gcc" CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" -C external/opal-prd
GARD_VERSION=%{version} make V=1 CC="gcc" CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" -C external/gard
PFLASH_VERSION=%{version} make V=1 CC="gcc" CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" -C external/pflash
XSCOM_VERSION=%{version} make V=1 CC="gcc" CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" -C external/xscom-utils
# build skiboot with a cross-compiler on Fedora and with system compiler otherwise
# and always use upstream compiler flags for the firmware (no CFLAGS override)
%if 0%{?fedora}
SKIBOOT_VERSION=%{version} make V=1 CROSS="powerpc64-linux-gnu-"
%else
SKIBOOT_VERSION=%{version} make V=1 CROSS=
%endif
%install
make -C external/opal-prd install DESTDIR=%{buildroot} prefix=/usr
make -C external/gard install DESTDIR=%{buildroot} prefix=/usr
make -C external/pflash install DESTDIR=%{buildroot} prefix=/usr
make -C external/xscom-utils install DESTDIR=%{buildroot} prefix=/usr
mkdir -p %{buildroot}%{_unitdir}
install -m 644 -p external/opal-prd/opal-prd.service %{buildroot}%{_unitdir}/opal-prd.service
mkdir -p %{buildroot}%{_datadir}/qemu
install -m 644 -p skiboot.lid %{buildroot}%{_datadir}/qemu/skiboot.lid
install -m 644 -p skiboot.lid.xz %{buildroot}%{_datadir}/qemu/skiboot.lid.xz
# log opal-prd messages to /var/log/opal-prd.log
mkdir -p %{buildroot}%{_sysconfdir}/{rsyslog.d,logrotate.d}
install -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/rsyslog.d/opal-prd.conf
install -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/logrotate.d/opal-prd
%post
%systemd_post opal-prd.service
%preun
%systemd_preun opal-prd.service
%postun
%systemd_postun_with_restart opal-prd.service
%files
%doc README.md
%license LICENCE
%config(noreplace) %{_sysconfdir}/logrotate.d/opal-prd
%config(noreplace) %{_sysconfdir}/rsyslog.d/opal-prd.conf
%{_sbindir}/opal-prd
%{_unitdir}/opal-prd.service
%{_mandir}/man8/*
%files -n opal-utils
%doc README.md
%license LICENCE
%{_sbindir}/opal-gard
%{_sbindir}/getscom
%{_sbindir}/putscom
%{_sbindir}/pflash
%{_sbindir}/getsram
%{_mandir}/man1/*
%files -n opal-firmware
%doc README.md
%license LICENCE
%{_datadir}/qemu/
%changelog
* Wed May 22 2019 Than Ngo <than@redhat.com> - 6.2-3
- Related: #1579164, log messages to /var/log/opal-prd.log
* Thu Dec 20 2018 Than Ngo <than@redhat.com> - 6.2-2
- add man pages for getscom, pflash, putscom
* Tue Dec 18 2018 Than Ngo <than@redhat.com> - 6.2-1
- Resolves: #1640691, rebase to 6.2
- Resolves: #1579164, log messages to /var/log/opal-prd.log
- Resolves: #1660113, opal-prd occ reset causes hardlockup
* Thu Jun 28 2018 Than Ngo <than@redhat.com> - 6.0.4-2
- Resolves: #1596245 - "diag_encl -d" creates xml file with blank space in file name
* Thu Jun 21 2018 Than Ngo <than@redhat.com> - 6.0.4-1
- Resolves: #1537001 - update to 6.0.4
* Mon Jan 22 2018 Than Ngo <than@redhat.com> - 5.9-2
- Related: rhbz#1456536 - add support for runtime OCC load/start in ZZ
* Tue Oct 31 2017 Dan HorĂ¡k <dhorak@redhat.com> - 5.9-1
- Resolves: rhbz#1456536 - opal-prd update to 5.9
* Wed Oct 25 2017 Than Ngo <than@redhat.com> - 5.8-1
- Resolves: rhbz#1456536 - opal-prd update to 5.8
* Thu Apr 20 2017 Rafael Fonseca <rdossant@redhat.com> - 5.5.0-1
- Resolves: rhbz#1368702 - [Pegas1.0 FEAT] opal-prd package update
* Tue Mar 14 2017 Rafael Fonseca <rdossant@redhat.com> - 5.4.3-2
- Resolves: rhbz#1430332 - Restart opal-prd daemon on any kind of failure
* Wed Jan 18 2017 Rafael Fonseca <rdossant@redhat.com> - 5.4.3-1
- Resolves: rhbz#1384952 - [7.4 FEAT] opal-prd package update for ppc64le
* Thu Sep 22 2016 Rafael Fonseca <rdossant@redhat.com> - 5.2.0-3
- Resolves: rhbz#1375449
* Thu Aug 25 2016 Rafael Fonseca <rdossant@redhat.com> - 5.2.0-2
- Resolves: rhbz#1367342
- Remove systemd socket.
* Fri May 20 2016 Rafael dos Santos <rdossant@redhat.com> - 5.2.0-1
- Importing package from Fedora.