Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:michals
kmod
0003-depmod-Add-option-to-override-MODULE_DIREC...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-depmod-Add-option-to-override-MODULE_DIRECTORY.patch of Package kmod
From 317ff943e0770804fa81d1d55f5f071ac86201bb Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Wed, 4 Sep 2024 08:54:06 +0200 Subject: [PATCH 3/4] depmod: Add option to override MODULE_DIRECTORY This a compile time option. When building modules for a different system that uses a different value of this option it is useful to be able to override it without rebuilding kmod. Fixes: #85 Signed-off-by: Michal Suchanek <msuchanek@suse.de> --- man/depmod.8.scd | 9 ++++++++- tools/depmod.c | 16 +++++++++++----- tools/kmod.pc.in | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) --- a/man/depmod.8.scd +++ b/man/depmod.8.scd @@ -6,7 +6,7 @@ depmod - Generate modules.dep and map fi # SYNOPSIS -*depmod* [*-b* _basedir_] [*-o* _outdir_] [*-e*] [*-E* _Module.symvers_] +*depmod* [*-b* _basedir_] [*-m* _moduledir_] [*-o* _outdir_][*-o* _outdir_] [*-e*] [*-E* _Module.symvers_] \ \ \ \ \ \ \ \[*-F* _System.map_] [*-n*] [*-v*] [*-A*] [*-P* _prefix_] [*-w*] [_version_] *depmod* [*-e*] [*-E* _Module.symvers_] [*-F* _System.map_] [*-n*] [*-v*] [*-P* _prefix_] @@ -56,6 +56,13 @@ rather than the current kernel version ( distribution vendor who needs to pre-generate the meta-data files rather than running *depmod* again later. +*-m* _moduledir_ +*--moduledir* _moduledir_ + Override the @MODULE_DIRECTORY@ prefix set at build time. This is useful + when building *modules.dep* file in _basedir_ for a system that uses a + different prefix. The alternative is to move the modules and + *modules.dep* inside _basedir_ to adjust for the different prefix. + *-o* _outdir_ *--outdir* _outdir_ Set the output directory where *depmod* will store any generated file. --- a/tools/depmod.c +++ b/tools/depmod.c @@ -36,6 +36,7 @@ #define DEFAULT_VERBOSE LOG_WARNING static int verbose = DEFAULT_VERBOSE; +static const char *module_directory = MODULE_DIRECTORY; static const char CFG_BUILTIN_KEY[] = "built-in"; static const char CFG_EXTERNAL_KEY[] = "external"; static const char *const default_cfg_paths[] = { @@ -47,11 +48,12 @@ static const char *const default_cfg_pat NULL }; -static const char cmdopts_s[] = "aAb:o:C:E:F:evnP:wVh"; +static const char cmdopts_s[] = "aAb:m:o:C:E:F:evnP:wVh"; static const struct option cmdopts[] = { { "all", no_argument, 0, 'a' }, { "quick", no_argument, 0, 'A' }, { "basedir", required_argument, 0, 'b' }, + { "moduledir", required_argument, 0, 'm' }, { "outdir", required_argument, 0, 'o' }, { "config", required_argument, 0, 'C' }, { "symvers", required_argument, 0, 'E' }, @@ -90,6 +92,7 @@ static void help(void) "\n" "The following options are useful for people managing distributions:\n" "\t-b, --basedir=DIR Use an image of a module tree.\n" + "\t-m, --moduledir=DIR Override MODULE_DIRECTORY.\n" "\t-o, --outdir=DIR Output directory for generated files.\n" "\t-F, --filesyms=FILE Use the file instead of the\n" "\t current kernel symbols.\n" @@ -2921,6 +2924,9 @@ static int do_depmod(int argc, char *arg free(root); root = path_make_absolute_cwd(optarg); break; + case 'm': + module_directory = optarg; + break; case 'o': if (out_root) free(out_root); @@ -2996,12 +3002,12 @@ static int do_depmod(int argc, char *arg } cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX, - "%s" MODULE_DIRECTORY "/%s", - root ?: "", cfg.kversion); + "%s%s/%s", + root ?: "", module_directory, cfg.kversion); cfg.outdirnamelen = snprintf(cfg.outdirname, PATH_MAX, - "%s" MODULE_DIRECTORY "/%s", - out_root ?: (root ?: ""), cfg.kversion); + "%s%s/%s", + out_root ?: (root ?: ""), module_directory, cfg.kversion); if (optind == argc) all = 1; --- a/tools/kmod.pc.in +++ b/tools/kmod.pc.in @@ -4,6 +4,7 @@ distconfdir=@distconfdir@ module_directory=@module_directory@ module_compressions=@module_compressions@ module_signatures=@module_signatures@ +depmod_module_directory_override=true Name: kmod Description: Tools to deal with kernel modules
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor