From aed38dd5a7c230bc09e9d883d5c2e7de9ae61642 Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Wed, 27 Mar 2024 14:40:17 -0700 Subject: [PATCH] Add firmware needed for R816{8,9} network devices The orin-nano and orin-nx SOMs have realtek NICs that take advantage of firmware that lives in the `linux-firmware` derivation. Instead of pulling in all of linux-firmware (1GiB+), just pull in what is needed for the `r8168` kernel module. Note that in Jetpack 35.3.1 the kernel module was called `r8169` and in Jetpack 35.4.1 the kernel module was changed to be `r8168`. This differs from mainline linux where the kernel module is `r8169`. --- modules/devices.nix | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/modules/devices.nix b/modules/devices.nix index 5c73053..56eab0e 100644 --- a/modules/devices.nix +++ b/modules/devices.nix @@ -147,4 +147,39 @@ lib.mkMerge [{ else "-F 32 -n ESP"; }; + }) + (lib.mkIf (lib.any (som: som == cfg.som) [ "orin-nx" "orin-nano" ]) { + hardware.firmware = [ + (pkgs.linkFarm "r8169-firmware" + (map + (firmwarePath: { + name = "lib/firmware/${firmwarePath}"; + path = "${pkgs.linux-firmware}/lib/firmware/${firmwarePath}"; + }) [ + # From https://github.com/OE4T/linux-tegra-5.10/blob/20443c6df8b9095e4676b4bf696987279fac30a9/drivers/net/ethernet/realtek/r8169_main.c#L38 + # We include all the firmware referenced by the r8168 module so that + # `makeModulesClosure` doesn't spit out warnings. + "rtl_nic/rtl8168d-1.fw" + "rtl_nic/rtl8168d-2.fw" + "rtl_nic/rtl8168e-1.fw" + "rtl_nic/rtl8168e-2.fw" + "rtl_nic/rtl8168e-3.fw" + "rtl_nic/rtl8168f-1.fw" + "rtl_nic/rtl8168f-2.fw" + "rtl_nic/rtl8105e-1.fw" + "rtl_nic/rtl8402-1.fw" + "rtl_nic/rtl8411-1.fw" + "rtl_nic/rtl8411-2.fw" + "rtl_nic/rtl8106e-1.fw" + "rtl_nic/rtl8106e-2.fw" + "rtl_nic/rtl8168g-2.fw" + "rtl_nic/rtl8168g-3.fw" + "rtl_nic/rtl8168h-2.fw" # wanted by orin-nano and orin-nx + "rtl_nic/rtl8168fp-3.fw" + "rtl_nic/rtl8107e-2.fw" + "rtl_nic/rtl8125a-3.fw" + "rtl_nic/rtl8125b-2.fw" + "rtl_nic/rtl8126a-2.fw" + ])) + ]; })]