#
# Build components
#
proc enable_test_1 { } { return 1 }
proc enable_test_2 { } { return 1 }
source ${genode_dir}/repos/base/run/platform_drv.inc
proc nic_drv { } {
if {[nic_drv_binary] == "usb_drv"} { return usb_drv }
if {[nic_drv_binary] == ""} { return "" }
return nic_drv
}
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 }
if {[have_spec gpio]} { return gpio_drv }
}
if {[nic_drv] == ""} {
puts "\n Run script is not supported on this platform. \n"; exit 0 }
proc nic_drv_build { } {
if {[nic_drv] == "nic_drv"} { return drivers/nic }
if {[nic_drv] == "usb_drv"} { return drivers/usb }
}
proc gpio_drv_build { } { if {[gpio_drv] != ""} { return drivers/gpio } }
build "core init drivers/timer server/nic_router server/nic_bridge
test/lwip/http_srv_static test/lwip/http_clnt test/lxip/udp_echo
test/lxip/udp_client server/nic_dump [nic_drv_build] [gpio_drv_build]
[platform_drv_build_components]"
create_boot_directory
#
# Generate config
#
proc gpio_drv_config { } {
if {[have_spec gpio]} {
append result {
}
return $result
}
}
proc nic_drv_config { } {
if {[nic_drv] == "nic_drv"} {
append result {
}
return $result
}
if {[nic_drv] == "usb_drv"} {
append result {
}
return $result
}
}
proc client_bin { prot } {
if {$prot == "udp"} { return "test-lxip_udp_client" }
if {$prot == "http"} { return "test-http_clnt" } }
proc server_bin { prot } {
if {$prot == "udp"} { return "test-lxip_udp_echo" }
if {$prot == "http"} { return "test-lwip_httpsrv_static" } }
proc ram_quota { prot } {
if {$prot == "udp"} { return 29M }
if {$prot == "http"} { return 12M }
}
proc client_config { prot index ip_addr gateway netmask nic srv_port srv_ip } {
append result {
}
return $result
}
proc server_config { prot index ip_addr gateway netmask nic port } {
append result {
}
return $result
}
proc test_1_config { } {
if {[enable_test_1]} { return "
[client_config udp 2 10.0.2.212 10.0.2.1 255.255.255.0 nic_bridge 1 10.0.2.55]
[server_config udp 2 18.17.16.15 18.17.16.14 255.255.0.0 nic_router 1 ]" }
}
proc test_2_config { } {
if {[enable_test_2]} { return "
[client_config http 1 10.0.2.201 10.0.2.1 255.255.255.0 nic_bridge 80 10.0.2.55]
[server_config http 1 192.168.1.18 192.168.1.1 255.255.255.0 nic_router 80 ]" }
}
append config {
} [gpio_drv_config] {
} [nic_drv_config] {
} [platform_drv_config] {
} [test_1_config] {
} [test_2_config] {
}
install_config $config
#
# Create single image and execute
#
build_boot_image "
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
posix.lib.so lwip.lib.so lxip.lib.so test-http_clnt
test-lwip_httpsrv_static nic_dump test-lxip_udp_echo test-lxip_udp_client
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
proc nic_qemu_args { } {
if {[have_spec x86]} { return "-net nic,model=e1000" }
if {[have_spec lan9118]} { return "-net nic,model=lan9118" } }
append qemu_args "-nographic -net user [nic_qemu_args]"
run_genode_until {.*Test done.*\n.*Test done.*\n} 60