Re: [PATCH kmod v4 4/4] libkmod, depmod, modprobe: Make directory for kernel modules configurable

From: Jan Engelhardt
Date: Tue Jul 18 2023 - 08:17:17 EST



On Tuesday 2023-07-18 12:29, Michal Suchánek wrote:
>> -static const char *dirname_default_prefix = MODULE_DIRECTORY;
>> +const char *dirname_default_prefix = MODULE_DIRECTORY;
>>
>> @@ -2943,6 +2944,9 @@ static int do_depmod(int argc, char *argv[])
>> free(out_root);
>> out_root = path_make_absolute_cwd(optarg);
>> break;
>> + case 'M':
>> + dirname_default_prefix = optarg;
>> + break;
>> case 'C': {
>> size_t bytes = sizeof(char *) * (n_config_paths + 2);
>> void *tmp = realloc(config_paths, bytes);
>
>That breaks kmod for the usrmerged distributions, though.

Does it though?
The *distro* has /lib -> /usr/lib,
the *staging area* for installation does not.

>[...]
>Note: it will work either way at the times the module directory can be
>accessed through the lib -> usr/lib compatibility symlink. The default
>needs to be correct for the cases when the symlink is not provided.

>So you could do
>
>make DEPMOD='depmod -M /lib/modules'

That would be a workable situation.