genode/repos/dde_linux/run/usb_net.run
2021-02-23 11:53:41 +01:00

157 lines
3.6 KiB
Tcl

#
# \brief Test for using the lwIP TCP/IP stack over USB
# \author Sebastian Sumpf
# \date 2012-07-06
#
# This test case executes a small HTTP server, it has been used on PandaBoard
# hardware only, though it should execute but not do anything on other hardware
#
#
# Build
#
set build_components {
core init timer
drivers/usb_host
drivers/usb_net
test/lwip/http_srv
lib/vfs/lwip
server/nic_router
}
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="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>
<default caps="200"/>}
append_platform_drv_config
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="usb_drv" caps="120"> }
append config "<binary name=\"[usb_host_drv_binary]\"/>"
append config {
<resource name="RAM" quantum="12M"/>
<provides> <service name="Usb"/> </provides>
<config bios_handoff="yes">}
append_if [have_board arndale] config {
<policy label_prefix="usb_net_drv" vendor_id="0x0b95" product_id="0x772a"/> }
append_if [have_board rpi] config {
<policy label_prefix="usb_net_drv" vendor_id="0x0424" product_id="0xec00"/> }
append_if [have_spec x86] config {
<policy label_prefix="usb_net_drv" vendor_id="0x0b95" product_id="0x1790"/> }
append config {
</config>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="usb_net_drv">
<resource name="RAM" quantum="20M"/>
<config mode="uplink_client" mac="02:00:00:00:01:01" />
<route>
<service name="Uplink"><child name="nic_router"/></service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="nic_router" caps="200">
<resource name="RAM" quantum="10M"/>
<provides>
<service name="Nic"/>
<service name="Uplink"/>
</provides>
<config verbose_domain_state="yes">
<policy label_prefix="test-lwip_httpsrv" domain="downlink"/>
<policy label_prefix="usb_net_drv" domain="uplink"/>
<domain name="uplink">
<nat domain="downlink" tcp-ports="16384"/>
<tcp-forward port="443" domain="downlink" to="10.0.3.2"/>
<tcp-forward port="80" domain="downlink" to="10.0.3.2"/>
</domain>
<domain name="downlink" interface="10.0.3.1/24">
<dhcp-server ip_first="10.0.3.2" ip_last="10.0.3.2"/>
</domain>
</config>
</start>
<start name="test-lwip_httpsrv" caps="120">
<resource name="RAM" quantum="4M"/>
<config>
<vfs>
<dir name="dev"> <log/> </dir>
<dir name="socket"> <lwip dhcp="yes"/> </dir>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log" socket="/socket"/>
</config>
<route>
<service name="Nic"><child name="nic_router"/></service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core init timer usb_net_drv
ld.lib.so libc.lib.so vfs.lib.so vfs_lwip.lib.so test-lwip_httpsrv
nic_router
}
append boot_modules [usb_host_drv_binary]
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -nographic"
run_genode_until forever
# vi: set ft=tcl :