From 4e78ad4d915147dec4178a2115475d8d5eee8c0e Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 19 Feb 2024 20:00:38 +0000 Subject: [PATCH] enable rmtfs: file server for remote processors (I'm guessing it's actually more of a "block storage" service as it expects to serve straight from mmc partitions with no filesystem in sight) This is step 1 towards getting the modem working, and also seems to have initialised the audio [ 682.111619] remoteproc remoteproc1: remote processor 4080000.remoteproc is now up [...] [ 682.580706] input: msm8916 Headset Jack as /devices/platform/soc@0/7702000.sound/sound/card0/input5 [ 687.912897] wwan wwan0: port wwan0at0 attached [ 687.914081] wwan wwan0: port wwan0at1 attached [ 687.944139] wwan wwan0: port wwan0qmi0 attached --- configuration.nix | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) 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"; + }; + }; + }; + }; }