Skip to content

Commit

Permalink
use dkms mkkmp to build module for fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDuartePT committed Aug 25, 2023
1 parent 888af9b commit f62b649
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deploy/build_deb_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo "Dkms deb located at ${BUILD_DIR}/lenovolegionlinux-dkms_1.0.0_amd64.deb"
sudo dkms remove -m lenovolegionlinux -v 1.0.0

#Build rpm file
sudo dkms mkrpm -m lenovolegionlinux -v 1.0.0 --source-only
sudo dkms mkkmp -m lenovolegionlinux -v 1.0.0 --spec lenovolegionlinux.spec

#Copy rpm to deploy folder
sudo ls /var/lib/dkms/lenovolegionlinux/1.0.0/rpm/
Expand Down
49 changes: 49 additions & 0 deletions kernel_module/lenovolegionlinux.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# lenovolegionlinux.spec
# Sample KMP spec file
#

# Following line included for SUSE "build" command; does not affect "rpmbuild"
# norootforbuild

Name: LenovoLegionLinux
License: GPL
Group: System/Kernel
Summary: LenovoLegionLinux Kernel Module Package
Version: 1.0
Release: 0
Source0: %name-%version.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build

%kernel_module_package

%description
Driver for controlling Lenovo Legion laptops including fan control and power mode.

%prep
%setup
set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
cp -r source obj/$flavor
make -C %{kernel_source $flavor} modules M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
# Following line works for SUSE 11+ and RHEL 6.1+ only, must set INSTALL_MOD_DIR manually for other targets
export INSTALL_MOD_DIR=%kernel_module_package_moddir %{name}
for flavor in %flavors_to_build; do
make -C %{kernel_source $flavor} install M=$PWD/obj/$flavor
done

%clean
rm -rf %{buildroot}

%changelog
Intial Release

0 comments on commit f62b649

Please sign in to comment.