summaryrefslogtreecommitdiff
path: root/bsp/qemu-virt64-aarch64/applications/mnt.c
blob: 262c19c4f75790912875246c6b1f278e08bd9f30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021/08/19     bernard      the first version
 */

#include <rtthread.h>

#ifdef RT_USING_DFS
#include <dfs_fs.h>

int mnt_init(void)
{
    if (rt_device_find("virtio-blk0"))
    {
        /* mount virtio-blk as root directory */
        if (dfs_mount("virtio-blk0", "/", "elm", 0, RT_NULL) == 0)
        {
            rt_kprintf("file system initialization done!\n");
        }
        else
        {
            if (dfs_mount("virtio-blk0", "/", "ext", 0, RT_NULL) == 0)
            {
                rt_kprintf("file system initialization done!\n");
            }
            else
            {
                rt_kprintf("file system initialization fail!\n");
            }
        }
    }

    return 0;
}
INIT_ENV_EXPORT(mnt_init);
#endif