Documentation: add notes about TAP configuration for qemu

add notes how to configure QEMU network with TAP.

Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl
2025-12-18 11:50:14 +01:00
committed by Alan C. Assis
parent 67e3266275
commit 1b358af82f
3 changed files with 52 additions and 2 deletions
+1
View File
@@ -60,4 +60,5 @@ Guides
remove_device_drivers_nsh.rst
rust.rst
optee.rst
qemu_tips.rst
+44
View File
@@ -0,0 +1,44 @@
=========
QEMU Tips
=========
Netowrking with TAP device
==========================
Step 1: Configure NuttX network with ``NETUTILS_NETINIT``::
CONFIG_NETUTILS_NETINIT=y
CONFIG_NETINIT_IPADDR=0xc0a80868 # Target: 192.168.8.104
CONFIG_NETINIT_DRIPADDR=0xc0a80801 # Router: 192.168.8.1
CONFIG_NETINIT_NETMASK=0xffffff00 # Mask: 255.255.255.0
Step 2: Create and configure a TAP device on the host::
# Create the bridge
sudo ip link add name br0 type bridge
sudo ip link set br0 up
# Create the tap interface
sudo ip tuntap add dev tap0 mode tap
sudo ip link set tap0 master br0
sudo ip link set tap0 up
# (optional) also attach your real NIC if you want LAN access
# sudo ip link set enp3s0 master br0
# Assign IP to the *bridge*
sudo ip addr add 192.168.8.1/24 dev br0
Step 3: Launch QEMU using the TAP interface::
qemu-system-x86_64 -m 2G -smp 4 -cpu host -enable-kvm \
-kernel nuttx -nographic -serial mon:stdio \
-device e1000,netdev=mynet0 \
-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no
Step 4: Clean up::
sudo ip link set tap0 down
sudo ip link set br0 down
sudo ip tuntap del dev tap0 mode tap
sudo ip link del br0
@@ -5,8 +5,6 @@ qemu-intel64
This page file describes the contents of the build configurations available
for the NuttX QEMU x86_64 port.
QEMU/KVM
========
@@ -187,6 +185,13 @@ Command to run the image with some xHCI devices attached::
-kernel nuttx -serial mon:stdio -chardev pty,id=ch1 \
-device qemu-xhci -device usb-mouse -device usb-kbd
Command to run the image with e1000 NIC device with TAP::
qemu-system-x86_64 -m 2G -smp 4 -cpu host -enable-kvm \
-kernel nuttx -nographic -serial mon:stdio \
-device e1000,netdev=mynet0 \
-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no
knsh_romfs
----------