Commit Graph

366 Commits

Author SHA1 Message Date
Gustavo Sverzut Barbieri
4b144e5fb4 kmod-depmod: dump modules.builtin.bin 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
92df661697 kmod-depmod: add utility functions to be used by binary dumps.
Binary dumps will use functions to convert alias to underscores and
paths to module names.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
0de40463ba kmod-depmod: copy code from module-init-tools/index.c
Copy code from module-init-tools/index.c, the following copyright applies:

    Copyright (C) 2008  Alan Jenkins <alan-jenkins@tuffmail.co.uk>.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
8e3505c504 kmod-depmod: dump deps. 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
0d13174578 kmod-depmod: dump aliases 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
8bc830efc5 kmod-depmod: dump softdeps. 2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
9a14d0e989 kmod-depmod: dump modules.symbols
note that the hash algorithm is different thus the output order will
be different as well.

to compare the outputs, sort the files:

   depmod -n | grep '^alias symbol:' | sort > /tmp/orig
   kmod-depmod -n | grep '^alias symbol:' | sort > /tmp/new
   diff /tmp/orig /tmp/new
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
25c4151203 kmod-depmod: dump devname
first try to dump files: modules.devname.
2011-12-27 12:09:16 -02:00
Gustavo Sverzut Barbieri
64b8b586eb kmod-depmod: initial code (no files generated, untested)
this is the initial code for depmod, it should:
 * use configuration from /run/depmod.d, /etc/depmod.d, /lib/depmod.d
 * respect overrides and searches
 * resolve symbols and dependencies
 * break circular dependencies (dependency loops)
 * --errsyms: print out modules with unresolved symbols and incorrect crc
 * --symbol-prefix: respect architecture symbol prefix

it will not:
 * --quick: does not do quick mode
 * --warn: does not warn on duplicates
 * --filesyms: does not load symbols from map file
 * --symvers: does not load symbol versions from map file
 * dump files: does not dump any files at the moment.

it is highly untested, then I appreciate your help with real world
scenarios using overrides and searches. To get output run with -vvvvvv.

next version should fill in the gaps and at least generate the files
2011-12-27 12:09:16 -02:00
Lucas De Marchi
9190c8cda8 Add test for probe insert 2011-12-27 11:55:22 -02:00
Lucas De Marchi
ddbda02286 Add implementation of modprobe's insertion
Treat module insertion as modprobe does: look for (soft-)dependencies, run
install commands, apply blacklist.

The difference with the blacklist is that it's applied to all modules,
including the dependencies. If you want to apply a blacklist only on the
module it's better to call the filter function by yourself.

This implementation detects loops caused by poorly written
soft-dependencies and fail gracefully, printing the loop to the log.
2011-12-27 11:55:22 -02:00
Lucas De Marchi
2bd7cbf644 Do not cache softdeps list
This might include a circular dependency which would screw up the
refcounting because there's an internal reference.
2011-12-27 10:40:51 -02:00
Lucas De Marchi
b72f74b5dd Allow to internally get dependencies without copying list 2011-12-27 10:40:51 -02:00
Lucas De Marchi
9b0e5926fa build-sys: remove unneeded _SOURCES var 2011-12-27 02:49:46 -02:00
Lucas De Marchi
c1c9c44628 Add functions to get ctx blacklists 2011-12-27 02:49:46 -02:00
Lucas De Marchi
eb4ae531f7 Fix kmod_list_remove_n_latest()
It only worked because n was always 1. kmod_list_remove returns a
pointer to the next element, relative to the removed one. Therefore we
need to always get a pointer to the last.
2011-12-27 02:48:36 -02:00
Lucas De Marchi
b94a737935 Reverse order of dependency list
Dependency list in modules.dep is kept in reverse order. Prepend to
list so all the other places treat it in the right order.
2011-12-26 20:15:10 -02:00
Lucas De Marchi
088a6a83dc TODO: add task in modprobe's compatibility 2011-12-26 16:05:55 -02:00
Cristian Rodríguez
4088b27e21 index_file_open: fix another fd leak on error path. 2011-12-26 09:55:15 -02:00
Lucas De Marchi
ef4a349aaa Merge branch 'master' of git://dev.medozas.de/libkmod 2011-12-24 17:51:27 -02:00
Lucas De Marchi
7adfd2c36d Merge branch 'master' of git://dev.medozas.de/libkmod 2011-12-24 17:39:44 -02:00
Jan Engelhardt
c362171286 libkmod: remove external cflags from .pc file
Since the public header files of libkmod do not include header files
of liblzma or zlib, the flags need not be present.
2011-12-24 20:28:11 +01:00
Jan Engelhardt
b182f8fb5e Support for loading Xz-compressed modules 2011-12-24 20:26:22 +01:00
Jan Engelhardt
5a51a357a8 build: use AC_ARG_WITH for zlib
Since it selects an external dependency for inclusion, AC_ARG_WITH
is preferred (autoconf.info 15.2 "Working with external software").
2011-12-24 20:25:54 +01:00
Jan Engelhardt
7b3a74fc67 build: use pkgconfig to detect zlib
build: explicitly call PKG_PROG_PKG_CONFIG

Per the manual page, PKG_PROG_PKG_CONFIG needs to be invoked
explicitly if PKG_CHECK_MODULES might not happen (it is indeed stowed
in an AS_IF in kmod). Without this, funny failures can occur.
(As it did.)
2011-12-24 20:25:21 +01:00
Lucas De Marchi
3af4f558da Fix version script with v3 symbols 2011-12-24 02:40:30 -02:00
Gustavo Sverzut Barbieri
674f8590e3 elf: implement kmod_module_get_dependency_symbols()
Uses kmod_elf_get_dependency_symbols() that looks into ".symtab" for
UNDEF symbols and matches the name from ".strtab" to "__versions" to
get crc.

Likely the public API should unify the symbol information getters and
list release, they are almost the same.
2011-12-24 01:44:31 -02:00
Gustavo Sverzut Barbieri
4b55befd37 elf: add bind type to kmod_modversion.
will be used to share this structure with get_dependency_symbols()
2011-12-24 01:44:31 -02:00
Gustavo Sverzut Barbieri
f85ae0d598 add test/test-elf
will be focused on testing ELF operations and takes a filename to load
instead of looking for it in the system.
2011-12-24 01:44:31 -02:00
Gustavo Sverzut Barbieri
45e6db9c01 elf: add get_symbols()
Similar to module-init-tools load_symbols(), it will try .symtab and
.strtab for symbols starting with __crc_, if they are found their crc
is read from ELF's Elf_Sym::st_value.

If not found, then it will fallback to __ksymtab_strings.
2011-12-24 01:44:31 -02:00
Gustavo Sverzut Barbieri
9bbb72df05 elf: minimum size is enough. 2011-12-24 01:24:55 -02:00
Gustavo Sverzut Barbieri
bb417099e4 file: speed up loading non-gzipped modules when zlib is enabled.
Just now realized that my distro (Gentoo) enables support for gzip but
does not compress modules by default.

In this case it's better to have a special case that uses mmap()
instead of a loop of realloc() + gzread().
2011-12-24 01:15:25 -02:00
Lucas De Marchi
cfb908bf66 build-sys: use AS_IF 2011-12-23 12:03:19 -02:00
Lucas De Marchi
9b966da87e tools: kmod: show wrong command in err message 2011-12-23 11:44:28 -02:00
Lucas De Marchi
a458e36738 tools: kmod: print help message when no commands given 2011-12-23 11:35:48 -02:00
Lucas De Marchi
252c51a996 tools: kmod: add list command
It's the same of lsmod since there's not much to change on its format.
2011-12-23 11:33:02 -02:00
Lucas De Marchi
fa29c0ee96 tools: kmod: Add handling of compat modprobe 2011-12-23 03:09:05 -02:00
Lucas De Marchi
769becb5db tools: kmod: Add handling of compat modinfo 2011-12-23 03:09:05 -02:00
Lucas De Marchi
ad6026965f tools: kmod: Add handling of compat insmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
f712ebc429 tools: kmod: Add handling of compat rmmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
6fcf69e62b tools: kmod: Add handling of compat lsmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
35a29aa519 tools: kmod: check progname for handling compat commands 2011-12-23 03:09:05 -02:00
Cristian Rodríguez
67d94ad388 Fix leak on error path 2011-12-23 03:08:57 -02:00
Lucas De Marchi
bc85432aa3 tools: kmod: Add global options 2011-12-23 03:03:23 -02:00
Lucas De Marchi
8900b9166b tools: add skeleton of kmod tool
If using libtool 2.4.2, running the script generated by libtool will not
work because libtool changes argv[0] to lt-progname.

To test this is necessary to either fix the installed
build-aux/ltmain.sh file or run the binary directly like in:

$ export LD_LIBRARY_PATH=$PWD/libkmod/.libs/
$ ./tools/.libs/kmod help
2011-12-23 03:01:58 -02:00
Lucas De Marchi
6a4fa8d8f1 build-sys: use MKDIR_P 2011-12-23 01:59:31 -02:00
Lucas De Marchi
3e8de63d2d kmod_modprobe: use basename(argv[0]) in help message 2011-12-23 01:36:27 -02:00
Gustavo Sverzut Barbieri
5f9f58f9f6 kmod-modprobe: fix leak in command line option processing.
not that it should matter for the binary, but let's be strict with
leaks so running in valgrind never complains.
2011-12-23 01:25:21 -02:00
Kay Sievers
e79bf83b06 introduce --with-rootlibdir=DIR
Support the installation of the shared library in the rootfs --rootlibdir=,
while the development symlink stays in --libdir=.
2011-12-22 19:08:04 -02:00
Lucas De Marchi
759214fad0 Initialize line number with 0 2011-12-22 01:30:40 -02:00