mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-02 09:18:18 +00:00
tool: Consolidate qemu nic setup.
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
This commit is contained in:
parent
aa2511e209
commit
fe0ad0addb
@ -135,16 +135,7 @@ append boot_modules { depot_download_manager depot_query }
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -nographic "
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
|
||||
# watch the state reports generated by the depot-download manager
|
||||
|
@ -3,7 +3,8 @@ set use_nvme 0
|
||||
source ${genode_dir}/repos/gems/run/sculpt.run
|
||||
|
||||
# enable Qemu networking, usable via the nic_drv
|
||||
append qemu_args " -m 768 -net nic,model=e1000 -net user "
|
||||
append_qemu_nic_args
|
||||
append qemu_args " -m 768 "
|
||||
|
||||
# attach small SATA disk to Qemu to experiment with file-system access
|
||||
set disk_image "bin/sculpt-ahci.raw"
|
||||
|
@ -225,16 +225,8 @@ build_boot_image $boot_modules
|
||||
# Execute test
|
||||
#
|
||||
|
||||
append qemu_args " -m 512 -nographic "
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:22 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append qemu_args " -m 512 -nographic "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:22"
|
||||
|
||||
set lxip_match_string "ipaddr=(\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+).*\n"
|
||||
|
||||
|
@ -190,16 +190,8 @@ build_boot_image $boot_modules
|
||||
# Execute test
|
||||
#
|
||||
|
||||
append qemu_args " -m 512 -nographic "
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:22 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append qemu_args " -m 512 -nographic "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:22"
|
||||
|
||||
set lxip_match_string "ipaddr=(\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+).*\n"
|
||||
|
||||
|
@ -77,16 +77,8 @@ build_boot_image { tcp_terminal test-terminal_echo }
|
||||
|
||||
# qemu config
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:8888 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:8888"
|
||||
|
||||
run_genode_until forever
|
||||
|
||||
|
@ -118,16 +118,8 @@ install_config {
|
||||
#build { }
|
||||
build_boot_image { }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
## Uncomment to dump network traffic to file
|
||||
# append qemu_args " -object filter-dump,id=net0,netdev=net0,file=[run_dir].pcap"
|
||||
|
@ -68,13 +68,7 @@ install_config {
|
||||
|
||||
build_boot_image { test-libc_getaddrinfo }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -net nic,model=[qemu_nic_model] -net user"
|
||||
append qemu_args " -nographic "
|
||||
append_qemu_nic_args
|
||||
|
||||
run_genode_until "child .* exited with exit value 0.*\n" 20
|
||||
|
@ -90,15 +90,8 @@ build_boot_image { test-lwip_httpsrv }
|
||||
#
|
||||
# Qemu config
|
||||
#
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:80 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:80"
|
||||
|
||||
run_genode_until {.*lwIP Nic interface up.*\n} 30
|
||||
|
||||
|
@ -101,14 +101,17 @@ append config {
|
||||
</start>
|
||||
}
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model] "
|
||||
append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
|
||||
append_qemu_nic_args
|
||||
|
||||
# When using with a tap device manually replace append_qemu_nic_args with:
|
||||
#proc qemu_nic_model {} {
|
||||
# if [have_spec x86] { return e1000 }
|
||||
# if [have_spec lan9118] { return lan9118 }
|
||||
# if [have_spec zynq] { return cadence_gem }
|
||||
# return nic_model_missing
|
||||
#}
|
||||
#append qemu_args " -net nic,model=[qemu_nic_model] "
|
||||
#append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
|
||||
|
||||
# vi: set ft=tcl :
|
||||
|
@ -61,14 +61,16 @@ append config {
|
||||
</start>
|
||||
}
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model] "
|
||||
append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
|
||||
append_qemu_nic_args
|
||||
|
||||
#proc qemu_nic_model {} {
|
||||
# if [have_spec x86] { return e1000 }
|
||||
# if [have_spec lan9118] { return lan9118 }
|
||||
# if [have_spec zynq] { return cadence_gem }
|
||||
# return nic_model_missing
|
||||
#}
|
||||
#append qemu_args " -net nic,model=[qemu_nic_model] "
|
||||
#append qemu_args " -net tap,ifname=tap0,downscript=no,script=no "
|
||||
|
||||
# vi: set ft=tcl :
|
||||
|
@ -158,16 +158,8 @@ build_boot_image {
|
||||
test-lwip_httpsrv
|
||||
}
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
append done_string {.*?\[init -> client_3] .\[31mError: Nic-session creation failed}
|
||||
append done_string {.*?\[client_1 -> lwip] rcv .\[32mETH.\[0m 02:02:02:02:42:0.}
|
||||
|
@ -68,15 +68,8 @@ append config {
|
||||
install_config $config
|
||||
build_boot_image { core ld.lib.so init timer sntp_client report_rom }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
set done_string "report_rom] <set_rtc year.*?report_rom] <set_rtc year.*?\n"
|
||||
|
||||
|
@ -237,16 +237,8 @@ append config {
|
||||
install_config $config
|
||||
build_boot_image { ping nic_dump }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
set done_string ""
|
||||
for {set i 0} {$i < 3} {incr i 1} {
|
||||
|
@ -200,15 +200,7 @@ install_config {
|
||||
|
||||
build_boot_image { test-net_flood ping nic_router dynamic_rom }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
run_genode_until {.*ping\] 64 bytes from 10\.0\.2\.2: icmp_seq=30 .*\n} [test_timeout]
|
||||
|
@ -104,16 +104,8 @@ append config {
|
||||
install_config $config
|
||||
build_boot_image { ping }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
set done_string ".*\"ping_1\" exited with exit value 0.*\n"
|
||||
|
||||
|
@ -220,16 +220,8 @@ append config {
|
||||
install_config $config
|
||||
build_boot_image { ping }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -nographic "
|
||||
append qemu_args " -netdev user,id=net0 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append_qemu_nic_args
|
||||
|
||||
set done_string ""
|
||||
for {set i 0} {$i < 3} {incr i 1} {
|
||||
|
@ -120,15 +120,7 @@ exec tar cfv bin/genode_org.tar -h -C bin/genode_org .
|
||||
|
||||
build_boot_image { genode_org.tar }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:80 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append qemu_args " -nographic "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:80"
|
||||
|
||||
run_genode_until forever
|
||||
|
@ -179,16 +179,8 @@ EpA5DBBklj8UE2CdONvN
|
||||
#build { }
|
||||
build_boot_image { }
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::5555-:80,hostfwd=tcp::5556-:443 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append qemu_args " -nographic "
|
||||
append_qemu_nic_args "hostfwd=tcp::5555-:80,hostfwd=tcp::5556-:443"
|
||||
append xen_args { sdl=0\; vif=\["model=e1000,mac=02:00:00:00:01:01,bridge=xenbr0"\] }
|
||||
|
||||
run_genode_until forever
|
||||
|
@ -316,16 +316,8 @@ build_boot_image { netserver }
|
||||
#
|
||||
|
||||
# qemu config
|
||||
append qemu_args " -nographic "
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec x86] { return e1000 }
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
append qemu_args " -netdev user,id=net0,hostfwd=tcp::12865-:12865,hostfwd=tcp::49153-:49153 "
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
append qemu_args " -nographic "
|
||||
append_qemu_nic_args "hostfwd=tcp::12865-:12865,hostfwd=tcp::49153-:49153"
|
||||
|
||||
set ip_match_string ""
|
||||
set force_ports ""
|
||||
|
@ -75,8 +75,8 @@ foreach binary $guest_os_binaries {
|
||||
source ${genode_dir}/repos/ports/run/seoul.inc
|
||||
|
||||
append qemu_args " -cpu phenom -smp 2 "
|
||||
append qemu_args " -net nic,model=e1000 "
|
||||
append qemu_args " -nographic "
|
||||
append_qemu_nic_args
|
||||
|
||||
if { [get_cmd_switch --autopilot] } {
|
||||
run_genode_until {\[init -\> seoul\] VMM: # Hello Genode world!} 300
|
||||
|
@ -62,6 +62,6 @@ source ${genode_dir}/repos/ports/run/seoul.inc
|
||||
|
||||
append qemu_args " -m 1024 "
|
||||
append qemu_args " -cpu phenom "
|
||||
append qemu_args " -net nic,model=e1000 "
|
||||
append_qemu_nic_args
|
||||
|
||||
run_genode_until forever
|
||||
|
@ -57,6 +57,6 @@ foreach binary $guest_os_binaries {
|
||||
source ${genode_dir}/repos/ports/run/seoul.inc
|
||||
|
||||
append qemu_args " -cpu phenom "
|
||||
append qemu_args " -net nic,model=e1000 "
|
||||
append_qemu_nic_args
|
||||
|
||||
run_genode_until forever
|
||||
|
@ -3,7 +3,6 @@
|
||||
#
|
||||
|
||||
source [genode_dir]/tool/run/log.inc
|
||||
source [genode_dir]/tool/run/qemu.inc
|
||||
|
||||
|
||||
proc run_log { wait_for_re timeout_value } {
|
||||
|
@ -4,8 +4,6 @@
|
||||
# Reset the target machine or rather run the scenario with Qemu
|
||||
#
|
||||
|
||||
source [genode_dir]/tool/run/qemu.inc
|
||||
|
||||
proc check_version {qemu_version qemu_min qemu_max} {
|
||||
set version_min_list [split $qemu_min ".-"]
|
||||
set version_min_list_len [llength $version_min_list]
|
||||
|
@ -14,6 +14,24 @@ proc qemu_args { } {
|
||||
return $qemu_args
|
||||
}
|
||||
|
||||
proc qemu_nic_model {} {
|
||||
if [have_spec lan9118] { return lan9118 }
|
||||
if [have_spec zynq] { return cadence_gem }
|
||||
if [have_spec x86] { return e1000 }
|
||||
return nic_model_missing
|
||||
}
|
||||
|
||||
proc append_qemu_nic_args { { extra_netdev_args "" } } {
|
||||
global qemu_args
|
||||
append qemu_args " -netdev user,id=net0"
|
||||
|
||||
if { $extra_netdev_args ne "" } {
|
||||
append qemu_args ",$extra_netdev_args"
|
||||
}
|
||||
|
||||
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Check whether Qemu support is available
|
||||
|
@ -1026,6 +1026,7 @@ proc build_initrd { modules } {
|
||||
}
|
||||
|
||||
source [genode_dir]/tool/run/depot.inc
|
||||
source [genode_dir]/tool/run/qemu.inc
|
||||
|
||||
|
||||
##
|
||||
|
Loading…
x
Reference in New Issue
Block a user