File rtl8821ce.spec of Package rtl8821ce

# spec file for package rtl8821ce
# Copyright (c) 2024 Matthias Bach <>
# 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
# needssslcertforbuild

Name:           rtl8821ce
Version:        git20240327
Release:        1.13
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:	%kernel_module_package_buildreqs
BuildRequires:  pesign-obs-integration
BuildRequires:  bc

Summary:        Wlan-Driver for Realtek RTL8821CE 802.11ac WLAN Adapter
License:        GPL-2.0+
Group:          System/Kernel
Source0:        rtl8821ce-%{version}.tar.gz
Source1:        preamble
Patch0:         fix_build_system.patch
Patch1:         leap155.patch

Provides:   %{name} = %{version}
Obsoletes:  %{name} < %{version}
Conflicts:	%{name} = %{version}

%kernel_module_package -n rtl8821ce -x debug -x trace -c %_sourcedir/_projectcert.crt -p %_sourcedir/preamble

This is the Wlan-Driver for the Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter
ported from the Endless OS variant of the linux kernel.
Its named 8821ce.

Bugs: see

Driver is in kernel 5.9 but does not work, so you need also the blacklist rpm.

%package blacklist-rtw_8821ce
Summary:        To favour rtl8192ce blacklist the rtw_8821ce device driver
Group:          Hardware/Wifi
##BuildArch:      noarch
Requires:       %{name}-kmp = %{version}

%description blacklist-rtw_8821ce
The rtl8821ce is supported with kernel 5.9 by rtw88_8821ce, but this module does not work. To solve this the rtw_8821ce kernel module has to be
blacklisted to enable the system to load the new device driver 8821ce.

This rpm blacklists the rtw88_8821ce


%setup -q
%patch -P 0 -p1
%if 0%{?sle_version} == 150500
%patch -P 1 -p1

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

export EXTRA_CFLAGS='-DVERSION=\"%version\"'
export CONFIG_RTL8821CE=m
for flavor in %flavors_to_build; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
	make -C obj/$flavor KSRC=/usr/src/linux-obj/%_target_cpu/$flavor


#install the module
export INSTALL_MOD_DIR=updates
export CONFIG_RTL8821CE=m
export BRP_PESIGN_FILES='*.ko'

for flavor in %flavors_to_build; do
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \

%{__mkdir_p} %{buildroot}%{_sysconfdir}/modprobe.d/
cat > %{buildroot}%{_sysconfdir}/modprobe.d/50-blacklist-rtw_8821ce.conf<<-'EOF'
	blacklist rtw88_8821ce

%files blacklist-rtw_8821ce
%defattr(-, root, root)
%config %{_sysconfdir}/modprobe.d/50-blacklist-rtw_8821ce.conf
openSUSE Build Service is sponsored by