From e149095e819ecf297b1d1aa4ae68e1211bfe22ee Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Thu, 4 Apr 2024 17:09:17 +0800 Subject: [PATCH] add device init scripts and initialize at boot --- fast-servo/pyfastservo/common.py | 4 ++-- flake.nix | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fast-servo/pyfastservo/common.py b/fast-servo/pyfastservo/common.py index b14c44b..dbf60ab 100644 --- a/fast-servo/pyfastservo/common.py +++ b/fast-servo/pyfastservo/common.py @@ -22,8 +22,8 @@ MAP_SIZE = 0x1000 MAP_MASK = 0xFFF PAGESIZE = 0x1000 -LINIEN_OFFSET = 0x0 -# LINIEN_OFFSET = 0x300000 +# LINIEN_OFFSET = 0x0 +LINIEN_OFFSET = 0x300000 # ---------------------------------------------------------------- # FRONT PANEL LEDS REGISTER ADDRESSES diff --git a/flake.nix b/flake.nix index 63e6b43..31c303b 100644 --- a/flake.nix +++ b/flake.nix @@ -183,6 +183,7 @@ fast-servo-config = { config, pkgs, lib, ... }: { environment.systemPackages = [ linien-server + (pkgs.python3.withPackages(ps: [ ps.spidev ps.smbus2 ])) ]; boot.postBootCommands = lib.mkAfter '' @@ -193,6 +194,11 @@ mkdir -p /lib/firmware cp ${fast-servo-gateware}/gateware.bin /lib/firmware/ echo gateware.bin > /sys/class/fpga_manager/fpga0/firmware + + # Run device init scripts + mkdir -p /opt/pyfastservo + cp ${./fast-servo/pyfastservo}/* /opt/pyfastservo + python3 /opt/pyfastservo/initialize.py ''; }; @@ -400,7 +406,7 @@ BASE=$(realpath $(dirname $0)) qemu-img convert -O qcow2 -f raw -o preallocation=metadata $BASE/sd-image.img $IMGDIR/sd-sparse.qcow2 - qemu-img create -F qcow2 -f qcow2 -b $IMGDIR/sd-sparse.qcow2 $IMGDIR/sd-overlay.qcow2 1G + qemu-img create -F qcow2 -f qcow2 -b $IMGDIR/sd-sparse.qcow2 $IMGDIR/sd-overlay.qcow2 2G # Some command arguments are based from samples in Xilinx QEMU User Documentation # See: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/821854273/Running+Bare+Metal+Applications+on+QEMU