Skip to content

Commit 79f78c0

Browse files
ynezzrobimarko
authored andcommitted
kmod: fix build failure in install step over dirty build dir
When building kmod-32 package for the first time (clean build_dir), it builds and installs fine. When building for 2nd time, sometimes (probably some race condition?) it fails to build in install step with following error: for tool in insmod lsmod rmmod depmod modprobe modinfo; do \ ln -s kmod /tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/$tool; \ done ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/insmod': File exists ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/lsmod': File exists ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/rmmod': File exists ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/depmod': File exists ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/modprobe': File exists ln: failed to create symbolic link '/tmp/build_dir/target-aarch64_cortex-a73+neon-vfpv4_musl/kmod-32/ipkg-install/usr/bin/modinfo': File exists Lets fix it by backporting upstream fix. Fixes: openwrt#27171 Link: https://lore.kernel.org/r/[email protected] Upstream-Status: Backport [kmod-project/kmod@c5054b2] Signed-off-by: Petr Štetiar <[email protected]>
1 parent 77783f9 commit 79f78c0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From c5054b215089f9e3cdc9602232649c2b5b1de743 Mon Sep 17 00:00:00 2001
2+
From: Lucas De Marchi <[email protected]>
3+
Date: Wed, 6 Mar 2024 08:58:04 -0600
4+
Subject: [PATCH] build: Allow to install over dirty dir
5+
6+
Before commit e98cef6f3f8c ("make: install/uninstall tools symlinks to
7+
kmod") it was possible to call `make install DESTDIR=<dir>` multiple
8+
times. Use `ln -sf` so the symlink is always re-created.
9+
10+
It would be preferred to remove install in an empty dir, but there's
11+
not a bad consequence of re-using the same, so let the user decide.
12+
Fixes the following errors while installing for the second time:
13+
14+
ln: failed to create symbolic link '/tmp/inst/usr/bin/insmod': File exists
15+
ln: failed to create symbolic link '/tmp/inst/usr/bin/lsmod': File exists
16+
ln: failed to create symbolic link '/tmp/inst/usr/bin/rmmod': File exists
17+
ln: failed to create symbolic link '/tmp/inst/usr/bin/depmod': File exists
18+
ln: failed to create symbolic link '/tmp/inst/usr/bin/modprobe': File exists
19+
ln: failed to create symbolic link '/tmp/inst/usr/bin/modinfo': File exists
20+
make[3]: *** [Makefile:2679: install-exec-hook] Error 1
21+
make[2]: *** [Makefile:2553: install-exec-am] Error 2
22+
make[1]: *** [Makefile:2439: install-am] Error 2
23+
make: *** [Makefile:1848: install-recursive] Error 1
24+
25+
Cc: Emil Velikov <[email protected]>
26+
Closes: https://github.com/kmod-project/kmod/issues/35
27+
Reviewed-by: Emil Velikov <[email protected]>
28+
Link: https://lore.kernel.org/r/[email protected]
29+
Upstream-Status: Backport [https://github.com/kmod-project/kmod/commit/c5054b215089f9e3cdc9602232649c2b5b1de743]
30+
Signed-off-by: Lucas De Marchi <[email protected]>
31+
---
32+
Makefile.am | 2 +-
33+
1 file changed, 1 insertion(+), 1 deletion(-)
34+
35+
--- a/Makefile.am
36+
+++ b/Makefile.am
37+
@@ -113,7 +113,7 @@ install-exec-hook:
38+
fi
39+
if BUILD_TOOLS
40+
for tool in insmod lsmod rmmod depmod modprobe modinfo; do \
41+
- $(LN_S) kmod $(DESTDIR)$(bindir)/$$tool; \
42+
+ $(LN_S) -f kmod $(DESTDIR)$(bindir)/$$tool; \
43+
done
44+
endif
45+

0 commit comments

Comments
 (0)