1
0
Fork 0

configure loading of bitstream at boot time

This commit is contained in:
Florian Agbuya 2024-03-21 18:33:23 +08:00
parent 64d83bc50d
commit 7a49e80c5a
1 changed files with 15 additions and 1 deletions

View File

@ -130,6 +130,19 @@
environment.systemPackages = [ linien-server ];
});
fast-servo-init = ({ config, pkgs, lib, ... }: {
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
'';
});
fast-servo-gateware = pkgs.stdenv.mkDerivation rec {
name = "fast-servo-gateware";
inherit (pkgs.python3Packages.linien-common) src;
@ -195,7 +208,8 @@
inherit nixpkgs;
extraModules = [
"${patched-not-os}/zynq_image.nix"
] ++ pkgs.lib.optional (board == "fast-servo") fast-servo-extrapkg;
] ++ pkgs.lib.optional (board == "fast-servo") fast-servo-extrapkg
++ pkgs.lib.optional (board == "fast-servo") fast-servo-init;
system = "x86_64-linux";
crossSystem.system = "armv7l-linux";
});