Blame SPECS/qla2xxx.spec

3c6e85
%define kmod_name		qla2xxx
3c6e85
%define kmod_vendor		redhat
3c6e85
%define kmod_driver_version	10.01.00.20.07.8_k_dup7.7
3c6e85
%define kmod_driver_epoch	%{nil}
3c6e85
%define kmod_rpm_release	2
3c6e85
%define kmod_kernel_version	3.10.0-1062.el7
3c6e85
%define kmod_kernel_version_min	%{nil}
3c6e85
%define kmod_kernel_version_dep	%{nil}
3c6e85
%define kmod_kbuild_dir		drivers/scsi/qla2xxx
3c6e85
%define kmod_dependencies       %{nil}
3c6e85
%define kmod_dist_build_deps	%{nil}
3c6e85
%define kmod_build_dependencies	%{nil}
3c6e85
%define kmod_devel_package	1
3c6e85
%define kmod_install_path	extra/kmod-redhat-qla2xxx
3c6e85
%define kernel_pkg		kernel
3c6e85
%define kernel_devel_pkg	kernel-devel
3c6e85
%define kernel_modules_pkg	kernel-modules
3c6e85
3c6e85
%{!?dist: %define dist .el7_7}
3c6e85
%{!?make_build: %define make_build make}
3c6e85
3c6e85
%if "%{kmod_kernel_version_dep}" == ""
3c6e85
%define kmod_kernel_version_dep %{kmod_kernel_version}
3c6e85
%endif
3c6e85
3c6e85
%if "%{kmod_dist_build_deps}" == ""
3c6e85
%if (0%{?rhel} > 7) || (0%{?centos} > 7)
3c6e85
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod
3c6e85
%else
3c6e85
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists
3c6e85
%endif
3c6e85
%endif
3c6e85
3c6e85
Source0:	%{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2
3c6e85
# Source code patches
3c6e85
Patch0:	0001-scsi-scsi-qla2xxx-Add-protection-mask-module-paramet.patch
3c6e85
Patch1:	0002-scsi-scsi-qla2xxx-Fix-DMA-error-when-the-DIF-sg-buff.patch
3c6e85
Patch2:	0003-scsi-scsi-qla2xxx-no-need-to-check-return-value-of-d.patch
3c6e85
Patch3:	0004-scsi-scsi-qla2xxx-Fix-N2N-target-discovery-with-Loca.patch
3c6e85
Patch4:	0005-scsi-scsi-qla2xxx-Change-default-ZIO-threshold.patch
3c6e85
Patch5:	0006-scsi-scsi-qla2xxx-Fix-session-cleanup-hang.patch
3c6e85
Patch6:	0007-scsi-scsi-qla2xxx-flush-IO-on-chip-reset-or-sess-del.patch
3c6e85
Patch7:	0008-scsi-scsi-qla2xxx-fix-fcport-null-pointer-access.patch
3c6e85
Patch8:	0009-scsi-scsi-qla2xxx-allow-session-delete-to-finish-bef.patch
3c6e85
Patch9:	0010-scsi-scsi-qla2xxx-Fix-SRB-allocation-flag-to-avoid-s.patch
3c6e85
Patch10:	0011-scsi-scsi-qla2xxx-Prevent-memory-leak-for-CT-req-rsp.patch
3c6e85
Patch11:	0012-scsi-scsi-qla2xxx-Restore-FAWWPN-of-Physical-Port-on.patch
3c6e85
Patch12:	0013-scsi-scsi-qla2xxx-Fix-fw-options-handle-eh_bus_reset.patch
3c6e85
Patch13:	0014-scsi-scsi-qla2xxx-Move-debug-messages-before-sending.patch
3c6e85
Patch14:	0015-scsi-scsi-qla2xxx-remove-redundant-null-check-on-poi.patch
3c6e85
Patch15:	0016-scsi-scsi-qla2xxx-Fix-LUN-discovery-if-loop-id-is-no.patch
3c6e85
Patch16:	0017-scsi-scsi-qla2xxx-Add-First-Burst-support-for-FC-NVM.patch
3c6e85
Patch17:	0018-scsi-scsi-qla2xxx-Fix-unload-when-NVMe-devices-are-c.patch
3c6e85
Patch18:	0019-scsi-scsi-qla2xxx-Check-for-FW-started-flag-before-a.patch
3c6e85
Patch19:	0020-scsi-scsi-qla2xxx-Prevent-multiple-ADISC-commands-pe.patch
3c6e85
Patch20:	0021-scsi-scsi-qla2xxx-Add-support-for-setting-port-speed.patch
3c6e85
Patch21:	0022-scsi-scsi-qla2xxx-Prevent-SysFS-access-when-chip-is-.patch
3c6e85
Patch22:	0023-scsi-scsi-qla2xxx-Move-marker-request-behind-QPair.patch
3c6e85
Patch23:	0024-scsi-scsi-qla2xxx-Fix-code-indentation-for-qla27xx_f.patch
3c6e85
Patch24:	0025-scsi-scsi-qla2xxx-Add-new-FW-dump-template-entry-typ.patch
3c6e85
Patch25:	0026-scsi-scsi-qla2xxx-Fix-panic-in-qla_dfs_tgt_counters_.patch
3c6e85
Patch26:	0027-scsi-scsi-qla2xxx-avoid-printf-format-warning.patch
3c6e85
Patch27:	0028-scsi-scsi-qla2xxx-check-for-kstrtol-failure.patch
3c6e85
Patch28:	0029-scsi-scsi-qla2xxx-Add-fw_attr-and-port_no-SysFS-node.patch
3c6e85
Patch29:	0030-scsi-scsi-qla2xxx-Remove-FW-default-template.patch
3c6e85
Patch30:	0031-scsi-scsi-qla2xxx-Fix-routine-qla27xx_dump_-mpi-ram.patch
3c6e85
Patch31:	0032-scsi-scsi-qla2xxx-Add-Device-ID-for-ISP28XX.patch
3c6e85
Patch32:	0033-scsi-scsi-qla2xxx-Add-Serdes-support-for-ISP28XX.patch
3c6e85
Patch33:	0034-scsi-scsi-qla2xxx-Correctly-report-max-min-supported.patch
3c6e85
Patch34:	0035-scsi-scsi-qla2xxx-Cleanups-for-NVRAM-Flash-read-writ.patch
3c6e85
Patch35:	0036-scsi-scsi-qla2xxx-Add-support-for-multiple-fwdump-te.patch
3c6e85
Patch36:	0037-scsi-scsi-qla2xxx-Update-flash-read-write-routine.patch
3c6e85
Patch37:	0038-scsi-scsi-qla2xxx-Correction-and-improvement-to-fwdt.patch
3c6e85
Patch38:	0039-scsi-scsi-qla2xxx-Simplification-of-register-address.patch
3c6e85
Patch39:	0040-scsi-scsi-qla2xxx-Add-28xx-flash-primary-secondary-s.patch
3c6e85
Patch40:	0041-scsi-scsi-qla2xxx-Secure-flash-update-support-for-IS.patch
3c6e85
Patch41:	0042-scsi-scsi-qla2xxx-Fix-a-small-typo-in-qla_bsg.c.patch
3c6e85
Patch42:	0043-scsi-scsi-qla2xxx-Simplify-conditional-check-again.patch
3c6e85
Patch43:	0044-scsi-scsi-qla2xxx-Set-the-SCSI-command-result-before.patch
3c6e85
Patch44:	0045-scsi-scsi-qla2xxx-Set-the-qpair-in-SRB-to-NULL-when-.patch
3c6e85
Patch45:	0046-scsi-scsi-qla2xxx-Reset-the-FCF_ASYNC_-SENT-ACTIVE-f.patch
3c6e85
Patch46:	0047-scsi-scsi-qla2xxx-Increase-the-max_sgl_segments-to-1.patch
3c6e85
Patch47:	0048-scsi-scsi-qla2xxx-Disable-T10-DIF-feature-with-FC-NV.patch
3c6e85
Patch48:	0049-scsi-scsi-qla2xxx-Fix-incorrect-region-size-setting-.patch
3c6e85
Patch49:	0050-scsi-scsi-qla2xxx-Further-limit-FLASH-region-write-a.patch
3c6e85
Patch50:	0051-scsi-scsi-qla2xxx-Fix-fw-dump-corruption.patch
3c6e85
Patch51:	0052-scsi-scsi-qla2xxx-Use-mutex-protection-during-qla2x0.patch
3c6e85
Patch52:	0053-scsi-scsi-qla2xxx-Cleanup-fcport-memory-to-prevent-l.patch
3c6e85
Patch53:	0054-scsi-scsi-qla2xxx-Set-remote-port-devloss-timeout-to.patch
3c6e85
Patch54:	0055-scsi-scsi-qla2xxx-Cleanup-redundant-qla2x00_abort_al.patch
3c6e85
Patch55:	0056-scsi-scsi-qla2xxx-Fix-driver-unload-when-FC-NVMe-LUN.patch
3c6e85
Patch56:	0057-scsi-scsi-qla2xxx-Remove-useless-set-memory-to-zero-.patch
3c6e85
Patch57:	0058-scsi-scsi-qla2xxx-fix-spelling-mistake-alredy-alread.patch
3c6e85
Patch58:	0059-scsi-scsi-qla2xxx-Remove-a-comment-that-refers-to-th.patch
3c6e85
Patch59:	0060-scsi-scsi-qla2xxx-Use-ARRAY_SIZE-in-the-definition-o.patch
3c6e85
Patch60:	0061-scsi-scsi-qla2xxx-Declare-local-symbols-static.patch
3c6e85
Patch61:	0062-scsi-scsi-qla2xxx-Make-qla2x00_process_response_queu.patch
3c6e85
Patch62:	0063-scsi-scsi-qla2xxx-Use-get-put_unaligned-where-approp.patch
3c6e85
Patch63:	0064-scsi-scsi-qla2xxx-Unregister-chrdev-if-module-initia.patch
3c6e85
Patch64:	0065-scsi-scsi-tcm_qla2xxx-Minimize-include-directives.patch
3c6e85
Patch65:	0066-scsi-scsi-qla2xxx-Fix-FC-AL-connection-target-discov.patch
3c6e85
Patch66:	0067-scsi-scsi-qla2xxx-Use-tabs-to-indent-code.patch
3c6e85
Patch67:	0068-scsi-scsi-qla2xxx-Leave-a-blank-line-after-declarati.patch
3c6e85
Patch68:	0069-scsi-scsi-qla2xxx-Fix-formatting-of-pointer-types.patch
3c6e85
Patch69:	0070-scsi-scsi-qla2xxx-Insert-spaces-where-required.patch
3c6e85
Patch70:	0071-scsi-scsi-qla2xxx-Move-the-port_state_strdefinition-.patch
3c6e85
Patch71:	0072-scsi-scsi-qla2xxx-Declare-qla24xx_build_scsi_crc_2_i.patch
3c6e85
Patch72:	0073-scsi-scsi-qla2xxx-Remove-qla_tgt_cmd.data_work-and-q.patch
3c6e85
Patch73:	0074-scsi-scsi-qla2xxx-Remove-two-superfluous-casts.patch
3c6e85
Patch74:	0075-scsi-scsi-qla2xxx-Move-qla2x00_set_fcport_state-from.patch
3c6e85
Patch75:	0076-scsi-scsi-qla2xxx-Fix-read-offset-in-qla24xx_load_ri.patch
3c6e85
Patch76:	0077-scsi-scsi-qla2xxx-Update-two-source-code-comments.patch
3c6e85
Patch77:	0078-scsi-scsi-qla2xxx-Fix-a-format-specifier.patch
3c6e85
Patch78:	0079-scsi-scsi-qla2xxx-Move-qla2x00_set_reserved_loop_ids.patch
3c6e85
Patch79:	0080-scsi-scsi-qla2xxx-Declare-qla2x00_find_new_loop_id-s.patch
3c6e85
Patch80:	0081-scsi-scsi-qla2xxx-Remove-a-set-but-not-used-variable.patch
3c6e85
Patch81:	0082-scsi-scsi-qla2xxx-Move-qla2x00_clear_loop_id-from-ql.patch
3c6e85
Patch82:	0083-scsi-scsi-qla2xxx-Move-qla2x00_is_reserved_id-from-q.patch
3c6e85
Patch83:	0084-scsi-scsi-qla2xxx-Remove-the-fcport-test-from-qla_nv.patch
3c6e85
Patch84:	0085-scsi-scsi-qla2xxx-NULL-check-before-some-freeing-fun.patch
3c6e85
Patch85:	0086-scsi-scsi-qla2xxx-Make-qla2x00_mem_free-easier-to-ve.patch
3c6e85
Patch86:	0087-scsi-scsi-qla2xxx-Avoid-that-qla2x00_mem_free-crashe.patch
3c6e85
Patch87:	0088-scsi-scsi-qla2xxx-Avoid-that-Coverity-complains-abou.patch
3c6e85
Patch88:	0089-scsi-scsi-qla2xxx-Log-the-status-code-if-a-firmware-.patch
3c6e85
Patch89:	0090-scsi-scsi-qla2xxx-Fix-a-qla24xx_enable_msix-error-pa.patch
3c6e85
Patch90:	0091-scsi-scsi-qla2xxx-Fix-use-after-free-issues-in-qla2x.patch
3c6e85
Patch91:	0092-scsi-scsi-qla2xxx-Pass-little-endian-values-to-the-f.patch
3c6e85
Patch92:	0093-scsi-scsi-qla2xxx-Check-the-size-of-firmware-data-st.patch
3c6e85
Patch93:	0094-scsi-scsi-qla2xxx-Use-an-on-stack-completion-in-qla2.patch
3c6e85
Patch94:	0095-scsi-scsi-qla2xxx-Remove-a-set-but-not-used-variable.patch
3c6e85
Patch95:	0096-scsi-scsi-qla2xxx-Split-the-__qla2x00_abort_all_cmds.patch
3c6e85
Patch96:	0097-scsi-scsi-qla2xxx-Fix-race-conditions-in-the-code-fo.patch
3c6e85
Patch97:	0098-scsi-scsi-qla2xxx-Complain-loudly-about-reference-co.patch
3c6e85
Patch98:	0099-scsi-scsi-qla2xxx-Avoid-that-qlt_send_resp_ctio-corr.patch
3c6e85
Patch99:	0100-scsi-scsi-qla2xxx-Fix-hardlockup-in-abort-command-du.patch
3c6e85
Patch100:	0101-scsi-scsi-qla2xxx-remove-double-assignment-in-qla2x0.patch
3c6e85
Patch101:	0102-scsi-scsi-qla2xxx-Fix-kernel-crash-after-disconnecti.patch
3c6e85
Patch102:	0103-scsi-scsi-qla2xxx-on-session-delete-return-nvme-cmd.patch
3c6e85
Patch103:	0104-scsi-scsi-qla2xxx-Fix-NVME-cmd-and-LS-cmd-timeout-ra.patch
3c6e85
Patch104:	0105-scsi-scsi-qla2xxx-move-IO-flush-to-the-front-of-NVME.patch
3c6e85
Patch105:	0106-scsi-scsi-qla2xxx-Remove-unnecessary-null-check.patch
3c6e85
Patch106:	0107-scsi-scsi-qla2xxx-Replace-vmalloc-memset-with-vzallo.patch
3c6e85
Patch107:	0108-scsi-scsi-qla2xxx-Fix-DMA-unmap-leak.patch
3c6e85
Patch108:	0109-scsi-scsi-qla2xxx-Fix-different-size-DMA-Alloc-Unmap.patch
3c6e85
Patch109:	0110-scsi-scsi-qla2xxx-Fix-abort-timeout-race-condition.patch
3c6e85
Patch110:	0111-scsi-scsi-qla2xxx-Allow-NVMe-IO-to-resume-with-short.patch
3c6e85
Patch111:	0112-scsi-scsi-qla2xxx-Fix-hang-in-fcport-delete-path.patch
3c6e85
Patch112:	0113-scsi-scsi-qla2xxx-Use-common-update-firmware-options.patch
3c6e85
Patch113:	0114-scsi-scsi-qla2xxx-Fix-NVMe-port-discovery-after-a-sh.patch
3c6e85
Patch114:	0115-scsi-scsi-qla2xxx-Correct-error-handling-during-init.patch
3c6e85
Patch115:	0116-scsi-scsi-qla2xxx-Fix-Relogin-to-prevent-modifying-s.patch
3c6e85
Patch116:	0117-scsi-scsi-qla2xxx-Reject-EH_-abort-device_reset-targ.patch
3c6e85
Patch117:	0118-scsi-qla2xxx-Update-driver-version-to-10.01.00.18.07.patch
3c6e85
Patch118:	0120-scsi-scsi-qla2xxx-qla2x00_alloc_fw_dump-set-ha-eft.patch
3c6e85
Patch119:	0121-scsi-scsi-qla2xxx-cleanup-trace-buffer-initializatio.patch
3c6e85
Patch120:	0122-scsi-scsi-qla2xxx-Fix-flash-read-for-Qlogic-ISPs.patch
3c6e85
Patch121:	0123-scsi-scsi-qla2xxx-Fix-driver-reload-for-ISP82xx.patch
3c6e85
Patch122:	0124-scsi-scsi-qla2xxx-Use-correct-size-in-call-to-dma_fr.patch
3c6e85
Patch123:	0125-scsi-scsi-qla2xxx-Initialized-mailbox-to-prevent-dri.patch
3c6e85
Patch124:	0126-scsi-scsi-qla2xxx-Fix-panic-from-use-after-free-in-q.patch
3c6e85
Patch125:	0127-scsi-scsi-qla2xxx-Fix-stuck-login-session.patch
3c6e85
Patch126:	0128-scsi-scsi-qla2xxx-Remove-a-superfluous-forward-decla.patch
3c6e85
Patch127:	0129-scsi-scsi-qla2xxx-Reduce-the-number-of-forward-decla.patch
3c6e85
Patch128:	0130-scsi-scsi-qla2xxx-Make-qla24xx_async_abort_cmd-stati.patch
3c6e85
Patch129:	0131-scsi-scsi-qla2xxx-Really-fix-qla2xxx_eh_abort.patch
3c6e85
Patch130:	0132-scsi-scsi-qla2xxx-Introduce-the-function-qla2xxx_ini.patch
3c6e85
Patch131:	0133-scsi-scsi-qla2xxx-Fix-a-race-condition-between-abort.patch
3c6e85
Patch132:	0134-scsi-scsi-qla2xxx-Fix-N2N-link-reset.patch
3c6e85
Patch133:	0135-scsi-scsi-qla2xxx-Fix-N2N-link-up-fail.patch
3c6e85
Patch134:	0136-scsi-scsi-qla2xxx-Use-tabs-instead-of-spaces-for-ind.patch
3c6e85
Patch135:	0137-scsi-scsi-qla2xxx-Dual-FCP-NVMe-target-port-support.patch
3c6e85
Patch136:	0138-scsi-scsi-qla2xxx-Inline-the-qla2x00_fcport_event_ha.patch
3c6e85
Patch137:	0139-scsi-scsi-qla2xxx-Add-error-handling-for-PLOGI-ELS-p.patch
3c6e85
Patch138:	0140-scsi-scsi-qla2xxx-Retry-PLOGI-on-FC-NVMe-PRLI-failur.patch
3c6e85
Patch139:	0141-scsi-scsi-qla2xxx-Do-command-completion-on-abort-tim.patch
3c6e85
Patch140:	0142-scsi-scsi-qla2xxx-Uninline-qla2x00_init_timer.patch
3c6e85
Patch141:	0143-scsi-scsi-qla2xxx-Fix-premature-timer-expiration.patch
3c6e85
Patch142:	0144-scsi-scsi-qla2xxx-Fix-SRB-leak-on-switch-command-tim.patch
3c6e85
Patch143:	0145-scsi-scsi-qla2xxx-Fix-driver-unload-hang.patch
3c6e85
Patch144:	0146-scsi-scsi-qla2xxx-Make-qla2x00_abort_srb-again-decre.patch
3c6e85
Patch145:	0147-scsi-scsi-qla2xxx-Fix-double-scsi_done-for-abort-pat.patch
3c6e85
Patch146:	0148-scsi-scsi-qla2xxx-Fix-a-NULL-pointer-dereference.patch
3c6e85
Patch147:	0149-scsi-scsi-qla2xxx-Fix-device-connect-issues-in-P2P-c.patch
3c6e85
Patch148:	0150-scsi-scsi-qla2xxx-Fix-partial-flash-write-of-MBI.patch
3c6e85
Patch149:	0151-scsi-qla2xxx-Update-driver-version.patch
3c6e85
Patch150:	0153-scsi-scsi-qla2xxx-Correctly-retrieve-and-interpret-a.patch
3c6e85
Patch151:	0154-scsi-scsi-qla2xxx-Added-support-for-MPI-and-PEP-regi.patch
3c6e85
Patch152:	0155-scsi-scsi-qla2xxx-Fix-incorrect-SFUB-length-used-for.patch
3c6e85
Patch153:	9000-bump-kmod-version.patch
3c6e85
3c6e85
%define findpat %( echo "%""P" )
3c6e85
%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms
3c6e85
%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release}
3c6e85
%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi )
3c6e85
%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups
3c6e85
%define kver_state_dir %{dup_state_dir}/kver
3c6e85
%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch)
3c6e85
%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules
3c6e85
3c6e85
Name:		kmod-redhat-qla2xxx
3c6e85
Version:	%{kmod_driver_version}
3c6e85
Release:	%{kmod_rpm_release}%{?dist}
3c6e85
%if "%{kmod_driver_epoch}" != ""
3c6e85
Epoch:		%{kmod_driver_epoch}
3c6e85
%endif
3c6e85
Summary:	qla2xxx kernel module for Driver Update Program
3c6e85
Group:		System/Kernel
3c6e85
License:	GPLv2
3c6e85
URL:		https://www.kernel.org/
3c6e85
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
3c6e85
BuildRequires:	%kernel_devel_pkg = %kmod_kernel_version
3c6e85
%if "%{kmod_dist_build_deps}" != ""
3c6e85
BuildRequires:	%{kmod_dist_build_deps}
3c6e85
%endif
3c6e85
ExclusiveArch:	x86_64
3c6e85
%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch)
3c6e85
3c6e85
%global _use_internal_dependency_generator 0
3c6e85
%if "%{?kmod_kernel_version_min}" != ""
3c6e85
Provides:	%kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
3c6e85
%else
3c6e85
Provides:	%kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
3c6e85
%endif
3c6e85
Provides:	kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
3c6e85
Requires(post):	%{sbindir}/weak-modules
3c6e85
Requires(postun):	%{sbindir}/weak-modules
3c6e85
Requires:	kernel >= 3.10.0-1062.el7
3c6e85
3c6e85
Requires:	kernel < 3.10.0-1063.el7
3c6e85
%if 0
3c6e85
Requires: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION
3c6e85
%endif
3c6e85
%if "%{kmod_build_dependencies}" != ""
3c6e85
BuildRequires:  %{kmod_build_dependencies}
3c6e85
%endif
3c6e85
%if "%{kmod_dependencies}" != ""
3c6e85
Requires:       %{kmod_dependencies}
3c6e85
%endif
3c6e85
# if there are multiple kmods for the same driver from different vendors,
3c6e85
# they should conflict with each other.
3c6e85
Conflicts:	kmod-%{kmod_name}
3c6e85
3c6e85
%description
3c6e85
qla2xxx kernel module for Driver Update Program
3c6e85
3c6e85
%if 0
3c6e85
3c6e85
%package -n kmod-redhat-qla2xxx-firmware
3c6e85
Version:	ENTER_FIRMWARE_VERSION
3c6e85
Summary:	qla2xxx firmware for Driver Update Program
3c6e85
Provides:	firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION
3c6e85
%if "%{kmod_kernel_version_min}" != ""
3c6e85
Provides:	%kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
3c6e85
%else
3c6e85
Provides:	%kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
3c6e85
%endif
3c6e85
%description -n  kmod-redhat-qla2xxx-firmware
3c6e85
qla2xxx firmware for Driver Update Program
3c6e85
3c6e85
3c6e85
%files -n kmod-redhat-qla2xxx-firmware
3c6e85
%defattr(644,root,root,755)
3c6e85
%{FIRMWARE_FILES}
3c6e85
3c6e85
%endif
3c6e85
3c6e85
# Development package
3c6e85
%if 0%{kmod_devel_package}
3c6e85
%package -n kmod-redhat-qla2xxx-devel
3c6e85
Version:	%{kmod_driver_version}
3c6e85
Requires:	kernel >= 3.10.0-1062.el7
3c6e85
3c6e85
Requires:	kernel < 3.10.0-1063.el7
3c6e85
Summary:	qla2xxx development files for Driver Update Program
3c6e85
3c6e85
%description -n  kmod-redhat-qla2xxx-devel
3c6e85
qla2xxx development files for Driver Update Program
3c6e85
3c6e85
3c6e85
%files -n kmod-redhat-qla2xxx-devel
3c6e85
%defattr(644,root,root,755)
3c6e85
/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers
3c6e85
%endif
3c6e85
3c6e85
%post
3c6e85
modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') )
3c6e85
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs
3c6e85
3c6e85
mkdir -p "%{kver_state_dir}"
3c6e85
touch "%{kver_state_file}"
3c6e85
3c6e85
exit 0
3c6e85
3c6e85
%posttrans
3c6e85
# We have to re-implement part of weak-modules here because it doesn't allow
3c6e85
# calling initramfs regeneration separately
3c6e85
if [ -f "%{kver_state_file}" ]; then
3c6e85
	kver_base="%{kmod_kernel_version_dep}"
3c6e85
	kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*)
3c6e85
3c6e85
	for k_dir in $kvers; do
3c6e85
		k="${k_dir#/lib/modules/}"
3c6e85
3c6e85
		tmp_initramfs="/boot/initramfs-$k.tmp"
3c6e85
		dst_initramfs="/boot/initramfs-$k.img"
3c6e85
3c6e85
		# The same check as in weak-modules: we assume that the kernel present
3c6e85
		# if the symvers file exists.
3c6e85
		if [ -e "/boot/symvers-$k.gz" ]; then
3c6e85
			/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
3c6e85
			cmp -s "$tmp_initramfs" "$dst_initramfs"
3c6e85
			if [ "$?" = 1 ]; then
3c6e85
				mv "$tmp_initramfs" "$dst_initramfs"
3c6e85
			else
3c6e85
				rm -f "$tmp_initramfs"
3c6e85
			fi
3c6e85
		fi
3c6e85
	done
3c6e85
3c6e85
	rm -f "%{kver_state_file}"
3c6e85
	rmdir "%{kver_state_dir}" 2> /dev/null
3c6e85
fi
3c6e85
3c6e85
rmdir "%{dup_state_dir}" 2> /dev/null
3c6e85
3c6e85
exit 0
3c6e85
3c6e85
%preun
3c6e85
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
3c6e85
	mkdir -p "%{kver_state_dir}"
3c6e85
	touch "%{kver_state_file}"
3c6e85
fi
3c6e85
3c6e85
mkdir -p "%{dup_state_dir}"
3c6e85
rpm -ql kmod-redhat-qla2xxx-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \
3c6e85
	grep '\.ko$' > "%{dup_module_list}"
3c6e85
3c6e85
%postun
3c6e85
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
3c6e85
	initramfs_opt="--no-initramfs"
3c6e85
else
3c6e85
	initramfs_opt=""
3c6e85
fi
3c6e85
3c6e85
modules=( $(cat "%{dup_module_list}") )
3c6e85
rm -f "%{dup_module_list}"
3c6e85
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt
3c6e85
3c6e85
rmdir "%{dup_state_dir}" 2> /dev/null
3c6e85
3c6e85
exit 0
3c6e85
3c6e85
%files
3c6e85
%defattr(644,root,root,755)
3c6e85
/lib/modules/%{kmod_kernel_version}.%(arch)
3c6e85
/etc/depmod.d/%{kmod_name}.conf
3c6e85
/usr/share/doc/kmod-%{kmod_name}/greylist.txt
3c6e85
3c6e85
%prep
3c6e85
%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}
3c6e85
3c6e85
%patch0 -p1
3c6e85
%patch1 -p1
3c6e85
%patch2 -p1
3c6e85
%patch3 -p1
3c6e85
%patch4 -p1
3c6e85
%patch5 -p1
3c6e85
%patch6 -p1
3c6e85
%patch7 -p1
3c6e85
%patch8 -p1
3c6e85
%patch9 -p1
3c6e85
%patch10 -p1
3c6e85
%patch11 -p1
3c6e85
%patch12 -p1
3c6e85
%patch13 -p1
3c6e85
%patch14 -p1
3c6e85
%patch15 -p1
3c6e85
%patch16 -p1
3c6e85
%patch17 -p1
3c6e85
%patch18 -p1
3c6e85
%patch19 -p1
3c6e85
%patch20 -p1
3c6e85
%patch21 -p1
3c6e85
%patch22 -p1
3c6e85
%patch23 -p1
3c6e85
%patch24 -p1
3c6e85
%patch25 -p1
3c6e85
%patch26 -p1
3c6e85
%patch27 -p1
3c6e85
%patch28 -p1
3c6e85
%patch29 -p1
3c6e85
%patch30 -p1
3c6e85
%patch31 -p1
3c6e85
%patch32 -p1
3c6e85
%patch33 -p1
3c6e85
%patch34 -p1
3c6e85
%patch35 -p1
3c6e85
%patch36 -p1
3c6e85
%patch37 -p1
3c6e85
%patch38 -p1
3c6e85
%patch39 -p1
3c6e85
%patch40 -p1
3c6e85
%patch41 -p1
3c6e85
%patch42 -p1
3c6e85
%patch43 -p1
3c6e85
%patch44 -p1
3c6e85
%patch45 -p1
3c6e85
%patch46 -p1
3c6e85
%patch47 -p1
3c6e85
%patch48 -p1
3c6e85
%patch49 -p1
3c6e85
%patch50 -p1
3c6e85
%patch51 -p1
3c6e85
%patch52 -p1
3c6e85
%patch53 -p1
3c6e85
%patch54 -p1
3c6e85
%patch55 -p1
3c6e85
%patch56 -p1
3c6e85
%patch57 -p1
3c6e85
%patch58 -p1
3c6e85
%patch59 -p1
3c6e85
%patch60 -p1
3c6e85
%patch61 -p1
3c6e85
%patch62 -p1
3c6e85
%patch63 -p1
3c6e85
%patch64 -p1
3c6e85
%patch65 -p1
3c6e85
%patch66 -p1
3c6e85
%patch67 -p1
3c6e85
%patch68 -p1
3c6e85
%patch69 -p1
3c6e85
%patch70 -p1
3c6e85
%patch71 -p1
3c6e85
%patch72 -p1
3c6e85
%patch73 -p1
3c6e85
%patch74 -p1
3c6e85
%patch75 -p1
3c6e85
%patch76 -p1
3c6e85
%patch77 -p1
3c6e85
%patch78 -p1
3c6e85
%patch79 -p1
3c6e85
%patch80 -p1
3c6e85
%patch81 -p1
3c6e85
%patch82 -p1
3c6e85
%patch83 -p1
3c6e85
%patch84 -p1
3c6e85
%patch85 -p1
3c6e85
%patch86 -p1
3c6e85
%patch87 -p1
3c6e85
%patch88 -p1
3c6e85
%patch89 -p1
3c6e85
%patch90 -p1
3c6e85
%patch91 -p1
3c6e85
%patch92 -p1
3c6e85
%patch93 -p1
3c6e85
%patch94 -p1
3c6e85
%patch95 -p1
3c6e85
%patch96 -p1
3c6e85
%patch97 -p1
3c6e85
%patch98 -p1
3c6e85
%patch99 -p1
3c6e85
%patch100 -p1
3c6e85
%patch101 -p1
3c6e85
%patch102 -p1
3c6e85
%patch103 -p1
3c6e85
%patch104 -p1
3c6e85
%patch105 -p1
3c6e85
%patch106 -p1
3c6e85
%patch107 -p1
3c6e85
%patch108 -p1
3c6e85
%patch109 -p1
3c6e85
%patch110 -p1
3c6e85
%patch111 -p1
3c6e85
%patch112 -p1
3c6e85
%patch113 -p1
3c6e85
%patch114 -p1
3c6e85
%patch115 -p1
3c6e85
%patch116 -p1
3c6e85
%patch117 -p1
3c6e85
%patch118 -p1
3c6e85
%patch119 -p1
3c6e85
%patch120 -p1
3c6e85
%patch121 -p1
3c6e85
%patch122 -p1
3c6e85
%patch123 -p1
3c6e85
%patch124 -p1
3c6e85
%patch125 -p1
3c6e85
%patch126 -p1
3c6e85
%patch127 -p1
3c6e85
%patch128 -p1
3c6e85
%patch129 -p1
3c6e85
%patch130 -p1
3c6e85
%patch131 -p1
3c6e85
%patch132 -p1
3c6e85
%patch133 -p1
3c6e85
%patch134 -p1
3c6e85
%patch135 -p1
3c6e85
%patch136 -p1
3c6e85
%patch137 -p1
3c6e85
%patch138 -p1
3c6e85
%patch139 -p1
3c6e85
%patch140 -p1
3c6e85
%patch141 -p1
3c6e85
%patch142 -p1
3c6e85
%patch143 -p1
3c6e85
%patch144 -p1
3c6e85
%patch145 -p1
3c6e85
%patch146 -p1
3c6e85
%patch147 -p1
3c6e85
%patch148 -p1
3c6e85
%patch149 -p1
3c6e85
%patch150 -p1
3c6e85
%patch151 -p1
3c6e85
%patch152 -p1
3c6e85
%patch153 -p1
3c6e85
set -- *
3c6e85
mkdir source
3c6e85
mv "$@" source/
3c6e85
mkdir obj
3c6e85
3c6e85
%build
3c6e85
rm -rf obj
3c6e85
cp -r source obj
3c6e85
3c6e85
PWD_PATH="$PWD"
3c6e85
%if "%{workaround_no_pwd_rel_path}" != "1"
3c6e85
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
3c6e85
%endif
3c6e85
%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \
3c6e85
	NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi" \
3c6e85
	EXTRA_CFLAGS="%{nil}" \
3c6e85
	%{nil}
3c6e85
# mark modules executable so that strip-to-file can strip them
3c6e85
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
3c6e85
3c6e85
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
3c6e85
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
3c6e85
	# update depmod.conf
3c6e85
	module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//')
3c6e85
	if [ -z "$module_weak_path" ]; then
3c6e85
		module_weak_path=%{name}
3c6e85
	else
3c6e85
		module_weak_path=%{name}/$module_weak_path
3c6e85
	fi
3c6e85
	echo "override $(echo $modules | sed 's/.*\///')" \
3c6e85
	     "$(echo "%{kmod_kernel_version_dep}" |
3c6e85
	        sed 's/\.[^\.]*$//;
3c6e85
		     s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \
3c6e85
		     "weak-updates/$module_weak_path" >> source/depmod.conf
3c6e85
3c6e85
	# update greylist
3c6e85
	nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' |  sed 's/^\.//' | sort -u | while read -r symbol; do
3c6e85
		grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
3c6e85
	done
3c6e85
done
3c6e85
sort -u source/greylist | uniq > source/greylist.txt
3c6e85
3c6e85
%install
3c6e85
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
3c6e85
export INSTALL_MOD_DIR=%{kmod_install_path}
3c6e85
PWD_PATH="$PWD"
3c6e85
%if "%{workaround_no_pwd_rel_path}" != "1"
3c6e85
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
3c6e85
%endif
3c6e85
make -C %{kernel_source} modules_install \
3c6e85
	M=$PWD_PATH/obj/%{kmod_kbuild_dir}
3c6e85
# Cleanup unnecessary kernel-generated module dependency files.
3c6e85
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
3c6e85
3c6e85
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
3c6e85
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt
3c6e85
%if 0
3c6e85
%{FIRMWARE_FILES_INSTALL}
3c6e85
%endif
3c6e85
%if 0%{kmod_devel_package}
3c6e85
install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers
3c6e85
%endif
3c6e85
3c6e85
%clean
3c6e85
rm -rf $RPM_BUILD_ROOT
3c6e85
3c6e85
%changelog
3c6e85
* Tue Jan 07 2020 Eugene Syromiatnikov <esyr@redhat.com> 10.01.00.20.07.8_k_dup7.7-2
3c6e85
- Rebuild due to issues with brew environment
3c6e85
3c6e85
* Mon Jan 06 2020 Eugene Syromiatnikov <esyr@redhat.com> 10.01.00.20.07.8_k_dup7.7-1
3c6e85
- c45db7d2f34d6fad924c20443f73147dca7f6e29
3c6e85
- qla2xxx kernel module for Driver Update Program
3c6e85
- Resolves: #bz1784769