Skip to content

Commit

Permalink
Add RPM spec file rhel/rshim.spec.in for fedora
Browse files Browse the repository at this point in the history
This commit also moves the rshim binary to /usr/sbin and moves
the man page to man8.

Signed-off-by: Liming Sun <[email protected]>
  • Loading branch information
lsun100 committed Mar 23, 2020
1 parent 90e7407 commit c76e633
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 14 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ AM_PROG_CC_C_O
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
rshim.spec
src/Makefile
man/Makefile
rshim.spec
rhel/rshim.spec
])
AC_CANONICAL_HOST

Expand Down
2 changes: 1 addition & 1 deletion man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (C) 2019 Mellanox Technologies. All Rights Reserved.
#

man1_MANS = rshim.1
man8_MANS = rshim.8
File renamed without changes.
65 changes: 65 additions & 0 deletions rhel/rshim.spec.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2019 Mellanox Technologies. All Rights Reserved.
#

Name: rshim
Version: @VERSION@
Release: 1%{?dist}
Summary: User-space driver for Mellanox BlueField SoC

License: GPLv2

URL: https://github.com/mellanox/rshim-user-space
Source0: https://github.com/Mellanox/rshim-user-space/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz

BuildRequires: gcc, autoconf, automake
BuildRequires: pkgconfig(libpci), pkgconfig(libusb-1.0), pkgconfig(fuse)
BuildRequires: systemd-units
BuildRequires: systemd-rpm-macros

%description
This is the user-space driver to access the BlueField SoC via the rshim
interface. It provides ways to push boot stream, debug the target or login
via the virtual console or network interface.

%prep
%setup -n %{name}-%{version}

%build
./bootstrap.sh
%configure
make

%install
%make_install
%__spec_install_post

%post
%systemd_post rshim.service

%preun
%systemd_preun rshim.service

%postun
%systemd_postun_with_restart rshim.service

%files
%license LICENSE
%doc README.md
%{_sbindir}/rshim
%{_unitdir}/rshim.service
%{_mandir}/man8/rshim.8.gz

%changelog
* Mon Mar 23 2020 Liming Sun <[email protected]> - 2.0.1-1
- Rename bfrshim to rshim
- Remove rshim.spec since it's auto-generated from rshim.spec.in
- Fix warnings reported by coverity
- Add rhel/rshim.spec.in for fedora
- Move rshim to sbin and move man page to man8

* Fri Mar 13 2020 Liming Sun <[email protected]> - 2.0-1
- Update the spec file according to fedora packaging-guidelines

* Mon Dec 16 2019 Liming Sun <[email protected]>
- Initial packaging
2 changes: 1 addition & 1 deletion rshim.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ After=network.target
[Service]
Restart=always
Type=forking
ExecStart=-/usr/bin/rshim $OPTIONS
ExecStart=-/usr/sbin/rshim $OPTIONS
KillMode=process
ExecStop=/usr/bin/killall -SIGKILL rshim

Expand Down
14 changes: 8 additions & 6 deletions rshim.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ tar -axf %{SOURCE0} -C %{name}-%{version} --strip-components 1
make

%install
%makeinstall -C src INSTALL_DIR="%{buildroot}%{_bindir}"
%makeinstall -C src INSTALL_DIR="%{buildroot}%{_sbindir}"
%if "%{with_systemd}" == "1"
%{__install} -d %{buildroot}%{_unitdir}
%{__install} -m 0644 rshim.service %{buildroot}%{_unitdir}
%endif
%{__install} -d %{buildroot}%{_mandir}/man1
%{__install} -m 0644 man/rshim.1 %{buildroot}%{_mandir}/man1
%{__install} -d %{buildroot}%{_mandir}/man8
%{__install} -m 0644 man/rshim.8 %{buildroot}%{_mandir}/man8
%__spec_install_post

%post
Expand All @@ -63,14 +63,16 @@ make
%if "%{with_systemd}" == "1"
%{_unitdir}/rshim.service
%endif
%{_bindir}/rshim
%{_mandir}/man1/rshim.1.gz
%{_sbindir}/rshim
%{_mandir}/man8/rshim.8.gz

%changelog
* Fri Mar 20 2020 Liming Sun <[email protected]> - 2.0.1-1
* Mon Mar 23 2020 Liming Sun <[email protected]> - 2.0.1-1
- Rename bfrshim to rshim
- Remove rshim.spec since it's auto-generated from rshim.spec.in
- Fix some warnings reported by coverity
- Add file rhel/rshim.spec.in for fedora
- Move rshim to sbin and move man page to man8

* Fri Mar 13 2020 Liming Sun <[email protected]> - 2.0-1
- Update the spec file according to fedora packaging-guidelines
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2019 Mellanox Technologies. All Rights Reserved.
#

bin_PROGRAMS = rshim
sbin_PROGRAMS = rshim

rshim_SOURCES = rshim.c rshim_log.c rshim_net.c
rshim_CPPFLAGS = -DHAVE_RSHIM_NET
Expand Down
2 changes: 1 addition & 1 deletion src/rshim_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int rshim_if_open(char *ifname, int index)

memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));

rc = ioctl(fd, TUNSETIFF, (void *) &ifr);
if (rc < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/rshim_pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static int rshim_pcie_probe(struct pci_dev *pci_dev)
bd = &dev->bd;
bd->has_rshim = 1;
bd->has_tm = 1;
strncpy(bd->dev_name, dev_name, sizeof(bd->dev_name) - 1);
strcpy(bd->dev_name, dev_name);
bd->read_rshim = rshim_pcie_read;
bd->write_rshim = rshim_pcie_write;
bd->destroy = rshim_pcie_delete;
Expand Down
2 changes: 1 addition & 1 deletion src/rshim_pcie_lf.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static int rshim_pcie_probe(struct pci_dev *pci_dev)
bd = &dev->bd;
bd->has_rshim = 1;
bd->has_tm = 1;
strncpy(bd->dev_name, dev_name, sizeof(bd->dev_name) - 1);
strcpy(bd->dev_name, dev_name);
bd->read_rshim = rshim_pcie_read;
bd->write_rshim = rshim_pcie_write;
bd->destroy = rshim_pcie_delete;
Expand Down
2 changes: 1 addition & 1 deletion src/rshim_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ static int rshim_usb_probe_one(libusb_context *ctx, libusb_device *usb_dev)
}

bd = &dev->bd;
strncpy(bd->dev_name, dev_name, sizeof(bd->dev_name) - 1);
strcpy(bd->dev_name, dev_name);
bd->read = rshim_usb_backend_read;
bd->write = rshim_usb_backend_write;
bd->cancel = rshim_usb_backend_cancel_req;
Expand Down

0 comments on commit c76e633

Please sign in to comment.