examples/module: add hostfs support

This allows loading the kernel module from a hostfs file system.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
This commit is contained in:
Yanfeng Liu 2025-01-23 16:15:47 +08:00 committed by Xiang Xiao
parent 077c3461db
commit 048b3e6f7b
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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",