0

I'm trying to run some network program (like nginx) on RISC-V.

I'm not aware of network devices available on RISC-V, and I don't want to implement it myself, so I'm looking for the other way.

First I tried running simple program that send HTTP request to the given address. It resolves the IP address using gethostbyname and sends a HTTP request.

I successfully ran riscv-linux on spike simulator, and compiled the program and ran it. gethostbyname returns Unknown server error, and when I use IP address directly, connect returns Network is unreachable error.

I found that the front end server fesvr can handle system calls that is forwarded from the RISC-V processor, and thought maybe it will handle network related system calls. I also found fesvr-eth and thought maybe it is something related to handling network services, but according to this link it is just for connecting fesvr running on PC to the development board by ethernet. Also fesvr-eth has been removed from the latest git repo.

So now I want to look and risc-v linux and see how it actually handle network system calls like connect. I'm thinking maybe if the network operations are only done inside localhost, it can be handled properly without a network device. Or there can be easy way to extend fesvr to handle network services.

Summarizing the questions:

  • is there a way to run network applications in RISC-V, that I missed?
  • can network services be actually handled if the request is from within the same host, even if there is no network devices?
  • any other comments or references that can be helpful?
Community
  • 1
  • 1
j.s.shin
  • 11
  • 2

1 Answers1

0

At the moment, neither spike nor riscv-qemu provide models for network interfaces. With both of these tools, you will be able to use the loopback device (127.0.0.1) for networking among processes. Loopback networking is implemented directly by the OS kernel.

For other architectures, qemu provides a large number of networking options. It should not be too difficult to modify riscv-qemu/hw/riscv/riscv_board.c to instantiate one of these virtual network interfaces into an emulated risc-v system.

Jamey Hicks
  • 2,340
  • 1
  • 14
  • 20
  • Thanks. I added `ifconfig` applet in `busybox` and used `ifconfig lo: 127.0.0.1 netmask 255.0.0.0 up` command to set up loopback network. Then I ran simple echo server and client, but the server and client hang on `accept` and `connect` respectively. loopback network seems to be set up correctly, because if I run the program without setting it up, `connect` fails with `network unreachable`. I'll add to the comment if I have updates. – j.s.shin Jul 05 '16 at 06:58