Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/kmod: use the correct path for kmod
@ 2022-10-12  1:34 Li Chen
  2022-10-12 20:40 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Li Chen @ 2022-10-12  1:34 UTC (permalink / raw)
  To: buildroot; +Cc: Li Chen

Content-Transfer-Encoding: 8bit

kmod install path is always /usr/bin/kmod instead
of /bin/kmod.

So if we link modprobe/lsmod/... to /bin/kmod

We will get error like:
> # modprobe
> -sh: modprobe: not found

because it points to:
> # ls -liah /sbin/modprobe
>   2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod

and kmod is under /usr/bin/kmod instead of /bin/kmod.

Signed-off-by: Li Chen <me@linux.beauty>
---
 package/kmod/kmod.mk | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/package/kmod/kmod.mk b/package/kmod/kmod.mk
index 82e8597759..cfb4a27cf3 100644
--- a/package/kmod/kmod.mk
+++ b/package/kmod/kmod.mk
@@ -73,12 +73,7 @@ ifeq ($(BR2_PACKAGE_KMOD_TOOLS),y)
 KMOD_LICENSE += , GPL-2.0+ (tools)
 KMOD_LICENSE_FILES += COPYING
 
-# /sbin is really /usr/sbin with merged /usr, so adjust relative symlink
-ifeq ($(BR2_ROOTFS_MERGED_USR),y)
-KMOD_BIN_PATH = ../bin/kmod
-else
 KMOD_BIN_PATH = ../usr/bin/kmod
-endif
 
 define KMOD_INSTALL_TOOLS
 	for i in depmod insmod lsmod modinfo modprobe rmmod; do \
-- 
2.37.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] package/kmod: use the correct path for kmod
  2022-10-12  1:34 [Buildroot] [PATCH] package/kmod: use the correct path for kmod Li Chen
@ 2022-10-12 20:40 ` Thomas Petazzoni via buildroot
  2022-10-16  4:08   ` Li Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-10-12 20:40 UTC (permalink / raw)
  To: Li Chen; +Cc: buildroot

Hello,

On Wed, 12 Oct 2022 09:34:39 +0800
Li Chen<me@linux.beauty> wrote:

> Content-Transfer-Encoding: 8bit
> 
> kmod install path is always /usr/bin/kmod instead
> of /bin/kmod.
> 
> So if we link modprobe/lsmod/... to /bin/kmod
> 
> We will get error like:
> > # modprobe
> > -sh: modprobe: not found  
> 
> because it points to:
> > # ls -liah /sbin/modprobe
> >   2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod  
> 
> and kmod is under /usr/bin/kmod instead of /bin/kmod.
> 
> Signed-off-by: Li Chen <me@linux.beauty>

Are you testing a BR2_ROOTFS_MERGED_USR enabled or a
BR2_ROOTFS_MERGED_USR disabled configuration?

If you're testing a BR2_ROOTFS_MERGED_USR enabled configuration, then
the "modprobe" symlink, even if created in /sbin is in fact in
/usr/sbin, because /sbin is a symlink to /usr/sbin. So actually the
symlink is /usr/sbin/modprobe -> ../bin/kmod, which is correct as kmod
is indeed in /usr/bin/kmod.

If you're testing a BR2_ROOTFS_MERGED_USR disabled configuration, then
the "modprobe" symlink is really in /sbin, and /sbin/modprobe is a
symlink to ../usr/bin/kmod, which is correct.

(Of course, I didn't do a test, so maybe my reasoning is wrong, but the
current logic appears correct at first sight).

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] package/kmod: use the correct path for kmod
  2022-10-12 20:40 ` Thomas Petazzoni via buildroot
@ 2022-10-16  4:08   ` Li Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Li Chen @ 2022-10-16  4:08 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot

Hi Thomas,
 ---- On Thu, 13 Oct 2022 04:40:08 +0800  Thomas Petazzoni  wrote --- 
 > Hello,
 > 
 > On Wed, 12 Oct 2022 09:34:39 +0800
 > Li Chenme@linux.beauty> wrote:
 > 
 > > Content-Transfer-Encoding: 8bit
 > > 
 > > kmod install path is always /usr/bin/kmod instead
 > > of /bin/kmod.
 > > 
 > > So if we link modprobe/lsmod/... to /bin/kmod
 > > 
 > > We will get error like:
 > > > # modprobe
 > > > -sh: modprobe: not found  
 > > 
 > > because it points to:
 > > > # ls -liah /sbin/modprobe
 > > >   2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod  
 > > 
 > > and kmod is under /usr/bin/kmod instead of /bin/kmod.
 > > 
 > > Signed-off-by: Li Chen me@linux.beauty>
 > 
 > Are you testing a BR2_ROOTFS_MERGED_USR enabled or a
 > BR2_ROOTFS_MERGED_USR disabled configuration?
 > 
 > If you're testing a BR2_ROOTFS_MERGED_USR enabled configuration, then
 > the "modprobe" symlink, even if created in /sbin is in fact in
 > /usr/sbin, because /sbin is a symlink to /usr/sbin. So actually the
 > symlink is /usr/sbin/modprobe -> ../bin/kmod, which is correct as kmod
 > is indeed in /usr/bin/kmod.
 > 
 > If you're testing a BR2_ROOTFS_MERGED_USR disabled configuration, then
 > the "modprobe" symlink is really in /sbin, and /sbin/modprobe is a
 > symlink to ../usr/bin/kmod, which is correct.
 > 
 > (Of course, I didn't do a test, so maybe my reasoning is wrong, but the
 > current logic appears correct at first sight).

Thanks for your reply,
I cannot reproduce this issue now somehow. I will update this thread if I come across it again someday.

Regards,
Li
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-16  4:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-12  1:34 [Buildroot] [PATCH] package/kmod: use the correct path for kmod Li Chen
2022-10-12 20:40 ` Thomas Petazzoni via buildroot
2022-10-16  4:08   ` Li Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox