[bsp/qemu-vexpress-a9] add remount operation to avoid dfs_mout fail (#6018)
This commit is contained in:
parent
1d6347796d
commit
59d3156611
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#define DBG_TAG "FileSystem"
|
||||||
|
#define DBG_LVL DBG_INFO
|
||||||
|
#include <rtdbg.h>
|
||||||
|
|
||||||
#ifdef RT_USING_DFS
|
#ifdef RT_USING_DFS
|
||||||
#include <dfs_fs.h>
|
#include <dfs_fs.h>
|
||||||
|
|
||||||
|
@ -19,10 +23,25 @@ int mnt_init(void)
|
||||||
|
|
||||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||||
{
|
{
|
||||||
rt_kprintf("file system initialization done!\n");
|
LOG_I("file system initialization done!\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_W("[sd0] File System on SD ('sd0') initialization failed!");
|
||||||
|
LOG_W("[sd0] Try to format and re-mount...");
|
||||||
|
if (dfs_mkfs("elm", "sd0") == 0)
|
||||||
|
{
|
||||||
|
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||||
|
{
|
||||||
|
LOG_I("[sd0] File System on SD ('sd0') initialized!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
LOG_E("[sd0] File System on SD ('sd0') initialization failed!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
INIT_ENV_EXPORT(mnt_init);
|
INIT_ENV_EXPORT(mnt_init);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue