Fix linien-server red pitaya dependencies #51

Merged
sb10q merged 1 commits from fsagbuya/nix-servo:linien-rp-fix into master 2024-03-20 15:33:47 +08:00
Collaborator

Description

Fix linien-server Red Pitaya dependencies:

  • redpitaya_nginx.service is being called by start_nginx() and stop_nginx()
  • fpgautil in '/opt/redpitaya/bin/fpgautil' is being called by flash_fpga

This patch simply omits the call for those functions. Loading the gateware is being done manually at boot. We can also adapt the fpgautil here for fast-servo and initiate it when linien-server command is called. Can include that feature in the next PR if that's acceptable.

Error log:
redpitaya_nginx.service:

-bash-5.2# linien-server      
linien_server.server           INFO     Start server on port 18862
linien_common.influxdb         INFO     Saved InfluxDB credentials to /root/.local/share/linien/influxdb_credentials.json

...

 File "/nix/store/qyixd4vyvf2hy7x7aap73yms0qjvyyh8-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 45, in __init__
    stop_nginx()
  File "/nix/store/qyixd4vyvf2hy7x7aap73yms0qjvyyh8-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 333, in stop_nginx
    subprocess.Popen(["systemctl", "stop", "redpitaya_nginx.service"]).wait()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'systemctl'

fpgautil:

-bash-5.2# linien-server
linien_server.server           INFO     Start server on port 18862
linien_common.influxdb         INFO     Saved InfluxDB credentials to /root/.local/share/linien/influxdb_credentials.json
linien_server.acquisition      INFO     Using fpgautil to deploy gateware.

...

  File "/nix/store/1sfd5a0z4r91dzgj67chnc5i9asbr84q-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 46, in __init__
    flash_fpga()
  File "/nix/store/1sfd5a0z4r91dzgj67chnc5i9asbr84q-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 325, in flash_fpga
    subprocess.Popen(["/opt/redpitaya/bin/fpgautil", "-b", str(filepath)]).wait()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/redpitaya/bin/fpgautil'

### Description Fix linien-server Red Pitaya dependencies: - `redpitaya_nginx.service` is being called by `start_nginx()` and `stop_nginx()` - `fpgautil` in `'/opt/redpitaya/bin/fpgautil'` is being called by `flash_fpga` This patch simply omits the call for those functions. Loading the gateware is being done manually at boot. We can also adapt the fpgautil here for fast-servo and initiate it when `linien-server` command is called. Can include that feature in the next PR if that's acceptable. Error log: `redpitaya_nginx.service`: ``` -bash-5.2# linien-server linien_server.server INFO Start server on port 18862 linien_common.influxdb INFO Saved InfluxDB credentials to /root/.local/share/linien/influxdb_credentials.json ... File "/nix/store/qyixd4vyvf2hy7x7aap73yms0qjvyyh8-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 45, in __init__ stop_nginx() File "/nix/store/qyixd4vyvf2hy7x7aap73yms0qjvyyh8-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 333, in stop_nginx subprocess.Popen(["systemctl", "stop", "redpitaya_nginx.service"]).wait() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1953, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'systemctl' ``` `fpgautil`: ``` -bash-5.2# linien-server linien_server.server INFO Start server on port 18862 linien_common.influxdb INFO Saved InfluxDB credentials to /root/.local/share/linien/influxdb_credentials.json linien_server.acquisition INFO Using fpgautil to deploy gateware. ... File "/nix/store/1sfd5a0z4r91dzgj67chnc5i9asbr84q-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 46, in __init__ flash_fpga() File "/nix/store/1sfd5a0z4r91dzgj67chnc5i9asbr84q-python3.11-linien-server-1.0.1-armv7l-unknown-linux-gnueabihf/lib/python3.11/site-packages/linien_server/acquisition.py", line 325, in flash_fpga subprocess.Popen(["/opt/redpitaya/bin/fpgautil", "-b", str(filepath)]).wait() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/nix/store/zmx5wfz3kg0cqgycfawh9cjgx0wv1gp1-python3-armv7l-unknown-linux-gnueabihf-3.11.8/lib/python3.11/subprocess.py", line 1953, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/opt/redpitaya/bin/fpgautil' ```
fsagbuya added 1 commit 2024-03-20 13:53:02 +08:00
sb10q merged commit 208d56adb2 into master 2024-03-20 15:33:47 +08:00
Owner

Loading the gateware is being done manually at boot.

Please add runit scripts to do it automatically. Also nginx and the python hardware initialization stuff (once it works).

> Loading the gateware is being done manually at boot. Please add runit scripts to do it automatically. Also nginx and the python hardware initialization stuff (once it works).
Owner

Though it's not clear to me why we would need nginx.

Though it's not clear to me why we would need nginx.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-servo#51
No description provided.