From 7c6320f66dce97927d6959aba19dc3f762eda6a5 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Fri, 5 Apr 2024 15:22:13 +0800 Subject: [PATCH] configure loading of bitstream at boot time --- flake.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3330a6b..bda13f9 100644 --- a/flake.nix +++ b/flake.nix @@ -209,8 +209,18 @@ extraModules = [ "${patched-not-os}/zynq_image.nix" ] ++ pkgs.lib.optionals (board == "fast-servo") [ - ({ config, pkgs, ... }: { + ({ config, pkgs, lib, ... }: { environment.systemPackages = [ linien-server ]; + boot.postBootCommands = lib.mkAfter '' + + # Program the FPGA + set +x + echo "Flashing bitstream..." + echo 0 > /sys/class/fpga_manager/fpga0/flags + mkdir -p /lib/firmware + cp ${fast-servo-gateware}/gateware.bin /lib/firmware/ + echo gateware.bin > /sys/class/fpga_manager/fpga0/firmware + ''; })]; system = "x86_64-linux"; inherit crossSystem;