File rtw88.spec of Package rtw88

#
# spec file for package rtw88
#
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#
# needssslcertforbuild



Name:		rtw88
Summary:	RTW88 supports many Realtek chips
Version:	5.16~112.g52072d8
Release:	0
Group:		System/Kernel
License:	GPL-2.0
Url:		https://github.com/lwfinger/rtw88
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
Source0:	%{name}-%{version}.tar
Source1:	preamble
Source2:	rtw88-rpmlintrc
Patch0:		Makefile.patch
Patch1:		kernel615.patch
#Patch2:		kernel616.patch
#Patch3:		leap.patch

Obsoletes:  %{name}-kmp-default

BuildRequires:      %{kernel_module_package_buildreqs}
BuildRequires:      pesign-obs-integration

%kernel_module_package -n rtw88 -x debug -x trace -c %{_sourcedir}/_projectcert.crt -p %{_sourcedir}/preamble

%description
This is a downstream repo with a primary purpose of supporting development, testing and maintenance for the Realtek rtw88 series of WiFi 5 drivers in the Linux kernel.

Compatibility

Compatible with Linux kernel versions 5.4 and newer as long as your distro hasn't modified any kernel APIs. RHEL and all distros based on RHEL will have modified kernel APIs and are unlikely to be compatible with this driver.
Supported Chipsets

    PCIe: RTL8723DE, RTL8814AE, RTL8821CE, RTL8822BE, RTL8822CE
    SDIO: RTL8723CS, RTL8723DS, RTL8821CS, RTL8822BS, RTL8822CS
    USB : RTL8723DU, RTL8811AU, RTL8811CU, RTL8812AU, RTL8812BU, RTL8812CU
    USB : RTL8814AU, RTL8821AU, RTL8821CU, RTL8822BU, RTL8822CU

%package blacklist-rtw88
Summary:        To favour rtw blacklist the rtw88 device driver
Group:          Hardware/Wifi
Requires:       %{name}-kmp = %{version}

%description blacklist-rtw88
The rtw88 kernel module has to be
blacklisted to enable the system to load the new device driver rtw.

%prep
%setup -q

%patch -P 0 -p1
%patch -P 1 -p1
#%patch -P 2 -p1
#%patch -P 3 -p1


set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
export CONFIG_RTW88=m
for flavor in %{flavors_to_build}; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
    make %{?_smp_mflags} -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules \
    M=$PWD/obj/$flavor
done

%install
#install the module
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates/RTW88/
export CONFIG_RTW88=m
export BRP_PESIGN_FILES='*.ko'
export BRP_PESIGN_COMPRESS_MODULE="zst"

for flavor in %{flavors_to_build}; do
	make -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules_install \
		M=$PWD/obj/$flavor
done

%{__mkdir_p} %{buildroot}%{_modprobedir}/
install -p -m0644 %{_builddir}/%{name}-%{version}/source/rtw88.conf %{buildroot}/%{_modprobedir}/
mv  %{buildroot}%{_modprobedir}/rtw88.conf %{buildroot}%{_modprobedir}/50-blacklist-rtw88.conf

%files blacklist-rtw88
%defattr(-, root, root)
%config %{_modprobedir}/50-blacklist-rtw88.conf

%changelog
openSUSE Build Service is sponsored by