Build for MSVSphere 9

i9 changed/i9/focal-spi-kmod-0.1-4.el9
ebasov 1 month ago
commit bec3b638bd
Signed by: ebasov
GPG Key ID: 3DE9E7A44B2D38F6

@ -0,0 +1 @@
1e30ee778ed5f3733733530917eac3bfd2803fa8 SOURCES/focal_spi_cs_high.zip

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/focal_spi_cs_high.zip

@ -0,0 +1,11 @@
# To build as a module, use:
# make -C /usr/src/kernels/x.y.z M=$(pwd)
# To cleanup, use:
# make -C /usr/src/kernels/x.y.z M=$(pwd) clean
#
# Build is expected to work with the following kernels:
# make -C /usr/src/kernels/5.14.0-427.35.1.el9_4.x86_64 M=$(pwd)
# make -C /usr/src/kernels/6.1.104-1.el9.inferit.x86_64 M=$(pwd)
# make -C /usr/src/kernels/6.6.45-1.el9.inferit.x86_64 M=$(pwd)
obj-m += focal_spi.o

@ -0,0 +1,11 @@
--- focal_spi.c.orig 2024-06-28 14:09:39.000000000 +0300
+++ focal_spi.c 2024-11-07 18:59:57.322296546 +0300
@@ -489,7 +489,7 @@
/* Set up SPI*/
spi->max_speed_hz=4*1000*1000;
spi->bits_per_word = 8;
- spi->mode = SPI_MODE_0|SPI_CS_HIGH;
+ spi->mode = SPI_MODE_0;
error = spi_setup(spi);
if (error)
return error;

@ -0,0 +1,89 @@
%global buildforkernels current
%global debug_package %{nil}
%global __os_install_post %{nil}
Name: focal-spi-kmod
Summary: Kernel module (kmod) for FocalTech SPI FPR
Version: 0.1
Release: 4%{?dist}
License: GPLv2
URL: https://github.com/ftfpteams/ubuntu_spi
Source0: focal_spi_cs_high.zip
Source1: Makefile
Patch0: focal_spi_cs_high.patch
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: %{_bindir}/kmodtool
%{!?kernels:BuildRequires: buildsys-build-msvsphere-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }
%{?fedora:BuildRequires: unifdef}
BuildRequires: gcc
BuildRequires: make
BuildRequires: elfutils-libelf-devel
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo msvsphere --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Driver module for FocalTech FPR on SPI bus
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo msvsphere --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%setup -q -c
mkdir focal-spi
ls -l
cp focal_spi.c focal-spi
pushd focal-spi
cp %{SOURCE1} .
%patch0 -p0 -b .fix-segfault
popd
#Copied from kernel sources
pwd
ls
for kernel_version in %{?kernel_versions} ; do
cp -a focal-spi _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions} ; do
%make_build -C ${kernel_version##*___} \
M=${PWD}/_kmod_build_${kernel_version%%___*} \
modules
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -D -m 755 -t ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ $(find _kmod_build_${kernel_version%%___*}/ -name '*.ko')
done
# Fix for the SB-signing issue caused by a bug in /usr/lib/rpm/brp-strip
# https://bugzilla.redhat.com/show_bug.cgi?id=1967291
find %{buildroot} -name \*.ko -type f | xargs --no-run-if-empty %{__strip} --strip-debug
# Sign the modules(s)
%if %{?_with_modsign:1}%{!?_with_modsign:0}
for kernel_version in %{?kernel_versions}; do
# If the module signing keys are not defined, define them here.
%{!?privkey: %define privkey %{_sysconfdir}/pki/kmod/msvsphere_kmod.priv}
%{!?pubkey: %define pubkey %{_sysconfdir}/pki/kmod/msvsphere_kmod.pem}
for module in $(find %{buildroot} -type f -name \*.ko);
do %{_usrsrc}/kernels/${kernel_version%%___*}/scripts/sign-file \
sha256 %{privkey} %{pubkey} $module;
done
done
%endif
%{?akmod_install}
%changelog
* Thu Nov 21 2024 Eduard Basov <ebasov@msvsphere-os.ru> - 0.1-4
- Build for MSVSphere 9
Loading…
Cancel
Save