File kernel-xanmod-v3.spec of Package kernel-xanmod-v3
#
# spec file for the XanMod kernel (openSUSE Tumbleweed)
# Corrected and hardened version
#
# OBS services will automatically set the Version and Release.
Name: linux
Version: 0
Release: 0
Summary: Linux XanMod Edge Kernel optimized for x86-64-v3 with Waydroid support
License: GPL-2.0-only
Group: System/Kernel
URL: https://xanmod.org/
# Dynamic source name to match OBS service output
Source0: %{name}-%{version}.tar.xz
Source1: config.conf
Source2: waydroid-amd.fragment
# Corrected BuildRequires for openSUSE Tumbleweed
BuildRequires: bc
BuildRequires: bison
BuildRequires: cpio
BuildRequires: dwarves
BuildRequires: dracut
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: libelf-devel
BuildRequires: libopenssl-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pahole
BuildRequires: perl
BuildRequires: python3
BuildRequires: rsync
BuildRequires: xz
ExclusiveArch: x86_64
%global kernel_flavor xanmod-edge-x64v3
%description
The Linux XanMod Edge kernel with custom settings and new features, built to
provide a stable, responsive and smooth desktop experience. Optimized for
x86-64-v3 with Waydroid support.
%package devel
Summary: Development files for the kernel
Group: Development/Sources
Requires: %{name} = %{version}-%{release}
Provides: kernel-devel = %{version}
Provides: kernel-%{kernel_flavor}-devel = %{version}
%description devel
This package contains the kernel headers and makefiles sufficient to build
modules against the %name} kernel package.
%prep
# Robust setup that automatically handles the directory name
%setup -q
# Copy the base config correctly from Source1
echo "Using custom base config: %{SOURCE1}"
cp %{SOURCE1} .config
# Merge custom options (Waydroid/AMD)
echo "Merging custom options from %{SOURCE2}"
scripts/kconfig/merge_config.sh -m .config %{SOURCE2}
%build
# Set the correct architecture for a 64-bit build
%define ARCH_TYPE x86_64
# Refresh .config
make ARCH=%{ARCH_TYPE} olddefconfig
# Build kernel + modules
make %{?_smp_mflags} ARCH=%{ARCH_TYPE}
%install
%define ARCH_TYPE x86_64
# Compute kernel release
KREL=$(make -s ARCH=%{ARCH_TYPE} kernelrelease)
echo "Installing kernel with final release string: ${KREL}"
# Install kernel artifacts
install -d %{buildroot}/boot
install -m 0644 arch/%{ARCH_TYPE}/boot/bzImage %{buildroot}/boot/vmlinuz-${KREL}
install -m 0644 System.map %{buildroot}/boot/System.map-${KREL}
install -m 0644 .config %{buildroot}/boot/config-${KREL}
# Install modules directly under /usr/lib/modules, suppressing depmod
make %{?_smp_mflags} ARCH=%{ARCH_TYPE} \
INSTALL_MOD_PATH=%{buildroot}/usr \
DEPMOD=true \
modules_install
# Now, run depmod manually on the correctly placed modules
/sbin/depmod -a -b %{buildroot} ${KREL}
%post
# Use a reliable glob to find the kernel release (KREL) for dracut
for KDIR in /lib/modules/*xanmod*; do
if [ -d "${KDIR}" ]; then
KREL=$(basename "${KDIR}")
/usr/bin/dracut --force --kver "${KREL}"
fi
done
%postun
if [ "$1" = "0" ]; then
for KDIR in /lib/modules/*xanmod*; do
if [ -d "${KDIR}" ]; then
KREL=$(basename "${KDIR}")
/usr/bin/dracut --force --rm --kver "${KREL}"
fi
done
fi
%files
%defattr(-,root,root)
/boot/vmlinuz-*xanmod*
/boot/System.map-*xanmod*
/boot/config-*xanmod*
/usr/lib/modules/*xanmod*
%changelog
* Sun Aug 24 2025 itachi_re <xanbenson99@gmail.com>
- Corrected spec file for OBS build
- Fixed ARCH, source naming, and paths