net: qemu: Allow SLIP or normal ethernet connectivity

Introduce new Kconfig option for selecting either slip or ethernet
connectivity to host.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2018-10-16 14:27:21 +03:00 committed by Anas Nashif
parent 0eb0e78d67
commit 421505c7e3
6 changed files with 59 additions and 3 deletions

View file

@ -13,7 +13,6 @@ set(QEMU_FLAGS_${ARCH}
-nographic
-vga none
-display none
-net none
-no-acpi
-machine type=pc-0.14
)

View file

@ -327,6 +327,28 @@ message(STATUS "Cache files will be written to: ${USER_CACHE_DIR}")
include(${BOARD_DIR}/board.cmake OPTIONAL)
# If we are using a suitable ethernet driver inside qemu, then these options
# must be set, otherwise a zephyr instance cannot receive any network packets.
# The Qemu supported ethernet driver should define CONFIG_ETH_NIC_MODEL
# string that tells what nic model Qemu should use.
if(CONFIG_QEMU_TARGET)
if(CONFIG_NET_QEMU_ETHERNET)
if(CONFIG_ETH_NIC_MODEL)
list(APPEND QEMU_FLAGS_${ARCH}
-nic tap,model=${CONFIG_ETH_NIC_MODEL},script=no,downscript=no,ifname=zeth
)
else()
message(FATAL_ERROR
"No Qemu ethernet driver configured!
Enable Qemu supported ethernet driver like e1000 at drivers/ethernet")
endif()
else()
list(APPEND QEMU_FLAGS_${ARCH}
-net none
)
endif()
endif()
zephyr_library_named(app)
add_subdirectory(${ZEPHYR_BASE} ${__build_dir})

View file

@ -72,8 +72,10 @@ endif()
# pass data between them. The QEMU flags are not set for standalone
# tests defined by CONFIG_NET_TEST.
if(CONFIG_NETWORKING)
if(CONFIG_NET_SLIP_TAP)
set(QEMU_NET_STACK 1)
if(CONFIG_NET_QEMU_SLIP)
if(CONFIG_NET_SLIP_TAP)
set(QEMU_NET_STACK 1)
endif()
endif()
endif()

View file

@ -12,3 +12,12 @@ menuconfig ETH_E1000
depends on NET_L2_ETHERNET && PCI_ENUMERATION
help
Enable Intel(R) PRO/1000 Gigabit Ethernet driver.
# Hidden option
config ETH_NIC_MODEL
string
default "e1000"
depends on ETH_E1000
help
Tells what Qemu network model to use. This value is given as
a parameter to -nic qemu command line option.

View file

@ -35,6 +35,7 @@
#
menuconfig SLIP
bool "SLIP driver"
depends on (!QEMU_TARGET || NET_QEMU_SLIP)
select UART_PIPE
select UART_INTERRUPT_DRIVEN

View file

@ -20,6 +20,28 @@ config NET_RAW_MODE
if !NET_RAW_MODE
choice
prompt "Qemu networking"
default NET_QEMU_SLIP
depends on QEMU_TARGET
help
Can be used to select how the network connectivity is established
from inside qemu to host system. This can be done either via
serial connection (SLIP) or via Qemu ethernet driver.
config NET_QEMU_SLIP
bool "SLIP"
help
Connect to host or to another Qemu via SLIP.
config NET_QEMU_ETHERNET
bool "Ethernet"
help
Connect to host system via Qemu ethernet driver support. One such
driver that Zephyr supports is Intel e1000 ethernet driver.
endchoice
config NET_INIT_PRIO
int
default 90
@ -355,6 +377,7 @@ config NET_TEST
config NET_SLIP_TAP
bool "TAP SLIP driver"
depends on NET_QEMU_SLIP
select SLIP
select UART_PIPE
select UART_INTERRUPT_DRIVEN