genode/repos/dde_linux/run/nic_router_uplinks.run
Josef Söntgen ea0a692879 wifi: get firmware from tar archive
This commit changes the firmware handling from requesting each
firmware file as a ROM module that is checked against a list of
known images (including their size) to requesting each file via
the local VFS of the 'wifi_drv'. This allows for using the original
probing mechanism that tries to select a matching firmware version.

The 'repos/dde_linux/src/drivers/wifi/README' file contains more
detailed information on how to configure the driver.

Issue #4861.
2023-05-30 12:03:33 +02:00

438 lines
14 KiB
Plaintext

if {[expr ![have_spec nova] && ![have_spec sel4] && ![have_spec hw] && ![have_spec foc] || ![have_spec x86] || [have_include power_on/qemu]]} {
puts "\n Run script is not supported on this platform. \n"; exit 0 }
proc wifi_ssid {} {
return "$::env(GENODE_WIFI_SSID2)" }
proc wifi_psk {} {
return "$::env(GENODE_WIFI_PSK2)" }
proc router_verbose {} {
return "no" }
proc router_verbose_packet_drop {} {
return "no" }
proc router_verbose_packets {} {
return "no" }
proc router_verbose_domain_state {} {
return "yes" }
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/pc_wifi \
[depot_user]/src/acpi_drv \
[depot_user]/src/dynamic_rom \
[depot_user]/src/init \
[depot_user]/src/ipxe_nic_drv \
[depot_user]/src/nic_router \
[depot_user]/src/pci_decode \
[depot_user]/src/platform_drv \
[depot_user]/src/report_rom \
[depot_user]/src/rtc_drv
build { app/ping }
install_config {
<config prio_levels="4">
<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="report_rom" caps="70">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="ROM" />
<service name="Report" />
</provides>
<config>
<policy label="pci_decode -> system" report="acpi_drv -> acpi"/>
<policy label="platform_drv -> devices" report="pci_decode -> devices"/>
</config>
</start>
<start name="acpi_drv" caps="250">
<resource name="RAM" quantum="4M"/>
</start>
<start name="pci_decode" caps="350">
<resource name="RAM" quantum="2M"/>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="system"> <child name="report_rom"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="platform_drv" caps="100" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="devices"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
<config>
<policy label_prefix="wifi_drv" info="yes"> <pci class="WIFI"/> </policy>
<policy label_prefix="nic_drv"> <pci class="ETHERNET"/> </policy>
</config>
</start>
<start name="timer" priority="0">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="rtc_drv" priority="-1">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Rtc"/>
</provides>
</start>
<start name="nic_drv" priority="-1" caps="120">
<binary name="ipxe_nic_drv"/>
<resource name="RAM" quantum="8M"/>
<route>
<service name="Uplink"> <child name="router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="wifi_drv" caps="300" priority="-1">
<resource name="RAM" quantum="32M"/>
<config ld_verbose="no">
<vfs>
<dir name="dev"> <log/> <rtc/> <null/> <wifi/>
<jitterentropy name="random"/>
<jitterentropy name="urandom"/>
</dir>
<dir name="config"> <ram/> </dir>
<dir name="firmware">
<tar name="wifi_firmware.tar"/>
</dir>
</vfs>
<libc stdout="/dev/null" stderr="/dev/null" rtc="/dev/rtc"/>
</config>
<route>
<service name="Uplink"> <child name="router"/> </service>
<service name="Rtc"> <any-child/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="wifi_config"> <child name="config_rom"/> </service>
<service name="ROM" label="wifi.lib.so"> <parent label="pc_wifi.lib.so"/> </service>
<service name="ROM" label="wifi_firmware.tar"> <parent label="pc_wifi_firmware.tar"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="config_rom" priority="-2">
<binary name="dynamic_rom"/>
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/></provides>
<config verbose="no">
<rom name="wifi_config">
<inline description="CONNECT">
<wifi_config connected_scan_interval="0" scan_interval="5" rfkill="no" verbose="no" verbose_state="no">
<network ssid="} [wifi_ssid] {" protection="WPA2" passphrase="} [wifi_psk] {"/>
</wifi_config>
</inline>
<sleep milliseconds="600000"/> <!-- 10 minutes -->
</rom>
</config>
</start>
<start name="dynamic_rom" priority="-1">
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/> </provides>
<config verbose="yes">
<rom name="router.config">
<!-- give the drivers time to come up -->
<inline> <config/> </inline>
<sleep milliseconds="15000"/>
<!-- start the actual test -->
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="nic_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3001"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="wifi_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3002"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="yes"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3003"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="nic_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3004"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="nic_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3005"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="yes"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3006"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="wifi_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3007"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<policy label_prefix="nic_drv" domain="uplink" />
<domain name="uplink">
<nat domain="downlink" icmp-ids="999"/>
</domain>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
<icmp dst="0.0.0.0/0" domain="uplink" />
</domain>
</config>
</inline>
<sleep milliseconds="3008"/>
<inline>
<config dhcp_discover_timeout_sec="1"
verbose="} [router_verbose] {"
verbose_packet_drop="} [router_verbose_packet_drop] {"
verbose_domain_state="} [router_verbose_domain_state] {"
verbose_packets="} [router_verbose_packets] {">
<policy label_prefix="ping" domain="downlink"/>
<domain name="downlink" interface="10.0.1.79/24">
<dhcp-server ip_first="10.0.1.80" ip_last="10.0.1.100"/>
</domain>
</config>
</inline>
<sleep milliseconds="600000"/>
</rom>
</config>
</start>
<start name="router" caps="200" priority="-2">
<binary name="nic_router"/>
<resource name="RAM" quantum="10M"/>
<provides>
<service name="Nic"/>
<service name="Uplink"/>
</provides>
<route>
<service name="ROM" label="config">
<child name="dynamic_rom" label="router.config"/>
</service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ping" priority="-2">
<resource name="RAM" quantum="8M"/>
<config dst_ip="1.1.1.1"
period_sec="1"
count="999"/>
<route>
<service name="Nic"> <child name="router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
build_boot_image { ping }
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3001 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3002 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3003 milliseconds"
append done_string ".*downlink.*invalid domain.*invalid ICMP rule"
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3004 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3005 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3006 milliseconds"
append done_string ".*downlink.*invalid domain.*invalid ICMP rule"
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3007 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 3008 milliseconds"
append done_string ".*64 bytes from 1.1.1.1: icmp_seq="
append done_string ".*router.config: change"
append done_string ".*router.config: sleep 600000 milliseconds"
append done_string ".*From 10.0.1.79 icmp_seq=.* Destination Unreachable"
run_genode_until $done_string 70