oriolrius.cat

Des del 2000 compartiendo sobre…

Tag: modules

Gentoo Trick: module-rebuild

Reading time: 2 – 2 minutes

El pof en el seu dia i la GWN (Gentoo Weekly News) en una de les seves últimes edicions ens han parlat algún cop d’aquesta eina tan útil i que mai recordo com es diu exactament. A més sempre és quan més la necessites, o sigui, quan fas un update de kernel. Serveix per algo tan útil com recompilar els mòduls que no són natius del kernel per la nova versió de kernel que ens acabem d’instal·lar, estalviant-nos el mal moment que hem passat tots de necessitar just el mòdul que controla el dispositiu que no estava suportat de forma genèrica pel kernel i just en aquell moment no tenim el mòdul compilat.

Suppose you’ve just booted into a freshly updated kernel. First of all,
check which packages are using modules that haven’t been built with the
new sources yet:

module-rebuild list

and then you can rebuild them all by simply going:

module-rebuild rebuild

Per disposar del module-rebuild feu un emerge a:

*  sys-kernel/module-rebuild
      Latest version available: 0.5
      Latest version installed: 0.5
      Size of downloaded files: 0 kB
      Homepage:    http://www.gentoo.org/
      Description: A utility to rebuild any kernel modules which you have installed.
      License:     GPL-2

UPDATE 5/6/2006: fixeu-vos al fer el list que no sempre hi ha tots els paquetes que instal·len moduls a la vostre llista, per tant, us recomano que afegiu els paquets que tenen mòduls amb l’opció add de la companda module-rebuild a partir de llavors ja es recordarà ell d’aquesta dependencia en el rebuild.

Linux Tips: Modules, Who Are They, And How Do They Work?

Reading time: 2 – 3 minutes

[ Via Migraine Heartache ] A very nice feature of the Linux kernel is the modules. Modules are pieces of software that can be loaded and unloaded from the kernel at runtime. That way you can save kernel memory (and that’s important for small machines, since kernel memory is never swapped out on disk), and keep your kernel clean when you’re not working with some of your hardware.

Especially sound and network cards are really good to compile as modules, since sometimes they are a bit hard to configure, and when you have a module, you don’t have to recompile and reboot your kernel to configure some irq or io setting.

The Tools Used

The tools you use to handle modules are all located in /sbin. They are insmod, modprobe, lsmod, depmod and rmmod.. Notice the names, and compare them to some often used unix commands such as ls and rm and you’ll immediatelly understand what each command will do for you. As always I recommend reading the manual pages. Anyway, here’s what they do:

  • lsmod – List the modules currently loaded. A completely harmless command, even a normal user can run it.
  • rmmod – Removes a loaded module from memory. Checks dependencies, ie if a module needs another module, the other module may not be unloaded before the first one.
  • insmod – Inserts a specific module in memory. You may give a path, or just a filename with or without extension. In the latter case, insmod will search some standard module paths to find the module.
  • modprobe – Inserts a module in memory, but checks dependencies. If you modprobe module A, and module A needs module B to run, modprobe will insert module B and then module A.
  • depmod – Calculates dependencies between modules needed by the other module commands. This is most probably done by your init scripts at system startup, but some time you may need to execute a depmod -a.
  • modinfo – ens dona informació sobre les funcions del mòdul, els paràemtres que suporta, etc.(se l’havien deixat)

How do I make modules?

When you compile your kernel, you choose to make things as modules, instead of into the kernel itself.

The modules will be installed when you do a make modules ; make modules_install after your kernel is compiled. They will reside in a directory called /lib/modules/xx.yy.zz where xx.yy.zz is your kernel version.