Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#3981 from vigh-m/static-modprobe
Browse files Browse the repository at this point in the history
kmod: Build kmod as a static binary
  • Loading branch information
vigh-m authored May 24, 2024
2 parents 74114b4 + 6ac0fd4 commit 87aed3a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/kmod/kmod.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,48 @@ cp COPYING COPYING.LGPL
cp tools/COPYING COPYING.GPL

%build

%define _configure ../configure

mkdir static-build
pushd static-build

%cross_configure \
--with-zlib \
--with-zstd \
--without-openssl

%make_build LDFLAGS="-all-static"

popd

mkdir dynamic-build
pushd dynamic-build

%cross_configure \
--with-zlib \
--with-zstd \
--without-openssl

%make_build

popd

%install
pushd dynamic-build
%make_install
popd

pushd static-build
install -p tools/kmod %{buildroot}%{_cross_bindir}

for b in depmod insmod lsmod modinfo modprobe rmmod ; do
ln -s kmod %{buildroot}%{_cross_bindir}/${b}
done

install -d %{buildroot}%{_cross_sbindir}
ln -s ../bin/kmod %{buildroot}%{_cross_sbindir}/modprobe
popd

%files
%license COPYING.LGPL COPYING.GPL
Expand Down

0 comments on commit 87aed3a

Please sign in to comment.