WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tce-load and extensions with a directory named modules  (Read 561 times)

Offline mortegai

  • Jr. Member
  • **
  • Posts: 62
tce-load and extensions with a directory named modules
« on: July 29, 2025, 07:17:57 AM »
tce-load has a routine (update_system, which includes depmod -a and udevadm trigger) designed for extensions that contain kernel modules, and it's executed if the extension contains a directory named modules.

However, there are some other extensions that contain a directory named modules, such as:
Code: [Select]
xorg-server
libfm
glib2
gtk2
xf86-input-lubinput
p11-kit (needed for gnutls)
at-spi2-core
that when loaded also run update_system unnecessarily, significantly lengthening their loading time.

Could the need to run update_system when loading an extension be refined in some way?
For example, by checking if it also contains *.ko kernel modules

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #1 on: July 29, 2025, 08:55:52 AM »
Hi mortegai
I'm looking into it.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #2 on: July 29, 2025, 04:30:38 PM »
Hi mortegai
What do you think of this:
Replace this:
Code: [Select]
[ -n "`find /mnt/test/ -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
MODULES_DIR=$(find /mnt/test/ -type d -name modules)
[ -n "$MODULES_DIR" ] && [ "$(find $MODULES_DIR -type f -name '*.ko*')" ] && MODULES=TRUE

And replace this:
Code: [Select]
[ -n "`find /tmp/tcloop/$APPNAME -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
MODULES_DIR=$(find /tmp/tcloop/$APPNAME -type d -name modules)
[ -n "$MODULES_DIR" ] && [ "$(find $MODULES_DIR -type f -name '*.ko*')" ] && MODULES=TRUE

In both cases, the first line searches for a modules directory. If found, the second line
searches that directory for any *.ko* files. If found, MODULES gets set to TRUE.

This will detect .ko, .ko.gz, .ko.xz, etc.

Comments from you or anyone else reading this thread are welcome and encouraged.

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 384
Re: tce-load and extensions with a directory named modules
« Reply #3 on: July 29, 2025, 09:51:59 PM »
Why not just (untested):
Code: [Select]
[ -d /mnt/test/usr/local/lib/modules/$KERNELVER ] && MODULES=TRUE

Then you avoid needing to run 'find'.

Assuming no extensions wrongly install to /lib/modules/, in which case:
Code: [Select]
[ -d /mnt/test/usr/local/lib/modules/$KERNELVER -o -d /mnt/test/lib/modules/$KERNELVER ] && MODULES=TRUE

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #4 on: July 30, 2025, 12:22:58 AM »
Hi CNK
Thank you. That solves the problem the find command created. Some extensions
contain:
Code: [Select]
/usr/local/lib/ExtensionName/modulespopulated with  .so  files. The find command returned those module directories.

This should work better:
Replace this:
Code: [Select]
[ -n "`find /mnt/test/ -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
[ -d /mnt/test/usr/local/lib/modules ] && MODULES=TRUE
And replace this:
Code: [Select]
[ -n "`find /tmp/tcloop/$APPNAME -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
[ -d /tmp/tcloop/$APPNAME/usr/local/lib/modules ] && MODULES=TRUE
I searched provides.db and found:
There are no extensions containing  /lib/modules.
There are no  /usr/local/lib/modules  directories containing  .so  files.

Offline mortegai

  • Jr. Member
  • **
  • Posts: 62
Re: tce-load and extensions with a directory named modules
« Reply #5 on: July 30, 2025, 05:35:55 AM »
Either option works.
I think CNK's proposal, including the use of $KERNELVER, is more specific for identifying extensions that contain modules of the currently running kernel.
Therefore, it seems more appropriate to me.
Thank you very much for your attention to this topic.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #6 on: July 30, 2025, 09:44:51 AM »
Hi mortegai
I modified a current copy of tce-load like this:
Replaced this:
Code: [Select]
[ -n "`find /mnt/test/ -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
[ -d /mnt/test/usr/local/lib/modules/$KERNELVER ] && MODULES=TRUE
Replaced this:
Code: [Select]
[ -n "`find /tmp/tcloop/$APPNAME -type d -name modules`" ] && MODULES=TRUEWith this:
Code: [Select]
[ -d /tmp/tcloop/$APPNAME/usr/local/lib/modules/$KERNELVER ] && MODULES=TRUE

I created an initrd with the modified tce-load for you to test.
Download the tceload.gz file to your boot directory from here:
http://tinycorelinux.net/16.x/

Modify your boot loader config file like this:
Code: [Select]
initrd /boot/core.gz,/boot/tceload.gzor this:
Code: [Select]
initrd /boot/core.gz /boot/tceload.gzThe first version should work with syslinux,extlinux, and grub-legacy.
The second version works with grub 2.

Please confirm that it speeds up your load times.

Offline mortegai

  • Jr. Member
  • **
  • Posts: 62
Re: tce-load and extensions with a directory named modules
« Reply #7 on: July 30, 2025, 11:07:19 AM »
Hi Rich.
I'm using piCore16. I've modified config.txt to include your tceload.gz in initramfs.
I've tested loading some extensions, for example gnutls.tcz, and the loading time has been significantly reduced.
Therefore, I think the modification can be considered correct and permanently consolidated.
Thank you very much.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #8 on: July 30, 2025, 02:16:00 PM »
Hi mortegai
Thank you for the feedback.

I'll allow a little more time in case anyone else has
comments and push the change into git late tonight.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12235
Re: tce-load and extensions with a directory named modules
« Reply #9 on: July 31, 2025, 08:00:37 AM »
Hi mortegai
The change has been merged into git.