This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 55e4a98df7 docs: Migrate network documentation of sim to Documentations
55e4a98df7 is described below
commit 55e4a98df719714e6a0bb3680172719214bff067
Author: Huang Qi <[email protected]>
AuthorDate: Thu Sep 12 22:56:03 2024 +0800
docs: Migrate network documentation of sim to Documentations
Move the docs in boards of sim to common place.
Signed-off-by: Huang Qi <[email protected]>
---
Documentation/platforms/sim/index.rst | 2 ++
.../platforms/sim/network_linux.rst | 25 ++++++++++++++++++----
.../platforms/sim/network_vpnkit.rst | 18 +++++++++++-----
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/Documentation/platforms/sim/index.rst
b/Documentation/platforms/sim/index.rst
index 0b42eb239b..ddd06b6606 100644
--- a/Documentation/platforms/sim/index.rst
+++ b/Documentation/platforms/sim/index.rst
@@ -12,3 +12,5 @@ The following Simulator/Emulators are supported:
:glob:
*/*
+ network_linux
+ network_vpnkit
diff --git a/boards/sim/sim/sim/NETWORK-LINUX.txt
b/Documentation/platforms/sim/network_linux.rst
similarity index 93%
rename from boards/sim/sim/sim/NETWORK-LINUX.txt
rename to Documentation/platforms/sim/network_linux.rst
index 5c3f4dd127..f200ab9978 100644
--- a/boards/sim/sim/sim/NETWORK-LINUX.txt
+++ b/Documentation/platforms/sim/network_linux.rst
@@ -25,10 +25,11 @@ you assign an IP that is already in use on your network,
your host won't be
able to see it until the simulation is stopped. The host route will force all
traffic destined for that IP to be sent to the tap interface.
-NOTE: If you configure an IP address that is not on the same subnet as your
- host, additional manual setup will be required. A helper script,
- `tools/simhostroute.sh` is provided that can do this setup on Linux.
- On Windows or macOS using host route mode is not recommended.
+.. note::
+ If you configure an IP address that is not on the same subnet as your
+ host, additional manual setup will be required. A helper script,
+ `tools/simhostroute.sh` is provided that can do this setup on Linux.
+ On Windows or macOS using host route mode is not recommended.
Recent versions of Linux require setting kernel capabilities to allow the nuttx
executable access to the tap network driver. You can see more about the tun/tap
@@ -41,6 +42,8 @@ configuration.
To compile:
+.. code-block:: bash
+
$ cp boards/sim/sim/sim/configs/tcpblaster/defconfig .config
$ make menuconfig # optional, to adjust configuration
$ make clean; make
@@ -49,6 +52,8 @@ You can do the following after compiling the NuttX simulator:
On Linux:
+.. code-block:: bash
+
$ # necessary on recent Linux distributions
$ sudo setcap cap_net_admin+ep ./nuttx
$ # set up the host route and IP tables rules
@@ -59,6 +64,8 @@ On Linux:
On the NuttX Simulator:
+.. code-block:: bash
+
nsh> # replace or omit dns if needed, IPv6 line is optional
nsh> ifconfig eth0 inet6 fc00::2/112 dns 2001:4860:4860::8888
nsh> ifconfig eth0 10.0.1.2 dns 8.8.8.8
@@ -66,6 +73,8 @@ On the NuttX Simulator:
On Linux:
+.. code-block:: bash
+
$ # is nuttx up?
$ ping 10.0.1.2
@@ -84,6 +93,8 @@ To create the bridge, first install the bridge utilities
package for your
platform (the net-tools RPM in RedHat, for example). Then execute a
command like the following:
+.. code-block:: bash
+
# ip link add nuttx0 type bridge
This will create the nuttx0 bridge. Once created, the bridge may be used by
@@ -100,6 +111,8 @@ that the subnet chosen should not already be in use. For
example, if
you want to use the 172.26.23.0/24 subnet for your simluations, you
would do something like the following:
+.. code-block:: bash
+
# ip link add nuttx0 type bridge
# ifconfig nuttx0 172.26.23.1/24
@@ -119,6 +132,8 @@ with NuttX. For example, if you have a secondary eth1
interface on your host,
you can simply connect it to the network you want your simulations to access,
and run the following command:
+.. code-block:: bash
+
# ip link set eth1 master nuttx0
From that point on, your simulations will be directly connected to the same
@@ -129,6 +144,8 @@ If you only have a single interface, you can configure your
system so that eth0
(or other primary interface) is on the bridge. To do this, you would execute
commands like the following from the system console:
+.. code-block:: bash
+
# ip link add nuttx0 type bridge
# ip link set eth0 master nuttx0
# ifconfig nuttx0 <host-ip-address/netmask>
diff --git a/boards/sim/sim/sim/NETWORK-VPNKIT.txt
b/Documentation/platforms/sim/network_vpnkit.rst
similarity index 70%
rename from boards/sim/sim/sim/NETWORK-VPNKIT.txt
rename to Documentation/platforms/sim/network_vpnkit.rst
index 5a80f7120b..f3e4da1ae9 100644
--- a/boards/sim/sim/sim/NETWORK-VPNKIT.txt
+++ b/Documentation/platforms/sim/network_vpnkit.rst
@@ -8,37 +8,45 @@ as well.
Configuration
-------------
+.. code-block:: bash
+
CONFIG_SIM_NETDEV=y
CONFIG_SIM_NETDEV_TAP is not set
CONFIG_SIM_NETDEV_VPNKIT=y
CONFIG_SIM_NETDEV_VPNKIT_PATH="/tmp/vpnkit-nuttx"
-You can use the sim:vpnkit configuration, which includes the above
+You can use the ``sim:vpnkit`` configuration, which includes the above
settings.
+.. code-block:: bash
+
./tools/configure.sh sim:vpnkit
VPNKit setup
------------
-See https://github.com/moby/vpnkit for build instructions.
+See `https://github.com/moby/vpnkit` for build instructions.
If you have Docker Desktop for Mac installed on your machine,
you can find a vpnkit binary at:
+.. code-block:: bash
+
/Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit
A docker image containing a static Linux binary is also available:
- https://hub.docker.com/r/djs55/vpnkit
+`https://hub.docker.com/r/djs55/vpnkit`
How to run
----------
You can use it as the following:
+.. code-block:: bash
+
% vpnkit --ethernet /tmp/vpnkit-nuttx &
% ./nuttx
-NuttX's CONFIG_SIM_NETDEV_VPNKIT_PATH should match vpnkit's
---ethernet option.
+NuttX's ``CONFIG_SIM_NETDEV_VPNKIT_PATH`` should match vpnkit's
+``--ethernet`` option.