rtems初始化FS,调用流程:(4.11代码)
(1)boot_card
(2)bsp_libc_init
/*
* Initialize the C library for those BSPs using the shared
* framework.
*/
(3)函数指针(*rtems_libio_init_helper)
/*
* Init the RTEMS libio facility to provide UNIX-like system
* calls for use by newlib (ie: provide open, close, etc)
* Uses malloc() to get area for the iops, so must be after malloc init
*/
(4)编译指令(是否CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:如果不disable):
rtems_libio_init
(5)函数指针:*rtems_fs_init_helper
/*
* Initialize the base file system infrastructure.
*/
(6)编译指令(是否CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:如果不disable):
rtems_filesystem_initialize
6.1从rtems_filesystem_root_configuration表中读取内容
rtems_filesystem_root_configuration表在confdefs.h中配置,是rtems_filesystem_mount_configuration类型的
const rtems_filesystem_mount_configuration
rtems_filesystem_root_configuration = {
NULL,
NULL,
#if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
RTEMS_FILESYSTEM_TYPE_DEVFS,
#elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
RTEMS_FILESYSTEM_TYPE_MINIIMFS,
#else
RTEMS_FILESYSTEM_TYPE_IMFS,
#endif
RTEMS_FILESYSTEM_READ_WRITE,
#if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
&devFS_root_filesystem_data
#else
NULL
#endif
};
指定: source , target = NULL 。说明是根目录且不使用设备文件
FS的类型:DevFS,MINIIMFS,IMFS(default)
FS的读写性
用户传递的data
6.2 函数接着mount到 / 根目录,然后生成 /dev 目录。初始化装载文件系统就结束了。
Note:在(4)和(6)中如果条件判断disable成立(用户定义了不使用FS的话),就do nothing了
********************************************************************************************************************
1.嵌入式系统大多没有文件系统的,或者有文件系统,并不作为系统启动必须的话,应该不需要根文件系统了。那么,当需要文件系统的时候如何挂载上去?就像6.2那样自己产生一个根目录?