TrumanWong

depmod

Analyze dependencies of loadable modules

Supplementary instructions

depmod command can generate module dependent mapping files. When building an embedded system, this command is needed to generate the corresponding files, which are used by modprobe.

grammar

depmod (option)

Options

-a or --all: analyze all available modules;
-d or debug: execute debugging mode;
-e: Output symbols that cannot be referenced;
-i: Do not check the version of the symbol table;
-m<file> or system-map<file>: use the specified symbol table file;
-s or --system-log: record errors in the system log;
-v or --verbose: Display detailed information during execution;
-V or --version: display version information;
--help: Display help.

Example

depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a
  • /home/windsome/EMMA3PF-KernelSource-20080626/install_pos is the storage path of all modules after I make mod_install.
  • ./boot/System.map is generated after make linux and I copied it to this directory.
  • 2.6.18_pro500-bcm91250-mips2_fp_be is the version of linux I built.

Examples of compiling Linux and executing depmod:

genkernel.sh (at linux-2.6.18_pro500)
#######
export INSTALL_ROOT_EMMA3PF="/home/windsome/EMMA3PF-KernelSource-20080626/install_pos"
export INSTALL_MOD_EMMA3PF="/home/windsome/EMMA3PF-KernelSource-20080626/install_pos"
rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/lib -rf
rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/* -rf
cd <linux_src_dir>
make
make modules_install
cp vmlinux System.map /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/ -p
cd /home/windsome/EMMA3PF-KernelSource-20080626/install_pos
depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a

Other uses:

In the Linux desktop system, when you compile a new driver, in order to load the module with modprobe ***, you need to copy the module to the /lib/modules/2.6.31-20-generic directory first. Then run sudo depmod -a to write the module information into the modules.dep, modules.dep.bin, modules.alias.bin, modules.alias and modules.pcimap files.

For example, I compiled a new wifi driver r8192se_pci.ko, copied it to /lib/modules/2.6.31-20-generic/wireless, and then to /lib/modules/2.6.31-20- Genericrunsdepmod -a, and then modprobe r8192se_pci can be run in any directory.