It is now possible to loop echo-server and echo-client test applications together when they are running in qemu. Start echo-server with "make server" and echo-client using "make client" in the corresponding samples directory. Change-Id: Ic852735f7bebc93e42873e98427e282902b3ca03 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
121 lines
4.1 KiB
Makefile
121 lines
4.1 KiB
Makefile
# Makefile - IP network stack Makefile for nano and micro kernel
|
|
|
|
#
|
|
# Copyright (c) 2015 Intel Corporation
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are met:
|
|
#
|
|
# 1) Redistributions of source code must retain the above copyright notice,
|
|
# this list of conditions and the following disclaimer.
|
|
#
|
|
# 2) Redistributions in binary form must reproduce the above copyright notice,
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
# and/or other materials provided with the distribution.
|
|
#
|
|
# 3) Neither the name of Wind River Systems nor the names of its contributors
|
|
# may be used to endorse or promote products derived from this software without
|
|
# specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
|
|
PIPE_BASE=/tmp/ip-stack
|
|
|
|
ifeq ($(MAKECMDGOALS),server)
|
|
QEMU_NUM=server
|
|
endif
|
|
ifeq ($(MAKECMDGOALS),client)
|
|
QEMU_NUM=client
|
|
endif
|
|
ifdef QEMU_NUM
|
|
QEMU_EXTRA_FLAGS += -serial none -serial pipe:${PIPE_BASE}-${QEMU_NUM} -pidfile qemu-${QEMU_NUM}.pid
|
|
else
|
|
QEMU_EXTRA_FLAGS = -serial none -serial unix:/tmp/slip.sock
|
|
endif
|
|
|
|
PIPE_SERVER_IN=${PIPE_BASE}-server.in
|
|
PIPE_SERVER_OUT=${PIPE_BASE}-server.out
|
|
PIPE_CLIENT_IN=${PIPE_BASE}-client.in
|
|
PIPE_CLIENT_OUT=${PIPE_BASE}-client.out
|
|
|
|
.PHONY: remove_pipes
|
|
remove_pipes:
|
|
rm -f ${PIPE_SERVER_IN} ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN} \
|
|
${PIPE_CLIENT_OUT}
|
|
|
|
${PIPE_SERVER_IN}:
|
|
mkfifo $@
|
|
${PIPE_SERVER_OUT}:
|
|
mkfifo $@
|
|
${PIPE_CLIENT_IN}:
|
|
mkfifo $@
|
|
${PIPE_CLIENT_OUT}:
|
|
mkfifo $@
|
|
|
|
.PHONY: PIPE_CLIENT_IN_LINK
|
|
PIPE_CLIENT_IN_LINK: ${PIPE_SERVER_IN}
|
|
-ln ${PIPE_SERVER_IN} ${PIPE_CLIENT_OUT}
|
|
|
|
.PHONY: PIPE_CLIENT_OUT_LINK
|
|
PIPE_CLIENT_OUT_LINK: ${PIPE_SERVER_OUT}
|
|
-ln ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN}
|
|
|
|
# Setup the dual qemu test case with pcap support (two qemus passing data
|
|
# between them and saving data to pcap via help of monitor applicaiton)
|
|
.PHONY: setup_pipes_dual_monitor
|
|
setup_pipes_dual_monitor: ${PIPE_SERVER_IN} ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN} ${PIPE_CLIENT_OUT}
|
|
|
|
CONFIG_OPTIONS_1="CONFIG_NETWORKING_WITH_15_4=y"
|
|
CONFIG_OPTIONS_2="CONFIG_NETWORKING_WITH_15_4_LOOPBACK_UART=y"
|
|
CONFIG_OPTIONS_3="CONFIG_NETWORKING_WITH_6LOWPAN=y"
|
|
CONFIG_OPTIONS_4="CONFIG_NETWORKING_STATISTICS=y"
|
|
|
|
.PHONY: set_options
|
|
set_options:
|
|
# Network uart must be turned off as that will prevent communication
|
|
cp -f ${DOTCONFIG} ${DOTCONFIG}.orig ; true
|
|
grep -v CONFIG_NETWORKING_UART=y ${DOTCONFIG}.orig > ${DOTCONFIG}
|
|
echo "${CONFIG_OPTIONS_1}" >> ${DOTCONFIG}
|
|
echo "${CONFIG_OPTIONS_2}" >> ${DOTCONFIG}
|
|
echo "${CONFIG_OPTIONS_3}" >> ${DOTCONFIG}
|
|
echo "${CONFIG_OPTIONS_4}" >> ${DOTCONFIG}
|
|
|
|
export QEMU_NUM
|
|
export QEMU_EXTRA_FLAGS
|
|
|
|
PID_FILE=/tmp/monitor_15_4.pid
|
|
|
|
hosttoolsmake = @$(MAKE) -C $(ZEPHYR_BASE)/net/ip/tools $1
|
|
|
|
${ZEPHYR_BASE}/net/ip/tools/monitor_15_4:
|
|
$(Q)$(call hosttoolsmake,monitor_15_4)
|
|
|
|
.PHONY: start_monitor
|
|
start_monitor: ${ZEPHYR_BASE}/net/ip/tools/monitor_15_4
|
|
${ZEPHYR_BASE}/net/ip/tools/monitor_15_4 \
|
|
server-client-monitor.pcap \
|
|
${PIPE_BASE}-server ${PIPE_BASE}-client > /dev/null & \
|
|
echo "$$!" > ${PID_FILE}
|
|
|
|
server: remove_pipes setup_pipes_dual_monitor $(DOTCONFIG) set_options start_monitor
|
|
$(Q)$(call zephyrmake,$(O),qemu); true
|
|
$(Q)kill `cat ${PID_FILE}`
|
|
$(Q)rm -f ${PID_FILE}
|
|
-@killall monitor_15_4 > /dev/null 2>&1 ; true
|
|
$(Q)stty sane
|
|
|
|
client: setup_pipes_dual_monitor $(DOTCONFIG) set_options
|
|
$(Q)$(call zephyrmake,$(O),qemu); true
|
|
$(Q)stty sane
|