Hello,
TLDR at bottom
I am trying to install the needed software to get a ReSpeaker 2-Mics Pi HAT working on my Raspberry Pi 4 (rpi). Upon finding the setting hardware.deviceTree.overlays I figured this would be simple apply but I have been working on this issue for three days with no luck.
I initially tried to install seeed-2mic-voicecard-overlay.dts with no changes but I immediately found that my overlay was not being applied. I believe this is due to the compatibility filter applied hardware.deviceTree.filter = “bcm2711-rpi-*.dtb”; in the rpi default.nix
this is consistent with another similar issue detailed on this forum.
Changing the compatibility:
/dts-v1/;
/plugin/;
/ {
- compatible = "brcm,bcm2708";
+ compatible = "brcm,bcm2711";
fragment@0 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
leads to
building all machine configurations...
these 3 derivations will be built:
/nix/store/27i0610zl7i1dn2897vm134ncyayj71r-device-tree-overlays.drv
/nix/store/8cxvwkld6xk1ylxgsrjdxjsbasdjfp00-nixos-system-eye-22.05.20220520.dfd8298.drv
/nix/store/wh0dhzpmpgj6x81q29n7h6z36jhdhh24-nixops-machines.drv
building '/nix/store/27i0610zl7i1dn2897vm134ncyayj71r-device-tree-overlays.drv'...
./broadcom -> /nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom
'./broadcom/bcm2711-rpi-4-b.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-4-b.dtb'
'./broadcom/bcm2711-rpi-400.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-400.dtb'
'./broadcom/bcm2711-rpi-cm4.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-cm4.dtb'
Applying overlay i2c1-okay-overlay to bcm2711-rpi-4-b.dtb
Applying overlay audio-on-overlay to bcm2711-rpi-4-b.dtb
Applying overlay seeed-2mic-voicecard to bcm2711-rpi-4-b.dtb
Failed to apply '/nix/store/xnlvc8a6jhmq4qxzyvq9822fhaslf4pd-seeed-2mic-voicecard-dtbo': FDT_ERR_NOTFOUND
error: builder for '/nix/store/27i0610zl7i1dn2897vm134ncyayj71r-device-tree-overlays.drv' failed with exit code 1;
last 9 log lines:
> ./broadcom -> /nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom
> './broadcom/bcm2711-rpi-4-b.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-4-b.dtb'
> './broadcom/bcm2711-rpi-400.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-400.dtb'
> './broadcom/bcm2711-rpi-cm4.dtb' -> '/nix/store/yflfl67cmylpiivl4s5gg3h8zf549jby-device-tree-overlays/./broadcom/bcm2711-rpi-cm4.dtb'
> Applying overlay i2c1-okay-overlay to bcm2711-rpi-4-b.dtb
> Applying overlay audio-on-overlay to bcm2711-rpi-4-b.dtb
> Applying overlay seeed-2mic-voicecard to bcm2711-rpi-4-b.dtb
>
> Failed to apply '/nix/store/xnlvc8a6jhmq4qxzyvq9822fhaslf4pd-seeed-2mic-voicecard-dtbo': FDT_ERR_NOTFOUND
For full logs, run 'nix log /nix/store/27i0610zl7i1dn2897vm134ncyayj71r-device-tree-overlays.drv'.
error: 1 dependencies of derivation '/nix/store/8cxvwkld6xk1ylxgsrjdxjsbasdjfp00-nixos-system-eye-22.05.20220520.dfd8298.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wh0dhzpmpgj6x81q29n7h6z36jhdhh24-nixops-machines.drv' failed to build
Traceback (most recent call last):
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 773, in build_configs
configs_path = subprocess.check_output(
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/nix/store/wnrc4daqbd6v5ifqlxsj75ky8556zy0p-python3-3.9.12/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-store', '-r', '/nix/store/wh0dhzpmpgj6x81q29n7h6z36jhdhh24-nixops-machines.drv']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/795y3fjcp5b9gr9fj2a908z97wida09j-python3.9-nixops-2.0.0-pre-7220cbd/bin/.nixops-wrapped", line 9, in <module>
sys.exit(main())
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/__main__.py", line 56, in main
args.op(args)
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/script_defs.py", line 715, in op_deploy
depl.deploy(
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 1352, in deploy
self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 1341, in run_with_notify
f()
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 1352, in <lambda>
self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 1267, in _deploy
self.configs_path = self.build_configs(
File "/nix/store/4zh7crx1r2sizvpyb1c9h109yfimlzn2-python3-3.9.12-env/lib/python3.9/site-packages/nixops/deployment.py", line 778, in build_configs
raise Exception("unable to build all machine configurations")
Exception: unable to build all machine configurations
Where the error ends up being FDT_ERR_NOTFOUND
when applying the overlay. As suggested by this issue libfdt cannot apply miniuart-bt.dtbo · Issue #1718 · raspberrypi/firmware · GitHub I tried manually applying the overlay on the rpi itself without using nix or nixops with the result being:
[root@eye:~]# dtmerge -d /run/current-system/dtbs/broadcom/bcm2711-rpi-4-b.dtb bcm2711-rpi-4-b-with-overlay.dtb seeed-2mic-voicecard-overlay.dtbo
DTOVERLAY[debug]: using platform 'bcm2711'
DTOVERLAY[debug]: overlay map not loaded
DTOVERLAY[debug]: /aliases:i2c=i2c0
DTOVERLAY[debug]: /__symbols__:i2c=i2c0
DTOVERLAY[debug]: /__overrides__:i2c=i2c0
DTOVERLAY[debug]: /aliases:i2c_arm=i2c0
DTOVERLAY[debug]: /__symbols__:i2c_arm=i2c0
DTOVERLAY[debug]: /__overrides__:i2c_arm=i2c0
DTOVERLAY[debug]: /aliases:i2c_vc=i2c1
DTOVERLAY[debug]: /__symbols__:i2c_vc=i2c1
DTOVERLAY[debug]: /__overrides__:i2c_vc=i2c1
DTOVERLAY[debug]: /__overrides__:i2c_baudrate=i2c0_baudrate
DTOVERLAY[debug]: /__overrides__:i2c_arm_baudrate=i2c0_baudrate
DTOVERLAY[debug]: /__overrides__:i2c_vc_baudrate=i2c1_baudrate
DTOVERLAY[debug]: merge_fragment(/soc/i2s@7e203000,/fragment@0/__overlay__)
DTOVERLAY[debug]: +prop(status)
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment(/,/fragment@1/__overlay__)
DTOVERLAY[debug]: merge_fragment(/wm8960_mclk,/fragment@1/__overlay__/wm8960_mclk)
DTOVERLAY[debug]: +prop(compatible)
DTOVERLAY[debug]: +prop(#clock-cells)
DTOVERLAY[debug]: +prop(clock-frequency)
DTOVERLAY[debug]: +prop(phandle)
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment(/soc/i2c@7e804000,/fragment@2/__overlay__)
DTOVERLAY[debug]: +prop(#address-cells)
DTOVERLAY[debug]: +prop(#size-cells)
DTOVERLAY[debug]: +prop(status)
DTOVERLAY[debug]: merge_fragment(/soc/i2c@7e804000/wm8960,/fragment@2/__overlay__/wm8960)
DTOVERLAY[debug]: +prop(compatible)
DTOVERLAY[debug]: +prop(reg)
DTOVERLAY[debug]: +prop(#sound-dai-cells)
DTOVERLAY[debug]: +prop(AVDD-supply)
DTOVERLAY[debug]: +prop(DVDD-supply)
DTOVERLAY[debug]: +prop(phandle)
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment(/soc/sound,/fragment@3/__overlay__)
DTOVERLAY[debug]: +prop(compatible)
DTOVERLAY[debug]: +prop(simple-audio-card,format)
DTOVERLAY[debug]: +prop(simple-audio-card,name)
DTOVERLAY[debug]: +prop(status)
DTOVERLAY[debug]: +prop(simple-audio-card,widgets)
DTOVERLAY[debug]: +prop(simple-audio-card,routing)
DTOVERLAY[debug]: merge_fragment(/soc/sound/simple-audio-card,cpu,/fragment@3/__overlay__/simple-audio-card,cpu)
DTOVERLAY[debug]: +prop(sound-dai)
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment(/soc/sound/simple-audio-card,codec,/fragment@3/__overlay__/simple-audio-card,codec)
DTOVERLAY[debug]: +prop(sound-dai)
DTOVERLAY[debug]: +prop(clocks)
DTOVERLAY[debug]: +prop(clock-names)
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: merge_fragment() end
DTOVERLAY[debug]: wrote 52846 bytes to 'bcm2711-rpi-4-b-with-overlay.dtb'
[root@eye:~]# fdtoverlay -v -i /run/current-system/dtbs/broadcom/bcm2711-rpi-4-b.dtb -o bcm2711-rpi-4-b-with-overlay.dtb seeed-2mic-voicecard-overlay.dtbo
input = /run/current-system/dtbs/broadcom/bcm2711-rpi-4-b.dtb
output = bcm2711-rpi-4-b-with-overlay.dtb
overlay[0] = seeed-2mic-voicecard-overlay.dtbo
in which both dtmerge
and ftdoverlay
succeed. I’m hesitant to apply this overlay directly though since I would like to keep my rpi as stateless as possible.
From here I’m not sure where to go. I’ve never used device tree overlays before starting this venture so my debugging knowledge is just what I’ve picked up reading issues. My best guess at this point is that my cross compilation setup with nixops is causing fdtoverlay
to fail when looking for nodes but I think this is unlikely since the compilation seems to be grabbing the correct rpi overlay to merge with.
TLDR
I’m trying to apply a device tree overlay, I can successfully merge the overlay into the tree manually but I can’t get it to work in my configuration. See above for output.