2016-08-25 15:48:53 +00:00
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
|
|
|
|
|
|
|
set tcp_up_to_down_1 1
|
|
|
|
set tcp_up_to_down_2 1
|
|
|
|
set tcp_down_to_up_1 1
|
|
|
|
set udp_down_to_down_1 1
|
|
|
|
set udp_up_to_down_1 1
|
|
|
|
set udp_down_to_up_1 1
|
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
|
2017-01-03 12:17:41 +00:00
|
|
|
set use_nic_driver [expr !$use_usb_driver && ![have_spec imx53] && ![have_spec riscv] && ![have_spec odroid_xu] && ![have_spec linux] && ![have_spec wand_quad]]
|
2016-12-19 14:05:41 +00:00
|
|
|
|
|
|
|
set nic_driver "nic_drv"
|
|
|
|
if ($use_usb_driver) {
|
|
|
|
set nic_driver "usb_drv" }
|
|
|
|
|
|
|
|
if {[expr !$use_usb_driver && !$use_nic_driver]} {
|
|
|
|
puts "\n Run script is not supported on this platform. \n"; exit 0 }
|
|
|
|
|
2016-08-25 15:48:53 +00:00
|
|
|
set build_components {
|
|
|
|
core init drivers/timer drivers/nic server/nic_router server/nic_bridge
|
|
|
|
test/lwip/http_srv_static test/lwip/http_clnt test/lxip/udp_echo
|
|
|
|
test/lxip/udp_client
|
|
|
|
}
|
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
lappend_if $use_usb_driver build_components drivers/usb
|
|
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
2016-08-25 15:48:53 +00:00
|
|
|
append_platform_drv_build_components
|
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate config
|
|
|
|
#
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="RAM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>}
|
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
append_if [have_spec gpio] config {
|
|
|
|
<start name="gpio_drv">
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="Gpio"/></provides>
|
|
|
|
<config/>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $use_usb_driver config {
|
|
|
|
<start name="usb_drv">
|
|
|
|
<resource name="RAM" quantum="12M"/>
|
|
|
|
<provides>
|
|
|
|
<service name="Nic"/>
|
|
|
|
</provides>
|
|
|
|
<config ehci="yes">
|
|
|
|
<nic mac="02:00:00:00:01:01" />
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
2016-08-25 15:48:53 +00:00
|
|
|
append_platform_drv_config
|
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
append_if $use_nic_driver config {
|
|
|
|
<start name="nic_drv">
|
|
|
|
<resource name="RAM" quantum="6M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
</start>}
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2016-12-19 14:05:41 +00:00
|
|
|
append config {
|
2016-08-25 15:48:53 +00:00
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="nic_router">
|
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
<config rtt_sec="3" verbose="no">
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<policy label_prefix="udp_client_1" domain="udp_client_1" />
|
|
|
|
<policy label_prefix="http_client_3" domain="http_client_3" />
|
|
|
|
<policy label_prefix="udp_client_3" domain="udp_client_3" />
|
|
|
|
<policy label_prefix="http_server_1" domain="http_server_1" />
|
|
|
|
<policy label_prefix="http_server_2" domain="http_server_2" />
|
|
|
|
<policy label_prefix="udp_server_1" domain="udp_server_1" />
|
|
|
|
<policy label_prefix="udp_server_2" domain="udp_server_2" />
|
|
|
|
|
|
|
|
<domain name="uplink" interface="10.0.2.55/24" gateway="10.0.2.1">
|
|
|
|
<tcp-forward port="80" domain="http_server_1" to="192.168.1.18" />
|
|
|
|
<tcp-forward port="8080" domain="http_server_2" to="192.168.2.72" />
|
|
|
|
<udp-forward port="1" domain="udp_server_2" to="18.17.16.15" />
|
|
|
|
<nat domain="http_client_3" tcp-ports="6" />
|
|
|
|
<ip dst="217.13.192.0/24" domain="udp_client_3" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="udp_client_1" interface="10.0.98.33/24">
|
|
|
|
<udp-forward port="1337" domain="udp_server_1" to="10.0.99.55" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="http_client_3" interface="100.200.0.1/24">
|
|
|
|
<tcp dst="10.0.0.0/16">
|
|
|
|
<permit port="2345" domain="uplink" />
|
|
|
|
</tcp>
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="udp_client_3" interface="217.13.192.1/24">
|
|
|
|
<ip dst="10.0.2.0/24" domain="uplink" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="http_server_1" interface="192.168.1.1/24" />
|
|
|
|
<domain name="http_server_2" interface="192.168.2.1/24" />
|
|
|
|
<domain name="udp_server_1" interface="10.0.99.33/24" />
|
|
|
|
<domain name="udp_server_2" interface="18.17.16.14/24" />
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="nic_bridge">
|
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
<config>
|
2016-09-12 10:55:12 +00:00
|
|
|
<policy label_prefix="nic_router" ip_addr="10.0.2.55" />
|
|
|
|
<policy label_prefix="http_server_3" ip_addr="10.0.2.11" />
|
|
|
|
<policy label_prefix="udp_client_2" ip_addr="10.0.2.123" />
|
|
|
|
<policy label_prefix="udp_server_3" ip_addr="10.0.2.70" />
|
2016-08-25 15:48:53 +00:00
|
|
|
</config>
|
2016-12-19 14:05:41 +00:00
|
|
|
<route>}
|
|
|
|
append config "
|
|
|
|
<service name=\"Nic\"> <child name=\"${nic_driver}\"/> </service>"
|
|
|
|
append config {
|
2016-08-25 15:48:53 +00:00
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $udp_down_to_down_1 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_client_1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_client" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.98.55"
|
|
|
|
gateway="10.0.98.33" netmask="255.255.255.0"
|
|
|
|
server_ip="10.0.98.33" server_port="1337">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_server_1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_echo" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.99.55"
|
|
|
|
gateway="10.0.99.33" netmask="255.255.255.0" port="1337">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $udp_up_to_down_1 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_client_2">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_client" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.123"
|
|
|
|
gateway="10.0.2.55" netmask="255.255.255.0"
|
|
|
|
server_ip="10.0.2.55" server_port="1">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_server_2">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_echo" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="18.17.16.15"
|
2016-09-12 10:55:12 +00:00
|
|
|
gateway="18.17.16.14" netmask="255.255.0.0" port="1">
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $udp_down_to_up_1 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_client_3">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_client" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="217.13.192.2"
|
|
|
|
gateway="217.13.192.1" netmask="255.255.192.0"
|
|
|
|
server_ip="10.0.2.70" server_port="65535">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="udp_server_3">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lxip_udp_echo" />
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.70"
|
2016-09-12 10:55:12 +00:00
|
|
|
netmask="255.255.255.0" gateway="10.0.2.55" port="65535">
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $tcp_up_to_down_1 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_server_1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lwip_httpsrv_static"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config ld_verbose="yes">
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.1.18"
|
|
|
|
netmask="255.255.255.0" gateway="192.168.1.1" http_port="80">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_client_1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-http_clnt"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55"
|
|
|
|
http_port="80">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $tcp_up_to_down_2 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_server_2">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lwip_httpsrv_static"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
2016-09-12 10:55:12 +00:00
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.2.72"
|
|
|
|
netmask="255.255.255.0" gateway="192.168.2.1"
|
2016-08-25 15:48:53 +00:00
|
|
|
http_port="8080">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_client_2">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-http_clnt"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55"
|
|
|
|
http_port="8080">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if $tcp_down_to_up_1 config {
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_server_3">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-lwip_httpsrv_static"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.11"
|
|
|
|
netmask="255.255.255.0" gateway="10.0.2.1" http_port="2345">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>
|
2016-09-12 10:55:12 +00:00
|
|
|
<start name="http_client_3">
|
2016-08-25 15:48:53 +00:00
|
|
|
<binary name="test-http_clnt"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="100.200.0.128"
|
|
|
|
netmask="255.255.0.0" gateway="100.200.0.1"
|
|
|
|
server_ip="10.0.2.11" http_port="2345">
|
|
|
|
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
</libc>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append config { </config> }
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
|
|
|
|
2016-12-22 14:01:19 +00:00
|
|
|
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
2016-08-25 15:48:53 +00:00
|
|
|
libc_resolv.lib.so lwip.lib.so lxip.lib.so test-http_clnt
|
|
|
|
test-lwip_httpsrv_static test-lxip_udp_echo test-lxip_udp_client
|
|
|
|
}
|
|
|
|
|
|
|
|
# platform-specific modules
|
2016-12-19 14:05:41 +00:00
|
|
|
lappend_if $use_usb_driver boot_modules usb_drv
|
|
|
|
lappend_if $use_nic_driver boot_modules nic_drv
|
|
|
|
lappend_if [have_spec gpio] boot_modules gpio_drv
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
# qemu config
|
2016-09-12 10:55:12 +00:00
|
|
|
append qemu_args " -m 256 -nographic "
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
|
|
|
|
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
|
|
|
|
|
|
|
append qemu_args " -net user -redir udp:5555::1337 "
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
run_genode_until ".*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n" 60
|