From 54d7a48c9bf19437efcd4363df1ac29ecfaadf48 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 5 Apr 2023 14:10:26 +0200 Subject: [PATCH] sculpt: support for pinephone wifi driver This patch replaces the former 'nic_drv' and 'nic_drv_dtb' functions by a more general 'nic_driver_routes' function that can return one or multiple platform-specific ROM routes for NIC-driver binaries and dtb files. This allows for supplying customizations for the wifi driver as well. E.g., on the PinePhone, this hook can be used to handle the renaming of the 'wifi_drv' to 'a64_wifi_drv'. Related to issue #4813 and issue genodelabs/genode-allwinner#17. --- repos/gems/run/sculpt.run | 37 ++++++++++++------- .../app/sculpt_manager/runtime/wifi_drv.cc | 10 ++--- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index 1125764329..74ef12d63b 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -150,22 +150,35 @@ proc log_route { } { } -proc nic_drv { } { +## +# ROM routes that relabel generic NIC driver names to platform-specific binaries +# +proc nic_driver_routes { } { - if {[have_board pc]} { return ipxe_nic_drv } - if {[have_board imx8q_evk]} { return fec_nic_drv } - if {[have_board mnt_reform2]} { return fec_nic_drv } + set result(pc) { + + + } - return nic_unavailable -} + set result(mnt_reform2) { + + + } + set result(imx8q_evk) { + + + } -proc nic_drv_dtb { } { + set result(pinephone) { + + + } - if {[have_board imx8q_evk]} { return fec_nic_drv-imx8q_evk.dtb } - if {[have_board mnt_reform2]} { return fec_nic_drv-mnt_reform2.dtb } + if {[info exists result([board])]} { + return $result([board]); } - return nic_unavailable + return ""; } @@ -627,9 +640,7 @@ install_config { - } [log_route] { - - + } [log_route] [nic_driver_routes] { diff --git a/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc b/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc index e4a6b6b62a..b8059320de 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/wifi_drv.cc @@ -19,12 +19,10 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml) Cap_quota{250}, Ram_quota{32*1024*1024}, Priority::NETWORK); - xml.node("binary", [&] () { - xml.attribute("name", "pc_wifi_drv"); - }); - xml.node("config", [&] () { + xml.attribute("dtb", "wifi_drv.dtb"); + xml.node("vfs", [&] () { gen_named_node(xml, "dir", "dev", [&] () { xml.node("null", [&] () {}); @@ -60,7 +58,8 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml) xml.node("parent", [&] () { xml.attribute("label", "wifi"); }); }); - gen_parent_rom_route(xml, "pc_wifi_drv"); + gen_parent_rom_route(xml, "wifi_drv"); + gen_parent_rom_route(xml, "wifi_drv.dtb"); gen_parent_rom_route(xml, "ld.lib.so"); gen_parent_rom_route(xml, "libcrypto.lib.so"); gen_parent_rom_route(xml, "vfs.lib.so"); @@ -70,6 +69,7 @@ void Sculpt::gen_wifi_drv_start_content(Xml_generator &xml) gen_parent_rom_route(xml, "vfs_wifi.lib.so"); gen_parent_rom_route(xml, "libssl.lib.so"); gen_parent_rom_route(xml, "wifi.lib.so"); + gen_parent_rom_route(xml, "a64_wifi.lib.so"); gen_parent_rom_route(xml, "wpa_driver_nl80211.lib.so"); gen_parent_rom_route(xml, "wpa_supplicant.lib.so"); gen_parent_rom_route(xml, "iwlwifi-1000-5.ucode");