mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-11-23 23:10:53 +07:00
introduce --with-rootprefix=DIR
Configure the location of the rootfs directories and use it to find (/usr)/lib/modules and (/usr)/lib/modprobe.d.
This commit is contained in:
parent
7fe5f7abce
commit
a308abec37
@ -6,6 +6,7 @@ AM_MAKEFLAGS = --no-print-directory
|
|||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-include $(top_builddir)/config.h \
|
-include $(top_builddir)/config.h \
|
||||||
-I$(top_srcdir)/libkmod \
|
-I$(top_srcdir)/libkmod \
|
||||||
|
-DROOTPREFIX=\""$(rootprefix)"\" \
|
||||||
-DSYSCONFDIR=\""$(sysconfdir)"\" \
|
-DSYSCONFDIR=\""$(sysconfdir)"\" \
|
||||||
-DLIBEXECDIR=\""$(libexecdir)"\"
|
-DLIBEXECDIR=\""$(libexecdir)"\"
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@ AC_C_BIGENDIAN
|
|||||||
|
|
||||||
required_private_libs=""
|
required_private_libs=""
|
||||||
|
|
||||||
|
AC_ARG_WITH([rootprefix],
|
||||||
|
AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
|
||||||
|
[], [with_rootprefix=$prefix])
|
||||||
|
AC_SUBST([rootprefix], [$with_rootprefix])
|
||||||
|
|
||||||
AC_ARG_ENABLE([tools],
|
AC_ARG_ENABLE([tools],
|
||||||
AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
|
AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
|
||||||
[], enable_tools=yes)
|
[], enable_tools=yes)
|
||||||
@ -147,6 +152,7 @@ AC_MSG_RESULT([
|
|||||||
========
|
========
|
||||||
|
|
||||||
prefix: ${prefix}
|
prefix: ${prefix}
|
||||||
|
rootprefix: ${rootprefix}
|
||||||
sysconfdir: ${sysconfdir}
|
sysconfdir: ${sysconfdir}
|
||||||
libdir: ${libdir}
|
libdir: ${libdir}
|
||||||
includedir: ${includedir}
|
includedir: ${includedir}
|
||||||
|
@ -60,8 +60,8 @@ static const char* index_files[] = {
|
|||||||
|
|
||||||
static const char *default_config_paths[] = {
|
static const char *default_config_paths[] = {
|
||||||
"/run/modprobe.d",
|
"/run/modprobe.d",
|
||||||
"/etc/modprobe.d",
|
SYSCONFDIR "/modprobe.d",
|
||||||
"/lib/modprobe.d",
|
ROOTPREFIX "/lib/modprobe.d",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ static int log_priority(const char *priority)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *dirname_default_prefix = "/lib/modules";
|
static const char *dirname_default_prefix = ROOTPREFIX "/lib/modules";
|
||||||
|
|
||||||
static char *get_kernel_release(const char *dirname)
|
static char *get_kernel_release(const char *dirname)
|
||||||
{
|
{
|
||||||
@ -188,12 +188,12 @@ static char *get_kernel_release(const char *dirname)
|
|||||||
* release the resources of the kmod library context.
|
* release the resources of the kmod library context.
|
||||||
*
|
*
|
||||||
* @dirname: what to consider as linux module's directory, if NULL
|
* @dirname: what to consider as linux module's directory, if NULL
|
||||||
* defaults to /lib/modules/`uname -r`.
|
* defaults to $rootprefix/lib/modules/`uname -r`.
|
||||||
* @config_paths: ordered array of paths (directories or files) where
|
* @config_paths: ordered array of paths (directories or files) where
|
||||||
* to load from user-defined configuration parameters such as
|
* to load from user-defined configuration parameters such as
|
||||||
* alias, blacklists, commands (install, remove). If
|
* alias, blacklists, commands (install, remove). If
|
||||||
* NULL defaults to /run/modprobe.d, /etc/modprobe.d and
|
* NULL defaults to /run/modprobe.d, /etc/modprobe.d and
|
||||||
* /lib/modprobe.d. Give an empty vector if configuration should
|
* $rootprefix/lib/modprobe.d. Give an empty vector if configuration should
|
||||||
* not be read. This array must be null terminated.
|
* not be read. This array must be null terminated.
|
||||||
*
|
*
|
||||||
* Returns: a new kmod library context
|
* Returns: a new kmod library context
|
||||||
|
@ -320,7 +320,7 @@ static void help(const char *progname)
|
|||||||
"\t-0, --null Use \\0 instead of \\n\n"
|
"\t-0, --null Use \\0 instead of \\n\n"
|
||||||
"\t-F, --field=FIELD Print only provided FIELD\n"
|
"\t-F, --field=FIELD Print only provided FIELD\n"
|
||||||
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
|
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
|
||||||
"\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
|
"\t-b, --basedir=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
|
||||||
"\t-V, --version Show version\n"
|
"\t-V, --version Show version\n"
|
||||||
"\t-h, --help Show this help\n",
|
"\t-h, --help Show this help\n",
|
||||||
progname);
|
progname);
|
||||||
@ -402,7 +402,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
kversion = u.release;
|
kversion = u.release;
|
||||||
}
|
}
|
||||||
snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
|
snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
|
||||||
root, kversion);
|
root, kversion);
|
||||||
dirname = dirname_buf;
|
dirname = dirname_buf;
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ static void help(const char *progname)
|
|||||||
"\t-n, --dry-run Do not execute operations, just print out\n"
|
"\t-n, --dry-run Do not execute operations, just print out\n"
|
||||||
"\t-n, --show Same as --dry-run\n"
|
"\t-n, --show Same as --dry-run\n"
|
||||||
|
|
||||||
"\t-C, --config=FILE Use FILE instead of /etc/modprobe.d\n"
|
"\t-C, --config=FILE Use FILE instead of " SYSCONFDIR "/modprobe.d\n"
|
||||||
"\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
|
"\t-d, --dirname=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
|
||||||
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
|
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
|
||||||
|
|
||||||
"\t-s, --syslog print to syslog, not stderr\n"
|
"\t-s, --syslog print to syslog, not stderr\n"
|
||||||
@ -1252,7 +1252,7 @@ int main(int argc, char **orig_argv)
|
|||||||
}
|
}
|
||||||
kversion = u.release;
|
kversion = u.release;
|
||||||
}
|
}
|
||||||
snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
|
snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
|
||||||
root, kversion);
|
root, kversion);
|
||||||
dirname = dirname_buf;
|
dirname = dirname_buf;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user