mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
risc-v/qemu-rv/rv-virt: Add support to loader ROMFS image in kernel
Use ROMFS to load user applications in kernel mode instead of using hostfs.
This commit is contained in:
committed by
Xiang Xiao
parent
c86cb9e7ef
commit
cb32e6d50a
@@ -150,6 +150,29 @@ To build it, use the following command::
|
||||
|
||||
Run it with QEMU using the default command for 32-bit RISC-V.
|
||||
|
||||
In `nsh`, applications can be run from the `/system/bin` directory::
|
||||
|
||||
nsh> /system/bin/hello
|
||||
|
||||
knsh32_romfs
|
||||
------------
|
||||
|
||||
Similar to the `knsh32`_ configuration, but uses ROMFS instead of `hostfs`.
|
||||
A ROMFS image is generated and linked to the kernel. This requires re-running ``make``::
|
||||
|
||||
$ make V=1 -j$(nproc)
|
||||
$ make export V=1 -j$(nproc)
|
||||
$ pushd ../apps
|
||||
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
|
||||
$ make import V=1 -j$(nproc)
|
||||
$ ./tools/mkromfsimg.sh ../nuttx/arch/risc-v/src/board/romfs_boot.c
|
||||
$ popd
|
||||
$ make V=1 -j$(nproc)
|
||||
|
||||
To run it, use the following command::
|
||||
|
||||
$ qemu-system-riscv32 -M virt,aclint=on -cpu rv32 -smp 8 -bios none -kernel nuttx -nographic
|
||||
|
||||
In `nsh`, applications can be run from the `/system/bin` directory::
|
||||
|
||||
nsh> /system/bin/hello
|
||||
@@ -310,13 +333,16 @@ If needed, one should also load the application symbols using the following comm
|
||||
|
||||
``address`` refers to the ``.text`` section of the application and can be retrieved from the ELF file using the following command::
|
||||
|
||||
$ readelf -WS <file> | grep .text
|
||||
$ riscv-none-elf-readelf -WS <file> | grep .text
|
||||
|
||||
For instance, to check the ``.text`` section address of the ``hello`` application, use the following command::
|
||||
|
||||
$ readelf -WS ../apps/bin/hello | grep .text
|
||||
$ riscv-none-elf-readelf -WS ../apps/bin/hello | grep .text
|
||||
[ 1] .text PROGBITS c0000000 001000 0009e0 00 AX 0 0 2
|
||||
|
||||
.. note:: Pay attention that ``riscv-none-elf-readelf`` refers to your toolchain's readelf utility. Adjust accordingly if you are
|
||||
using a different toolchain.
|
||||
|
||||
Then, look for the ``.text`` section address and use the ``c0000000`` as the address to load the symbols.
|
||||
|
||||
For instance, if you want to load the ``hello`` application, you can use the following command in GDB::
|
||||
|
||||
Reference in New Issue
Block a user