mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 02:28:54 +00:00
959b80bab1
The 'server_ip' and 'server_port' attributes for 'lxip/udp_client' and 'lwip/http_clnt' as well as the 'port' attribute for 'lxip/udp_echo' and 'lwip/http_srv_static' are not directly libc-related so they should not live in the libc tag but in the config tag of the component. Ref #2193
370 lines
11 KiB
Plaintext
370 lines
11 KiB
Plaintext
#
|
|
# 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
|
|
|
|
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
|
|
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]]
|
|
|
|
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 }
|
|
|
|
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
|
|
}
|
|
|
|
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
|
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
|
return gpio_drv }
|
|
|
|
lappend_if $use_usb_driver build_components drivers/usb
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
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>}
|
|
|
|
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>}
|
|
|
|
append_platform_drv_config
|
|
|
|
append_if $use_nic_driver config {
|
|
<start name="nic_drv">
|
|
<resource name="RAM" quantum="6M"/>
|
|
<provides><service name="Nic"/></provides>
|
|
</start>}
|
|
|
|
append config {
|
|
<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">
|
|
|
|
<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" />
|
|
|
|
</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>
|
|
<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" />
|
|
</config>
|
|
<route>}
|
|
append config "
|
|
<service name=\"Nic\"> <child name=\"${nic_driver}\"/> </service>"
|
|
append config {
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append_if $udp_down_to_down_1 config {
|
|
|
|
<start name="udp_client_1">
|
|
<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 server_ip="10.0.98.33" server_port="1337">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.98.55"
|
|
gateway="10.0.98.33" netmask="255.255.255.0"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="udp_server_1">
|
|
<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 port="1337">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.99.55"
|
|
gateway="10.0.99.33" netmask="255.255.255.0"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append_if $udp_up_to_down_1 config {
|
|
|
|
<start name="udp_client_2">
|
|
<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 server_ip="10.0.2.55" server_port="1">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.123"
|
|
gateway="10.0.2.55" netmask="255.255.255.0"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="udp_server_2">
|
|
<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 port="1">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="18.17.16.15"
|
|
gateway="18.17.16.14" netmask="255.255.0.0"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append_if $udp_down_to_up_1 config {
|
|
|
|
<start name="udp_client_3">
|
|
<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 server_ip="10.0.2.70" server_port="65535">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="217.13.192.2"
|
|
gateway="217.13.192.1" netmask="255.255.192.0"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="udp_server_3">
|
|
<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 port="65535">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.70"
|
|
netmask="255.255.255.0" gateway="10.0.2.55"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append_if $tcp_up_to_down_1 config {
|
|
|
|
<start name="http_server_1">
|
|
<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 port="80">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.1.18"
|
|
netmask="255.255.255.0" gateway="192.168.1.1" />
|
|
</config>
|
|
</start>
|
|
|
|
<start name="http_client_1">
|
|
<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 server_ip="10.0.2.55" server_port="80">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append_if $tcp_up_to_down_2 config {
|
|
|
|
<start name="http_server_2">
|
|
<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 port="8080">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.2.72"
|
|
netmask="255.255.255.0" gateway="192.168.2.1"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="http_client_2">
|
|
<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 server_ip="10.0.2.55" server_port="8080">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append_if $tcp_down_to_up_1 config {
|
|
|
|
<start name="http_server_3">
|
|
<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 port="2345">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.11"
|
|
netmask="255.255.255.0" gateway="10.0.2.1"/>
|
|
</config>
|
|
</start>
|
|
<start name="http_client_3">
|
|
<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 server_ip="10.0.2.11" server_port="2345">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="100.200.0.128"
|
|
netmask="255.255.0.0" gateway="100.200.0.1"/>
|
|
</config>
|
|
</start>}
|
|
|
|
append config { </config> }
|
|
|
|
install_config $config
|
|
|
|
#
|
|
# Boot modules
|
|
#
|
|
|
|
# generic modules
|
|
set boot_modules {
|
|
|
|
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
|
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
|
|
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]
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
# qemu config
|
|
append qemu_args " -m 256 -nographic "
|
|
|
|
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 "
|
|
|
|
run_genode_until ".*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n" 60
|