From 502e47221ad1bf7e7e72814b794875d0294f23c2 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Thu, 23 Jan 2025 16:15:47 +0800 Subject: [PATCH] examples/module: add hostfs support This allows loading the kernel module from a hostfs file system. Signed-off-by: Yanfeng Liu --- examples/module/main/Kconfig | 8 ++++++++ examples/module/main/module_main.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/module/main/Kconfig b/examples/module/main/Kconfig index 28a9c5f2638..b3a8889e6a9 100644 --- a/examples/module/main/Kconfig +++ b/examples/module/main/Kconfig @@ -115,6 +115,14 @@ config EXAMPLES_MODULE_BINDIR The full, absolute path to the location for the binaries can be located in a pre-mounted external file system. +config EXAMPLES_MODULE_FSDATA + string "Additional data passed to mount" + default "" + depends on EXAMPLES_MODULE_FSMOUNT + ---help--- + Additional data needed by mount. For example, when hostfs + is used, this can be "fs=../apps/bin" + config EXAMPLES_MODULE_LIBC bool "Link with LIBC" default n diff --git a/examples/module/main/module_main.c b/examples/module/main/module_main.c index 74dc98b7c3e..37da14fee16 100644 --- a/examples/module/main/module_main.c +++ b/examples/module/main/module_main.c @@ -253,7 +253,8 @@ int main(int argc, FAR char *argv[]) CONFIG_EXAMPLES_MODULE_FSTYPE, MOUNTPT); ret = mount(CONFIG_EXAMPLES_MODULE_DEVPATH, MOUNTPT, - CONFIG_EXAMPLES_MODULE_FSTYPE, MS_RDONLY, NULL); + CONFIG_EXAMPLES_MODULE_FSTYPE, MS_RDONLY, + CONFIG_EXAMPLES_MODULE_FSDATA); if (ret < 0) { printf("ERROR: mount(%s, %s, %s) failed: %d\n",