summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-12-28 08:14:58 +0000
committerpeter <peter@FreeBSD.org>2000-12-28 08:14:58 +0000
commit38f70a08d1fa6a6707935f24c059ef2fac5a80f0 (patch)
treea920d8da30ba989f1bdee4e2c0af1b845348884d /sys/kern/kern_linker.c
parent4d5209b3fed76945d343c8faa260d4a332526991 (diff)
downloadFreeBSD-src-38f70a08d1fa6a6707935f24c059ef2fac5a80f0.zip
FreeBSD-src-38f70a08d1fa6a6707935f24c059ef2fac5a80f0.tar.gz
Pull out the module path from the loader. ie: if you boot from
/boot/kernel.foobar/* then that had better be in the path ahead of the others. Submitted by: Daniel J. O'Connor <darius@dons.net.au> PR: 23662
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 9fce595..5591342 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1171,11 +1171,15 @@ SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0);
* character as a separator to be consistent with the bootloader.
*/
-static char linker_path[MAXPATHLEN] = "/boot/modules/;/modules/;/boot/kernel/";
+static char def_linker_path[] = "/boot/modules/;/modules/;/boot/kernel/";
+static char linker_path[MAXPATHLEN] = "";
SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RW, linker_path,
sizeof(linker_path), "module load search path");
+TUNABLE_STR_DECL("module_path", def_linker_path, linker_path,
+ sizeof(linker_path));
+
static char *linker_ext_list[] = {
".ko",
"",
@@ -1211,14 +1215,14 @@ linker_search_path(const char *name)
/* find the end of this component */
for (ep = cp; (*ep != 0) && (*ep != ';'); ep++)
;
- result = malloc((len + (ep - cp) + extlen), M_LINKER, M_WAITOK);
+ result = malloc((len + (ep - cp) + extlen + 1), M_LINKER, M_WAITOK);
if (result == NULL) /* actually ENOMEM */
return(NULL);
for (cpp = linker_ext_list; *cpp; cpp++) {
strncpy(result, cp, ep - cp);
- strcpy(result + (ep - cp), name);
+ strcpy(result + (ep - cp), "/");
+ strcat(result, name);
strcat(result, *cpp);
-
/*
* Attempt to open the file, and return the path if we succeed
* and it's a regular file.
OpenPOWER on IntegriCloud