import kmod-redhat-oracleasm-2.0.8-11.el8
This commit is contained in:
parent
f015e62323
commit
78f5a7eb81
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
||||
SOURCES/kernel-devel-4.18.0-240.14.1.el8_3.x86_64.rpm
|
||||
SOURCES/oracleasm-redhat-2.0.8.tar.bz2
|
||||
|
@ -1,2 +1 @@
|
||||
94f89a89a32ecb9d00a5953fd491d7f08d828d4b SOURCES/kernel-devel-4.18.0-240.14.1.el8_3.x86_64.rpm
|
||||
3a00ac2e8cd321e9244cff96bcd52b1401a5b9c9 SOURCES/oracleasm-redhat-2.0.8.tar.bz2
|
||||
3f7008b7f30674a0078edda3e8d32941578dae21 SOURCES/oracleasm-redhat-2.0.8.tar.bz2
|
||||
|
@ -1,63 +0,0 @@
|
||||
From 21a2130b7a9c10d8f36d130420a43db4e363b41f Mon Sep 17 00:00:00 2001
|
||||
From: Ming Lei <ming.lei@redhat.com>
|
||||
Date: Wed, 16 Sep 2020 10:54:38 +0800
|
||||
Subject: [PATCH 1/3] oracleasm: driver: replace fs_context with mount_pseudo
|
||||
|
||||
Signed-off-by: Ming Lei <ming.lei@redhat.com>
|
||||
---
|
||||
drivers/block/oracleasm/driver.c | 19 ++++++-------------
|
||||
1 file changed, 6 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/drivers/block/oracleasm/driver.c b/drivers/block/oracleasm/driver.c
|
||||
index 50f2333..7844036 100644
|
||||
--- a/drivers/block/oracleasm/driver.c
|
||||
+++ b/drivers/block/oracleasm/driver.c
|
||||
@@ -66,7 +66,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/mount.h>
|
||||
-#include <linux/pseudo_fs.h>
|
||||
#include <linux/parser.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/compat.h>
|
||||
@@ -333,22 +332,16 @@ static struct super_operations asmdisk_sops = {
|
||||
.evict_inode = asmdisk_evict_inode,
|
||||
};
|
||||
|
||||
-
|
||||
-static int asmdisk_init_fs_context(struct fs_context *fc)
|
||||
+struct dentry *asmdisk_mount(struct file_system_type *fs_type,
|
||||
+ int flags, const char *dev_name, void *data)
|
||||
{
|
||||
- struct pseudo_fs_context *ctx = init_pseudo(fc, 0x61736D64);
|
||||
-
|
||||
- if (!ctx)
|
||||
- return -ENOMEM;
|
||||
- ctx->ops = &asmdisk_sops;
|
||||
-
|
||||
- return 0;
|
||||
+ return mount_pseudo(fs_type, "asmdisk:", &asmdisk_sops, NULL, 0x61736D64);
|
||||
}
|
||||
|
||||
static struct file_system_type asmdisk_type = {
|
||||
.name = "asmdisk",
|
||||
.kill_sb = kill_anon_super,
|
||||
- .init_fs_context = asmdisk_init_fs_context,
|
||||
+ .mount = asmdisk_mount,
|
||||
};
|
||||
|
||||
static struct vfsmount *asmdisk_mnt;
|
||||
@@ -2733,8 +2726,8 @@ static void __exit exit_asmfs_fs(void)
|
||||
destroy_inodecache();
|
||||
}
|
||||
|
||||
-module_init(init_asmfs_fs)
|
||||
-module_exit(exit_asmfs_fs)
|
||||
+module_init(init_asmfs_fs);
|
||||
+module_exit(exit_asmfs_fs);
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(ASM_MODULE_VERSION);
|
||||
MODULE_AUTHOR("Joel Becker, Martin K. Petersen <martin.petersen@oracle.com>");
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,162 +0,0 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# This script is called during external module building to create dependencies
|
||||
# both upon the RHEL kernel, and on additional external modules. Symbols that
|
||||
# cannot be reconciled against those provided by the kernel are assumed to be
|
||||
# provided by an external module and "ksym" replaces th regular "kernel" dep.
|
||||
|
||||
IFS=$'\n'
|
||||
|
||||
# Extract all of the symbols provided by this module.
|
||||
all_provides() {
|
||||
for module in "$@"; do
|
||||
tmpfile=""
|
||||
if [ "x${module%.ko}" = "x${module}" ]; then
|
||||
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
||||
proc_bin=
|
||||
case "${module##*.}" in
|
||||
xz)
|
||||
proc_bin=xz
|
||||
;;
|
||||
bz2)
|
||||
proc_bin=bzip2
|
||||
;;
|
||||
gz)
|
||||
proc_bin=gzip
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$proc_bin" ] || continue
|
||||
|
||||
"$proc_bin" -d -c - < "$module" > "$tmpfile" || continue
|
||||
module="$tmpfile"
|
||||
fi
|
||||
|
||||
if [[ -n $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
|
||||
nm "$module" \
|
||||
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
||||
| awk --non-decimal-data '{printf("%s:0x%08x\n", $2, $1)}'
|
||||
else
|
||||
ELFRODATA=$(readelf -R .rodata "$module" | awk '/0x/{printf $2$3$4$5}')
|
||||
if [[ -n $(readelf -h "$module" | grep "little endian") ]]; then
|
||||
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
|
||||
else
|
||||
RODATA=$ELFRODATA
|
||||
fi
|
||||
for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
|
||||
echo $sym $RODATA
|
||||
done \
|
||||
| awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}'
|
||||
fi
|
||||
|
||||
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
|
||||
done \
|
||||
| LC_ALL=C sort -k1,1 -u
|
||||
}
|
||||
|
||||
# Extract all of the requirements of this module.
|
||||
all_requires() {
|
||||
for module in "$@"; do
|
||||
set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
|
||||
/sbin/modprobe --dump-modversions "$module" \
|
||||
| awk --non-decimal-data '
|
||||
BEGIN { FS = "\t" ; OFS = "\t" }
|
||||
{printf("%s:0x%08x\n", $2, $1)}' \
|
||||
| sed -r -e 's:$:\t'"$1"':'
|
||||
done \
|
||||
| LC_ALL=C sort -k1,1 -u
|
||||
}
|
||||
|
||||
# Filter out requirements fulfilled by the module itself.
|
||||
mod_requires() {
|
||||
LC_ALL=C join -t $'\t' -j 1 -v 1 \
|
||||
<(all_requires "$@") \
|
||||
<(all_provides "$@") \
|
||||
| LC_ALL=C sort -k1,1 -u
|
||||
}
|
||||
|
||||
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
|
||||
cat > /dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
check_kabi() {
|
||||
arch=$(uname -m)
|
||||
kabi_file="/lib/modules/kabi-current/kabi_whitelist_$arch"
|
||||
|
||||
# If not installed, output a warning and return (continue)
|
||||
if [ ! -f "$kabi_file" ]; then
|
||||
echo "" >&2
|
||||
echo "********************************************************************************" >&2
|
||||
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
||||
echo "********************************************************************************" >&2
|
||||
echo "The kernel ABI reference files (provided by "kabi-whitelists") were not found." >&2
|
||||
echo "No compatibility check was performed. Please install the kABI reference files" >&2
|
||||
echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2
|
||||
echo "" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
unset non_kabi
|
||||
for symbol in "$@"; do
|
||||
if ! egrep "^[[:space:]]$symbol\$" $kabi_file >/dev/null; then
|
||||
non_kabi=("${non_kabi[@]}" "$symbol")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#non_kabi[@]} -gt 0 ]; then
|
||||
echo "" >&2
|
||||
echo "********************************************************************************" >&2
|
||||
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
||||
echo "********************************************************************************" >&2
|
||||
echo "The following kernel symbols are not guaranteed to remain compatible with" >&2
|
||||
echo "future kernel updates to this RHEL release:" >&2
|
||||
echo "" >&2
|
||||
for symbol in "${non_kabi[@]}"; do
|
||||
printf "\t$symbol\n" >&2
|
||||
done
|
||||
echo "" >&2
|
||||
echo "Red Hat recommends that you consider using only official kernel ABI symbols" >&2
|
||||
echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2
|
||||
echo "your partner or customer representative (component: driver-update-program)." >&2
|
||||
echo "" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'))
|
||||
if [ ${#modules[@]} -gt 0 ]; then
|
||||
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
|
||||
|
||||
# get all that kernel provides
|
||||
symvers=$(mktemp -t ${0##*/}.XXXXX)
|
||||
|
||||
symvers_path="/usr/src/kernels/$kernel/Module.symvers"
|
||||
bundled_path="$(echo "${modules[0]}" | sed "s|/BUILDROOT/\([^/]*\)-[^/]*/.*|/BUILD/\1/usr/src/kernels/$kernel/Module.symvers|")"
|
||||
echo "Bundled: $bundled_path" >&2
|
||||
if [ -e $bundled_path ]; then
|
||||
symvers_path="$bundled_path"
|
||||
fi
|
||||
|
||||
cat "$symvers_path" | awk '
|
||||
BEGIN { FS = "\t" ; OFS = "\t" }
|
||||
{ print $2 ":" $1 }
|
||||
' \
|
||||
| sed -r -e 's:$:\t'"$kernel"':' \
|
||||
| LC_ALL=C sort -k1,1 -u > $symvers
|
||||
|
||||
# Symbols matching with the kernel get a "kernel" dependency
|
||||
mod_req=$(mktemp -t mod_req.XXXXX)
|
||||
mod_requires "${modules[@]}" > "$mod_req"
|
||||
LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \
|
||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
|
||||
|
||||
# Symbols from elsewhere get a "ksym" dependency
|
||||
LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | LC_ALL=C sort -u \
|
||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }'
|
||||
|
||||
# Check kABI if the kabi-whitelists package is installed
|
||||
# Do this last so we can try to output this error at the end
|
||||
kabi_check_symbols=($(LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \
|
||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }'))
|
||||
check_kabi "${kabi_check_symbols[@]}"
|
||||
fi
|
@ -3,45 +3,33 @@
|
||||
%define kmod_rpm_name kmod-redhat-oracleasm
|
||||
%define kmod_driver_version 2.0.8
|
||||
%define kmod_driver_epoch 8
|
||||
%define kmod_rpm_release 1.3
|
||||
%define kmod_kernel_version 4.18.0-240.el8
|
||||
%define kmod_kernel_version_min 4.18.0-240.el8
|
||||
%define kmod_rpm_release 11
|
||||
%define kmod_kernel_version 4.18.0-286.el8
|
||||
%define kmod_kernel_version_min 4.18.0-286.el8
|
||||
%define kmod_kernel_version_dep 4.18.0
|
||||
%define kmod_kbuild_dir drivers/block/oracleasm
|
||||
%define kmod_provides %{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} %{kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
%define kmod_install_path extra/kmod-redhat-oracleasm
|
||||
%define kernel_pkg kernel
|
||||
%define kernel_devel_pkg kernel-devel
|
||||
%define kernel_modules_pkg kernel-modules
|
||||
|
||||
%define kmod_rpm_name_ga %{kmod_rpm_name}-kernel_4_18_0_240
|
||||
|
||||
%define kmod_rpm_name_14_1 %{kmod_rpm_name}-kernel_4_18_0_240_14_1
|
||||
%define kmod_kernel_version_14_1 4.18.0-240.14.1.el8_3
|
||||
|
||||
%define kmod_list %{kmod_rpm_name_ga}:%{kmod_kernel_version}: %{kmod_rpm_name_14_1}:%{kmod_kernel_version_14_1}:%{SOURCE1}
|
||||
|
||||
%{!?dist: %define dist .el8_3}
|
||||
%{!?dist: %define dist .el8_4}
|
||||
%{!?make_build: %define make_build make}
|
||||
|
||||
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod
|
||||
%if "%{kmod_kernel_version_dep}" == ""
|
||||
%define kmod_kernel_version_dep %{kmod_kernel_version}
|
||||
%endif
|
||||
|
||||
|
||||
Source0: %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2
|
||||
# Source code patches
|
||||
Patch0: 0000-Makefile-config-opts.patch
|
||||
Patch1: 0001-oracleasm-driver-replace-fs_context-with-mount_pseud.patch
|
||||
#Patch1: 0001-oracleasm-driver-replace-fs_context-with-mount_pseud.patch
|
||||
Patch2: 0002-oracleasm-driver-make-bio_for_each_segment_all-worki.patch
|
||||
Patch3: 0003-oracleasm-copy-rhel8-s-bio_map_user_iov.patch
|
||||
|
||||
Source1: kernel-devel-%{kmod_kernel_version_14_1}.x86_64.rpm
|
||||
|
||||
Source9000: find-requires.ksyms
|
||||
|
||||
%define findpat %( echo "%""P" )
|
||||
# We bundle our own slightly modified version of find-requires.ksyms in order
|
||||
# to get kernel() Requires: for the kmod versions build against bundled
|
||||
# kernel-devel packages to be generated properly.
|
||||
%define __find_requires "%{SOURCE9000}"
|
||||
%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms
|
||||
%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi )
|
||||
%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups
|
||||
@ -60,234 +48,160 @@ Group: System/Kernel
|
||||
License: GPLv2
|
||||
URL: https://github.com/oracle/linux-uek/tree/uek6/master/drivers/block/oracleasm
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
BuildRequires: %{kmod_dist_build_deps}
|
||||
# For unpacking bundled kernel-devel packages
|
||||
BuildRequires: rpm cpio
|
||||
BuildRequires: %kernel_devel_pkg = %kmod_kernel_version
|
||||
BuildRequires: redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod
|
||||
ExclusiveArch: x86_64
|
||||
%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch)
|
||||
|
||||
%global _use_internal_dependency_generator 0
|
||||
Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
|
||||
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Provides: %{kmod_provides}
|
||||
Provides: %{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Provides: %{kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Requires(post): %{sbindir}/weak-modules
|
||||
Requires(postun): %{sbindir}/weak-modules
|
||||
Requires: kernel >= 4.18.0-240.el8
|
||||
# if there are multiple kmods for the same driver from different vendors,
|
||||
# they should conflict with each other.
|
||||
Conflicts: kmod-%{kmod_name}
|
||||
|
||||
# Set Requires: based on kernel version(s) installed
|
||||
# "with" is important here: otherwise, ">=" and "<" parts maybe satisfied
|
||||
# by different versions that are installed simultaneously (for example,
|
||||
# 4.18.0-290 and 4.18.0-80, respectively).
|
||||
Requires: (%{kmod_rpm_name_ga} if (kernel >= %{kmod_kernel_version} with kernel < %{kmod_kernel_version_14_1}))
|
||||
Requires: (%{kmod_rpm_name_14_1} if kernel >= %{kmod_kernel_version_14_1})
|
||||
|
||||
%description
|
||||
oracleasm kernel module
|
||||
|
||||
%package -n %{kmod_rpm_name_ga}
|
||||
Summary: oracleasm kernel module for kernel version %{kmod_kernel_version}..%{kmod_kernel_version_14_1}
|
||||
Provides: %kernel_modules_pkg >= %{kmod_kernel_version_14_1}.%{_target_cpu}
|
||||
BuildRequires: %kernel_devel_pkg = %kmod_kernel_version
|
||||
Requires: %{kmod_rpm_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Requires(post): %{sbindir}/weak-modules
|
||||
Requires(postun): %{sbindir}/weak-modules
|
||||
Requires: kernel >= %{kmod_kernel_version}
|
||||
%post
|
||||
modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') )
|
||||
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs
|
||||
|
||||
%description -n %{kmod_rpm_name_ga}
|
||||
oracleasm kernel module for kernel version %{kmod_kernel_version_14_1} and higher.
|
||||
mkdir -p "%{kver_state_dir}"
|
||||
touch "%{kver_state_file}"
|
||||
|
||||
%package -n %{kmod_rpm_name_14_1}
|
||||
Summary: oracleasm kernel module for kernel version %{kmod_kernel_version_14_1} and higher
|
||||
Provides: %kernel_modules_pkg >= %{kmod_kernel_version_14_1}.%{_target_cpu}
|
||||
## We can't have nice things (such as multiple kernel package versions in a brew
|
||||
## buildroot despite its parallel installability, even), so we bundle it
|
||||
## in Source1.
|
||||
#BuildRequires: %kernel_devel_pkg = %kmod_kernel_version_14_1
|
||||
Requires: %{kmod_rpm_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Requires(post): %{sbindir}/weak-modules
|
||||
Requires(postun): %{sbindir}/weak-modules
|
||||
Requires: kernel >= %{kmod_kernel_version_14_1}
|
||||
exit 0
|
||||
|
||||
%description -n %{kmod_rpm_name_14_1}
|
||||
oracleasm kernel module for kernel version %{kmod_kernel_version_14_1} and higher.
|
||||
%posttrans
|
||||
# We have to re-implement part of weak-modules here because it doesn't allow
|
||||
# calling initramfs regeneration separately
|
||||
if [ -f "%{kver_state_file}" ]; then
|
||||
kver_base="%{kmod_kernel_version_dep}"
|
||||
kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*)
|
||||
|
||||
# Usage: kmod_scripts RPMNAME KVER
|
||||
%define kmod_scripts() %{expand: \
|
||||
%files -n %1 \
|
||||
%defattr(644,root,root,755) \
|
||||
/lib/modules/%2.%(arch) \
|
||||
%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt.%2 \
|
||||
\
|
||||
%post -n %1 \
|
||||
kver="%2" \
|
||||
modules=( $(find /lib/modules/${kver}.%(arch)/%{kmod_install_path} | grep '\.ko$') ) \
|
||||
printf '%s\\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs \
|
||||
\
|
||||
mkdir -p "%{kver_state_dir}" \
|
||||
touch "%{kver_state_dir}/${kver}.%(arch)" \
|
||||
\
|
||||
exit 0 \
|
||||
\
|
||||
%posttrans -n %1 \
|
||||
# We have to re-implement part of weak-modules here because it doesn't allow \
|
||||
# calling initramfs regeneration separately \
|
||||
kver="%2" \
|
||||
kver_state_file="%{kver_state_dir}/${kver}.%(arch)" \
|
||||
if [ -f "${kver_state_file}" ]; then \
|
||||
kver_base="%{kmod_kernel_version_dep}" \
|
||||
kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*) \
|
||||
\
|
||||
for k_dir in $kvers; do \
|
||||
k="${k_dir#/lib/modules/}" \
|
||||
\
|
||||
tmp_initramfs="/boot/initramfs-$k.tmp" \
|
||||
dst_initramfs="/boot/initramfs-$k.img" \
|
||||
\
|
||||
# The same check as in weak-modules: we assume that the kernel present \
|
||||
# if the symvers file exists. \
|
||||
if [ -e "/boot/symvers-$k.gz" ] || [ -e "$k_dir/symvers.gz" ]; then \
|
||||
/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1 \
|
||||
cmp -s "$tmp_initramfs" "$dst_initramfs" \
|
||||
if [ "$?" = 1 ]; then \
|
||||
mv "$tmp_initramfs" "$dst_initramfs" \
|
||||
else \
|
||||
rm -f "$tmp_initramfs" \
|
||||
fi \
|
||||
fi \
|
||||
done \
|
||||
\
|
||||
rm -f "%{kver_state_dir}/${kver}.%(arch)" \
|
||||
rmdir "%{kver_state_dir}" 2> /dev/null \
|
||||
fi \
|
||||
\
|
||||
rmdir "%{dup_state_dir}" 2> /dev/null \
|
||||
\
|
||||
exit 0 \
|
||||
\
|
||||
\
|
||||
%preun -n "%1" \
|
||||
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then \
|
||||
kver="%2" \
|
||||
mkdir -p "%{kver_state_dir}" \
|
||||
touch "%{kver_state_dir}/${kver}.%(arch)" \
|
||||
fi \
|
||||
\
|
||||
mkdir -p "%{dup_state_dir}" \
|
||||
rpm -ql "%1-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.%(arch)" | \\\
|
||||
grep '\\.ko$' > "%{dup_module_list}" \
|
||||
\
|
||||
exit 0 \
|
||||
\
|
||||
\
|
||||
%postun -n %1 \
|
||||
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then \
|
||||
initramfs_opt="--no-initramfs" \
|
||||
else \
|
||||
initramfs_opt="" \
|
||||
fi \
|
||||
\
|
||||
modules=( $(cat "%{dup_module_list}") ) \
|
||||
rm -f "%{dup_module_list}" \
|
||||
printf '%s\\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt \
|
||||
\
|
||||
rmdir "%{dup_state_dir}" 2> /dev/null \
|
||||
\
|
||||
exit 0 \
|
||||
}
|
||||
for k_dir in $kvers; do
|
||||
k="${k_dir#/lib/modules/}"
|
||||
|
||||
%kmod_scripts %{kmod_rpm_name_ga} %{kmod_kernel_version}
|
||||
%kmod_scripts %{kmod_rpm_name_14_1} %{kmod_kernel_version_14_1}
|
||||
tmp_initramfs="/boot/initramfs-$k.tmp"
|
||||
dst_initramfs="/boot/initramfs-$k.img"
|
||||
|
||||
# The same check as in weak-modules: we assume that the kernel present
|
||||
# if the symvers file exists.
|
||||
if [ -e "/boot/symvers-$k.gz" ] || [ -e "$k_dir/symvers.gz" ]; then
|
||||
/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
|
||||
cmp -s "$tmp_initramfs" "$dst_initramfs"
|
||||
if [ "$?" = 1 ]; then
|
||||
mv "$tmp_initramfs" "$dst_initramfs"
|
||||
else
|
||||
rm -f "$tmp_initramfs"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f "%{kver_state_file}"
|
||||
rmdir "%{kver_state_dir}" 2> /dev/null
|
||||
fi
|
||||
|
||||
rmdir "%{dup_state_dir}" 2> /dev/null
|
||||
|
||||
exit 0
|
||||
|
||||
%preun
|
||||
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
|
||||
mkdir -p "%{kver_state_dir}"
|
||||
touch "%{kver_state_file}"
|
||||
fi
|
||||
|
||||
mkdir -p "%{dup_state_dir}"
|
||||
rpm -ql kmod-redhat-oracleasm-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \
|
||||
grep '\.ko$' > "%{dup_module_list}"
|
||||
|
||||
%postun
|
||||
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
|
||||
initramfs_opt="--no-initramfs"
|
||||
else
|
||||
initramfs_opt=""
|
||||
fi
|
||||
|
||||
modules=( $(cat "%{dup_module_list}") )
|
||||
rm -f "%{dup_module_list}"
|
||||
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt
|
||||
|
||||
rmdir "%{dup_state_dir}" 2> /dev/null
|
||||
|
||||
exit 0
|
||||
|
||||
%files
|
||||
%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt
|
||||
%defattr(644,root,root,755)
|
||||
/lib/modules/%{kmod_kernel_version}.%(arch)
|
||||
/etc/depmod.d/%{kmod_name}.conf
|
||||
%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt
|
||||
|
||||
|
||||
|
||||
%prep
|
||||
# A hack for having directory name under builddir equivalent to RPM name
|
||||
%setup -c
|
||||
mv %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}/* .
|
||||
%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
#%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
set -- *
|
||||
mkdir source
|
||||
mv "$@" source/
|
||||
|
||||
# Unpacking bundled kernel-devel packages
|
||||
for name_kver in %{kmod_list}; do
|
||||
src="${name_kver##*:}"
|
||||
[ -n "$src" ] || continue
|
||||
rpm2cpio "${src}" | cpio -idm
|
||||
done
|
||||
mkdir obj
|
||||
|
||||
%build
|
||||
rm -rf obj
|
||||
cp -r source obj
|
||||
|
||||
for name_kver in %{kmod_list}; do
|
||||
kver="${name_kver#*:}"
|
||||
kver="${kver%%:*}"
|
||||
src="${name_kver##*:}"
|
||||
PWD_PATH="$PWD"
|
||||
%if "%{workaround_no_pwd_rel_path}" != "1"
|
||||
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
|
||||
%endif
|
||||
%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \
|
||||
NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi %{nil}" \
|
||||
EXTRA_CFLAGS="%{nil}" \
|
||||
%{nil}
|
||||
# mark modules executable so that strip-to-file can strip them
|
||||
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
|
||||
|
||||
rm -rf obj.${kver}
|
||||
cp -r source obj.${kver}
|
||||
echo > source/greylist
|
||||
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
|
||||
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
|
||||
# update depmod.conf
|
||||
module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//')
|
||||
if [ -z "$module_weak_path" ]; then
|
||||
module_weak_path=%{name}
|
||||
else
|
||||
module_weak_path=%{name}/$module_weak_path
|
||||
fi
|
||||
echo "override $(echo $modules | sed 's/.*\///')" \
|
||||
"$(echo "%{kmod_kernel_version_dep}" |
|
||||
sed 's/\.[^\.]*$//;
|
||||
s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \
|
||||
"weak-updates/$module_weak_path" >> source/depmod.conf
|
||||
|
||||
kernel_source="${src:+.}/usr/src/kernels/${kver}.%(arch)"
|
||||
kernel_source="$(realpath "${kernel_source}")"
|
||||
PWD_PATH=$(realpath --relative-to="${kernel_source}" . 2>/dev/null || echo "$PWD")
|
||||
%{make_build} -C ${kernel_source} V=1 M="$PWD_PATH/obj.${kver}/%{kmod_kbuild_dir}" \
|
||||
NOSTDINC_FLAGS="-I$PWD_PATH/obj.${kver}/include -I$PWD_PATH/obj.${kver}/include/uapi %{nil}" \
|
||||
EXTRA_CFLAGS="%{nil}" \
|
||||
%{nil}
|
||||
# mark modules executable so that strip-to-file can strip them
|
||||
find obj.${kver}/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
|
||||
|
||||
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
|
||||
for modules in $( find obj.${kver}/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
|
||||
# update depmod.conf
|
||||
module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//')
|
||||
if [ -z "$module_weak_path" ]; then
|
||||
module_weak_path=%{name}
|
||||
else
|
||||
module_weak_path=%{name}/$module_weak_path
|
||||
fi
|
||||
echo "override $(echo $modules | sed 's/.*\///')" \
|
||||
"$(echo "%{kmod_kernel_version_dep}" |
|
||||
sed 's/\.[^\.]*$//;
|
||||
s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \
|
||||
"weak-updates/$module_weak_path" >> source/depmod.conf
|
||||
|
||||
# update greylist
|
||||
nm -u obj.${kver}/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
|
||||
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
|
||||
done
|
||||
# update greylist
|
||||
nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
|
||||
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
|
||||
done
|
||||
sort -u source/greylist | uniq > source/greylist.txt.${kver}
|
||||
|
||||
[ "x${kver}" != "x%{kmod_kernel_version}" ] || cp source/greylist.txt.${kver} source/greylist.txt
|
||||
done
|
||||
sort -u source/greylist | uniq > source/greylist.txt
|
||||
|
||||
%install
|
||||
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
|
||||
export INSTALL_MOD_DIR=%{kmod_install_path}
|
||||
|
||||
for name_kver in %{kmod_list}; do
|
||||
rpm_name="${name_kver%%%%:*}"
|
||||
kver="${name_kver#*:}"
|
||||
kver="${kver%%:*}"
|
||||
src="${name_kver##*:}"
|
||||
|
||||
kernel_source="${src:+.}/usr/src/kernels/${kver}.%(arch)"
|
||||
kernel_source="$(realpath "${kernel_source}")"
|
||||
PWD_PATH=$(realpath --relative-to="${kernel_source}" . 2>/dev/null || echo "$PWD")
|
||||
make -C "${kernel_source}" V=1 modules_install \
|
||||
M=$PWD_PATH/obj.${kver}/%{kmod_kbuild_dir}
|
||||
|
||||
install -m 644 -D source/greylist.txt.${kver} $RPM_BUILD_ROOT/usr/share/doc/%{kmod_rpm_name}/greylist.txt.${kver}
|
||||
done
|
||||
|
||||
PWD_PATH="$PWD"
|
||||
%if "%{workaround_no_pwd_rel_path}" != "1"
|
||||
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
|
||||
%endif
|
||||
make -C %{kernel_source} modules_install \
|
||||
M=$PWD_PATH/obj/%{kmod_kbuild_dir}
|
||||
# Cleanup unnecessary kernel-generated module dependency files.
|
||||
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
|
||||
|
||||
@ -295,24 +209,43 @@ install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.c
|
||||
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/%{kmod_rpm_name}/greylist.txt
|
||||
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
* Mon Mar 01 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-1.3
|
||||
- Replace "and" with "with" in pre-4.18.0-240.14.1.el8_3 kernel dependency
|
||||
to match it more precisely (it passes when both post-4.18.0-240.14.1.el8_3
|
||||
and pre-4.18.0-240.el8 kernels installed otherwise).
|
||||
* Thu Feb 11 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-11
|
||||
- Rebuild against kernel-4.18.0-286.el8.
|
||||
|
||||
* Tue Feb 23 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-1.2
|
||||
- Build against kernel-4.18.0-240.14.1.el8_3 in addition to GA kernel
|
||||
(#1931546).
|
||||
* Mon Feb 08 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-10
|
||||
- Rebuild against kernel-4.18.0-282.el8 (#1924967).
|
||||
|
||||
* Mon Feb 22 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-1.1
|
||||
- Check for symvers.gz presence in /lib/modules/KVER in addition to boot.
|
||||
* Sun Jan 17 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-9
|
||||
- Rebuild against kernel-4.18.0-275.el8.
|
||||
|
||||
* Wed Dec 09 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-1
|
||||
* Mon Jan 04 2021 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-8
|
||||
- Check for symvers.gz presence in /lib/modules/KVER in addition to boot
|
||||
(#1912195).
|
||||
|
||||
* Tue Dec 29 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-7
|
||||
- Rebuild against kernel-4.18.0-268.el8.
|
||||
|
||||
* Wed Dec 23 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-6
|
||||
- Rebuild against kernel-4.18.0-256.el8.
|
||||
|
||||
* Fri Nov 27 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-5
|
||||
- Rebuild against kernel-4.18.0-254.el8.
|
||||
|
||||
* Sat Nov 21 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-4
|
||||
- Rebuild against kernel-4.18.0-252.el8.
|
||||
|
||||
* Fri Oct 30 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-3
|
||||
- Add "Provides: oracleasm" and "Provides: oracleasm-kmod".
|
||||
- Dropping "0001-oracleasm-driver-replace-fs_context-with-mount_pseud.patch".
|
||||
|
||||
* Thu Oct 22 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-2
|
||||
- Revision bump due to brew NVR conflict.
|
||||
|
||||
* Mon Oct 19 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.0.8-1
|
||||
- 19e841b848491d1e14dcd0063d8d681ed1190255
|
||||
- oracleasm kernel module
|
||||
- Resolves: #bz1904159
|
||||
- Resolves: #1827015
|
||||
|
Loading…
Reference in New Issue
Block a user