#
# spec file for package Kernel live patch module
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

# needssslcertforbuild

%define variant %{nil}
%define with_klp_info 1

Name:           kernel-livepatch-SLE16_Update_0
Version:        11
Release:        1
%define module_num %(echo %version-%release | sed 'y/\./_/')
License:        GPL-2.0
Summary:        Kernel live patch module
Group:          System/Kernel
Source0:	uname_patch.tar.bz2
Source1:	Makefile
Source2:        livepatch_main.c
Source3:        config.sh
Source4:        source-timestamp
Source5:        shadow.h
Source6:	klp_syscalls.h
Source7:	klp_trace.h
Source8:	lp-mod-checks.sh
# Explicitly add vermagic and retpoline modinfo (bsc#1252270)
Source9999:     module-common.c
# Auto expanded KLP_PATCHES_SOURCES:
Source9:	bsc1246019.tar.bz2
Source10:	bsc1247240.tar.bz2
Source11:	bsc1248301.tar.bz2
Source12:	bsc1248400.tar.bz2
Source13:	bsc1248631.tar.bz2
Source14:	bsc1248670.tar.bz2
Source15:	bsc1248672.tar.bz2
Source16:	bsc1249205.tar.bz2
Source17:	bsc1249207.tar.bz2
Source18:	bsc1249208.tar.bz2
Source19:	bsc1249241.tar.bz2
Source20:	bsc1249480.tar.bz2
Source21:	bsc1249537.tar.bz2
Source22:	bsc1250190.tar.bz2
Source23:	bsc1250192.tar.bz2
Source24:	bsc1251956.tar.bz2
Source25:	bsc1251982.tar.bz2
Source26:	bsc1252036.tar.bz2
Source27:	bsc1252048.tar.bz2
Source28:	bsc1252689.tar.bz2
Source29:	bsc1253404.tar.bz2
Source30:	bsc1253415.tar.bz2
Source31:	bsc1253437.tar.bz2
Source32:	bsc1253439.tar.bz2
Source33:	bsc1253473.tar.bz2
Source34:	bsc1254196.tar.bz2
Source35:	bsc1255052.tar.bz2
Source36:	bsc1255053.tar.bz2
Source37:	bsc1255066.tar.bz2
Source38:	bsc1255378.tar.bz2
Source39:	bsc1255402.tar.bz2
Source40:	bsc1255895.tar.bz2
Source41:	bsc1256624.tar.bz2
Source42:	bsc1256644.tar.bz2
Source43:	bsc1256780.tar.bz2
Source44:	bsc1257238.tar.bz2
Source45:	bsc1257669.tar.bz2
Source46:	bsc1258005.tar.bz2
Source47:	bsc1258051.tar.bz2
Source48:	bsc1258183.tar.bz2
Source49:	bsc1258655.tar.bz2
Source50:	bsc1258784.tar.bz2
Source51:	bsc1259126.tar.bz2
Source52:	bsc1259859.tar.bz2
Source53:	bsc1261630.tar.bz2
Source54:	bsc1261845.tar.bz2
Source55:	bsc1263689.tar.bz2
# Use kernel-<flavor> specific build dependencies instead of kernel-syms (bsc#1248108)
%if "%variant" != ""
BuildRequires:  kernel%variant-devel
%else
BuildRequires:  kernel-default-devel
%endif
BuildRequires:  pesign-obs-integration
BuildRequires:  kernel-livepatch-tools-devel
BuildRequires:  libelf-devel
ExclusiveArch:	x86_64 ppc64le s390x
%klp_module_package

%description
This is a live patch for SUSE Linux Enterprise Server kernel.

Source timestamp: 2026-05-04 07:07:48 +0200
GIT Revision: dace56220a34aa1d47f07dc7e19461df4a9f991f
GIT Branch: SLE16_Update_0

%prep
%setup -c
# Auto expanded KLP_PATCHES_SETUP_SOURCES:
%setup -T -D -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24 -a 25 -a 26 -a 27 -a 28 -a 29 -a 30 -a 31 -a 32 -a 33 -a 34 -a 35 -a 36 -a 37 -a 38 -a 39 -a 40 -a 41 -a 42 -a 43 -a 44 -a 45 -a 46 -a 47 -a 48 -a 49 -a 50 -a 51 -a 52 -a 53 -a 54 -a 55
cp %_sourcedir/livepatch_main.c .
cp %_sourcedir/shadow.h .
cp %_sourcedir/Makefile .
cp %_sourcedir/klp_syscalls.h .
cp %_sourcedir/klp_trace.h .
# Explicitly add vermagic and retpoline modinfo (bsc#1252270)
cp %_sourcedir/module-common.c .

%build
sed -i 's/@@RPMRELEASE@@/%module_num/g' Makefile
sed -i 's/@@RPMRELEASE@@/%module_num/g' livepatch_main.c
echo 'livepatch-%module_num' >Module.supported
set -- *

mkdir -p "obj/%flavor"
cp -r "$@" "obj/%flavor"
make -C %{kernel_source %flavor} M="$PWD/obj/%flavor" modules

for module in $(find "obj/%flavor" -name '*.ko'); do
    /bin/sh %_sourcedir/lp-mod-checks.sh "$module"

    # Generate klp info cache when supported.
    touch info.list
    if test -n "%{?klp_package_name}" ; then
	MODNAME=$(/usr/sbin/modinfo -F name "$module")
	MODSRCVERSION=$(/usr/sbin/modinfo -F srcversion "$module")
	klp rpm_changes_to_klp_info %{_sourcedir}/%{name}.changes \
	    %{klp_package_name}-%{version}-%{release}.%{_arch} \
	    ${MODNAME}-${MODSRCVERSION}
	echo "${MODNAME}-${MODSRCVERSION}" >>info.list
    fi
done

%install
export INSTALL_MOD_DIR=livepatch
export INSTALL_MOD_PATH=%buildroot

make -C %{kernel_source %flavor} M="$PWD/obj/%flavor" modules_install

# Install klp info cache when any.
for info in $(cat info.list) ; do
    install -D -m0644 "$info" %{buildroot}/%{_datadir}/livepatch/info/"$info"
done

%changelog

