diff --git a/configuration.nix b/configuration.nix index 64942ac..8d5eb3d 100644 --- a/configuration.nix +++ b/configuration.nix @@ -88,10 +88,14 @@ in { # environment.systemPackages = [ qrtr tqftpserv ]; services.udev.extraRules = '' - # copied from https://github.com/andersson/rpmsgexport - ACTION=="add", SUBSYSTEM=="rpmsg", KERNEL=="rpmsg_ctrl[0-9]*", ATTRS{rpmsg_name}=="pronto", RUN+="${rpmsgexport}/bin/rpmsgexport /dev/$name APPS_RIVA_CTRL" - SUBSYSTEM=="rpmsg", KERNEL=="rpmsg_ctrl[0-9]*", ATTRS{rpmsg_name}=="?*", SYMLINK+="rpmsg/$attr{rpmsg_name}/ctrl" - SUBSYSTEM=="rpmsg", KERNEL=="rpmsg[0-9]*", ATTR{name}=="?*", ATTRS{rpmsg_name}=="?*", SYMLINK+="rpmsg/$attr{rpmsg_name}/$attr{name}" + SUBSYSTEM!="rpmsg", GOTO="qcom_rpmsg_end" + # symlink rpmsg endpoints under useful names + ATTR{name}=="DATA5_CNTL", SYMLINK+="modem" + # open SMD channels when the remoteproc comes up + KERNEL!="rpmsg_ctrl[0-9]*", GOTO="qcom_rpmsg_end" + ATTRS{rpmsg_name}!="modem|hexagon", GOTO="qcom_rpmsg_end" + ACTION=="add", RUN+="${rpmsgexport}/bin/rpmsgexport /dev/$name DATA5_CNTL" + LABEL="qcom_rpmsg_end" ''; environment.systemPackages = with pkgs; [ drm-framebuffer]; @@ -111,5 +115,30 @@ in { hardware.opengl = { enable = true; driSupport = true; }; + + systemd.services = { + rmtfs = + # the four files in here are partition images: + # partlabel => filename + # modemst1 => modem_fs1 + # modemst2 => modem_fs2 + # fsc => modem_fsc + # fsg => modem_fsg + + let files = pkgs.runCommand "rmtfs" {} '' + mkdir -p $out/lib/firmware + cp ${./local/uncompressed-firmware/rmtfs}/* $out/lib/firmware + ''; + in { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + # https://github.com/andersson/rmtfs/blob/7a5ae7e0a57be3e09e0256b51b9075ee6b860322/rmtfs.c#L507-L541 + ExecStart = "${pkgs.rmtfs}/bin/rmtfs -s -r -o ${files}/lib/firmware"; + Restart = "always"; + RestartSec = "10"; + }; + }; + }; + }; }