Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 4 device tree overlay not applied / generic-extlinux-compatible.enable not working? #760

Closed
SFrijters opened this issue Oct 14, 2023 · 2 comments

Comments

@SFrijters
Copy link
Member

SFrijters commented Oct 14, 2023

Due to NixOS/nixpkgs#241534 I've been trying to migrate my config to something more future compatible.

In particular I've tried to move from

dtparam=eth_led0=4
dtparam=eth_led1=4

in /boot/config.txt via boot.loader.raspberryPi.firmwareConfig to an overlay

+      {
+        name = "disable-eth-leds";
+        filter = "*rpi-4-b*";
+        dtsText = ''
+          /dts-v1/;
+          /plugin/;
+          /{
+             compatible = "raspberrypi,4-model-b";
+             fragment@0 {
+                  target = <&phy1>;
+                  __overlay__ {
+                      led-modes = <0x04 0x04>;
+                  };
+              };
+          };
+        '';
+      }

in hardware.deviceTree.overlays.

When I decompile the bcm2711-rpi-4-b.dtb file in /boot/nixos/...-device-tree-overlays with and without the overlay I can see the diff

--- with-overlay.txt    2023-10-14 12:32:37.517621679 +0200
+++ without-overlay.txt 2023-10-14 12:33:21.904783804 +0200
@@ -2150,7 +2150,7 @@

                                ethernet-phy@1 {
                                        reg = <0x01>;
-                                       led-modes = <0x04 0x04>;
+                                       led-modes = <0x00 0x08>;
                                        phandle = <0x2f>;
                                };

However, after rebooting the LEDs stay on and I can inspect

$ hexdump /proc/device-tree/scb/ethernet@7d580000/mdio@e14/ethernet-phy@1/led-modes 
0000000 0000 0000 0000 0800                    
0000008

Any idea why this isn't correct? https://forums.raspberrypi.com/viewtopic.php?t=357717 suggests my overlay is correct, so I now suspect it's a problem with how I'm doing things in a NixOS context.

I'm using the nixos-hardware module and hardware.raspberry-pi."4".apply-overlays-dtmerge.enable = true;.

@SFrijters
Copy link
Member Author

Ah, it looks like the migration to generic-extlinux-compatible.enable = true; is more involved maybe?
When I use nixos rebuild-switch new entries are added to /boot/extlinux, but the /run/current-system link is still pointing to the system configuration I started out with this morning.

What is the correct way to migrate this?

@SFrijters SFrijters changed the title Raspberry Pi 4 device tree overlay not applied on live system Raspberry Pi 4 device tree overlay not applied / generic-extlinux-compatible.enable not working? Oct 14, 2023
@SFrijters
Copy link
Member Author

Solved via discussion in NixOS/nixpkgs#241534 and related PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant