mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
fe0ad0addb
Right now the same code dealing with nic setup on qemu is duplicated in many different run scripts. It makes it unnecesarily complex to change the existing config or add support for new nic types. Lets move all this common code to qemu.inc. Ref #3825
115 lines
2.9 KiB
Plaintext
115 lines
2.9 KiB
Plaintext
if {[have_spec foc] || [have_spec linux] ||
|
|
[have_spec rpi3] ||
|
|
[expr [have_spec imx53] && [have_spec trustzone]]} {
|
|
puts "Run script is not supported on this platform."
|
|
exit 0
|
|
}
|
|
|
|
set on_hardware [expr ![have_include power_on/qemu]]
|
|
|
|
create_boot_directory
|
|
|
|
import_from_depot [depot_user]/src/[base_src] \
|
|
[depot_user]/pkg/[drivers_nic_pkg] \
|
|
[depot_user]/src/init \
|
|
[depot_user]/src/nic_bridge
|
|
|
|
build { app/ping }
|
|
|
|
proc dst_ip { } {
|
|
if {![have_include power_on/qemu]} {
|
|
return "10.0.0.2"
|
|
} else {
|
|
return "10.0.2.2"
|
|
}
|
|
}
|
|
|
|
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="100"/>
|
|
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
</start>
|
|
|
|
<start name="drivers" caps="1000" managing_system="yes">
|
|
<resource name="RAM" quantum="32M"/>
|
|
<binary name="init"/>
|
|
<route>
|
|
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
<provides> <service name="Nic"/> </provides>
|
|
</start>
|
|
|
|
<start name="nic_bridge" caps="200">
|
|
<resource name="RAM" quantum="10M"/>
|
|
<provides><service name="Nic"/></provides>
|
|
<config mac="02:02:02:02:03:00">
|
|
<policy label_prefix="ping_1"/>
|
|
<policy label_prefix="ping_2"/>
|
|
</config>
|
|
<route>
|
|
<service name="Nic"> <child name="drivers"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append_if $on_hardware config {
|
|
<start name="ping_2">
|
|
<binary name="ping"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config period_sec="1"
|
|
verbose="no"
|
|
count="1"
|
|
protocol="udp"
|
|
dst_ip="} [dst_ip] {"
|
|
dst_port="12345"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>}
|
|
|
|
append config {
|
|
<start name="ping_1">
|
|
<binary name="ping"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [dst_ip] {"
|
|
period_sec="1"
|
|
verbose="no"
|
|
count="3"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
</config>}
|
|
|
|
install_config $config
|
|
build_boot_image { ping }
|
|
|
|
append qemu_args " -nographic "
|
|
append_qemu_nic_args
|
|
|
|
set done_string ".*\"ping_1\" exited with exit value 0.*\n"
|
|
|
|
append_if $on_hardware done_string ".*ping_2\] From [dst_ip] Destination Unreachable.*\n"
|
|
|
|
run_genode_until $done_string 30
|