This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Run Zephyr OS for qemu_x86 and access guest Filesystem

Hi,

We're developing with Zephyr OS on nrf9160 and recently added SD Card support. We build our application also for qemu_x86 for testing purposes and would like to add some kind of filesystem support to basically fake the contents of the SD Card. Ideally this files can be accessed & manipulated from the host system.

To achieve this my current idea is to enable LittleFS on the storage partition provided by qemu_x86.dts (https://docs.zephyrproject.org/latest/samples/subsys/fs/littlefs/README.html). The second step would be to somehow make this partition accessible from outside QEMU, the host system. If this cannot be done then at least I would like to preinsert some testdata in this partition..

Has anyone already tried something similar, or can give me some advice on this matter?

best regards

Parents Reply
  • Hi Simon

    Thank you for your efforts.

    In the meantime i managed to enable a LittleFS partition in qemu_x86 and  the zepyhr file system shell. This allows me to access the filesystem with special uart commands (see here: https://docs.zephyrproject.org/latest/samples/subsys/shell/fs/README.html). Making the uart accessible from outside qemu was not a big deal (see here: https://fadeevab.com/how-to-setup-qemu-output-to-console-and-automate-using-shell-script/).
    This interface now allows me to interact with files but it is very inefficient when I try to write large files in the magnitude of  a megabyte.

    The second approach which I am investigating is to use  "-drive" Parameter when executing qemu in order to make my data accessible to the Zephyr Guest OS. There was this issue here, which looks really similar to what I would like to achieve: https://github.com/zephyrproject-rtos/zephyr/issues/4911. Unfortunately it was closed some time ago and never got resolved.
    I'm struggling to understand how this drive Parameter works and how the Zephyr Guest OS can make use of this.
    Is this going to be some peripheral device for Zephyr OS, any idea?

    The third idea is to somehow write data to the LittleFS partition before the Zephyr OS inside QEMU is booting. This way it would look like there was already a file and I can use that for my tests. Currently each time when I start Zephyr in qemu, the LittleFS partition is empty again. Any idea on how to achieve that?

    best regards

Children
Related