[Buildroot] Running depmod in the package installation

Yann E. MORIN yann.morin.1998 at free.fr
Tue Mar 17 21:23:23 UTC 2020


Carlos, All,

On 2020-03-15 22:43 -0300, Carlos Santos spake thusly:
> Hello buildrooters,
> 
> Currently if a package installs a kernel module it must be loaded by
> means of its full path, e.g
> 
>     insmod /lib/modules/$(/bin/uname -r)/extra/pvrsrvkm.ko
> 
> This is required because modprobe does not work, since we must run
> 
>     $(HOST_DIR)/sbin/depmod -a -b $(TARGET_DIR) <kernel-version>

Damn, I was pretty sure we already did it, but it appears not.

> So I did this in package/ti-sgx-km/ti-sgx-km.mk, to test:
> 
> define TI_SGX_KM_INSTALL_TARGET_CMDS
>         $(TARGET_MAKE_ENV) $(MAKE) $(TI_SGX_KM_MAKE_OPTS) \
>                 DISCIMAGE=$(TARGET_DIR) \
>                 kbuild_install -C $(@D)/$(TI_SGX_KM_SUBDIR)
>         kver=$$($(MAKE) -C $(LINUX_DIR) --no-print-directory -s
> kernelversion); \
>         $(HOST_DIR)/sbin/depmod -a -b $(TARGET_DIR) $$kver
>  endef
> 
> With this change a "modprobe pvrsrvkm" works but I wonder if it should
> be better to run depmod in a target-finalize hook in linux/linux.mk,
> e.g,

Exactly what I was going to suggest.

> define LINUX_DEPMOD
>         $(HOST_DIR)/sbin/depmod -a -b $(TARGET_DIR) \
>                 $$($(MAKE) -C $(LINUX_DIR) --no-print-directory -s kernelversion)

I guess you'd want to use $(LINUX_VERSION_PROBED) instead of
hand-calling kernelversion, linux/linux.mk at 159:

    # Get the real Linux version, which tells us where kernel modules are
    # going to be installed in the target filesystem.
    LINUX_VERSION_PROBED = ....

Regards,
Yann E. MORIN.

> endef
> 
> What do you think?
> 
> -- 
> Carlos Santos <unixmania at gmail.com>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list