diff --git a/repos/gems/run/depot_download.run b/repos/gems/run/depot_download.run index 03eb5ff551..4a8735ef58 100644 --- a/repos/gems/run/depot_download.run +++ b/repos/gems/run/depot_download.run @@ -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 diff --git a/repos/gems/run/sculpt_test.run b/repos/gems/run/sculpt_test.run index bf68cb87e9..7e58e2e4d3 100644 --- a/repos/gems/run/sculpt_test.run +++ b/repos/gems/run/sculpt_test.run @@ -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" diff --git a/repos/gems/run/ssh_exec_channel.run b/repos/gems/run/ssh_exec_channel.run index a116c8225c..9ee2bd66ae 100644 --- a/repos/gems/run/ssh_exec_channel.run +++ b/repos/gems/run/ssh_exec_channel.run @@ -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" diff --git a/repos/gems/run/ssh_terminal.run b/repos/gems/run/ssh_terminal.run index abde05b916..d110ea4778 100644 --- a/repos/gems/run/ssh_terminal.run +++ b/repos/gems/run/ssh_terminal.run @@ -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" diff --git a/repos/gems/run/tcp_terminal.run b/repos/gems/run/tcp_terminal.run index 825d915457..651f02e7d6 100644 --- a/repos/gems/run/tcp_terminal.run +++ b/repos/gems/run/tcp_terminal.run @@ -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 diff --git a/repos/libports/run/fetchurl.inc b/repos/libports/run/fetchurl.inc index a6d35ae67a..dc45469bc4 100644 --- a/repos/libports/run/fetchurl.inc +++ b/repos/libports/run/fetchurl.inc @@ -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" diff --git a/repos/libports/run/libc_getaddrinfo.run b/repos/libports/run/libc_getaddrinfo.run index da0dc5df32..a3c526ad86 100644 --- a/repos/libports/run/libc_getaddrinfo.run +++ b/repos/libports/run/libc_getaddrinfo.run @@ -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 diff --git a/repos/libports/run/lwip.run b/repos/libports/run/lwip.run index eb8559f251..e92e313011 100644 --- a/repos/libports/run/lwip.run +++ b/repos/libports/run/lwip.run @@ -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 diff --git a/repos/libports/run/netty.inc b/repos/libports/run/netty.inc index fc94608f40..982c2f8bfc 100644 --- a/repos/libports/run/netty.inc +++ b/repos/libports/run/netty.inc @@ -101,14 +101,17 @@ append 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 " -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 : diff --git a/repos/libports/run/netty_lwip.inc b/repos/libports/run/netty_lwip.inc index f31a371a8f..b198c6048c 100644 --- a/repos/libports/run/netty_lwip.inc +++ b/repos/libports/run/netty_lwip.inc @@ -61,14 +61,16 @@ append 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 " -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 : diff --git a/repos/libports/run/nic_bridge.run b/repos/libports/run/nic_bridge.run index 7bda629683..a45acbc884 100644 --- a/repos/libports/run/nic_bridge.run +++ b/repos/libports/run/nic_bridge.run @@ -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.} diff --git a/repos/libports/run/sntp_client.run b/repos/libports/run/sntp_client.run index d381ba06a4..c369586c94 100644 --- a/repos/libports/run/sntp_client.run +++ b/repos/libports/run/sntp_client.run @@ -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] seoul\] VMM: # Hello Genode world!} 300 diff --git a/repos/ports/run/seoul-fancy.run b/repos/ports/run/seoul-fancy.run index 42f4b63e73..f1a2b4f5fa 100644 --- a/repos/ports/run/seoul-fancy.run +++ b/repos/ports/run/seoul-fancy.run @@ -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 diff --git a/repos/ports/run/seoul-net.run b/repos/ports/run/seoul-net.run index 4973ce55a0..bfe4c32a54 100644 --- a/repos/ports/run/seoul-net.run +++ b/repos/ports/run/seoul-net.run @@ -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 diff --git a/tool/run/log/qemu b/tool/run/log/qemu index 82782e799c..6c40a5b21c 100644 --- a/tool/run/log/qemu +++ b/tool/run/log/qemu @@ -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 } { diff --git a/tool/run/power_on/qemu b/tool/run/power_on/qemu index 9ba65ba9f3..54c2897faa 100644 --- a/tool/run/power_on/qemu +++ b/tool/run/power_on/qemu @@ -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] diff --git a/tool/run/qemu.inc b/tool/run/qemu.inc index 683b88ac08..7e20b37b0e 100644 --- a/tool/run/qemu.inc +++ b/tool/run/qemu.inc @@ -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 diff --git a/tool/run/run b/tool/run/run index 7e73096d73..d1b6149646 100755 --- a/tool/run/run +++ b/tool/run/run @@ -1026,6 +1026,7 @@ proc build_initrd { modules } { } source [genode_dir]/tool/run/depot.inc +source [genode_dir]/tool/run/qemu.inc ##