Skip to content

Commit e53d7a8

Browse files
authored
add hostrunner bo-0 (#2437)
* ci-tools/hostrunner: add usbsdmux Signed-off-by: leongross <leon.gross@9elements.com> * ci-tools/host-runner: add Bochum-0 runner Signed-off-by: leongross <leon.gross@9elements.com> * fix: adjust secrets path to current default nixosSystem.specialArgs.user Signed-off-by: leongross <leon.gross@9elements.com> * ci: update fpga-boss.nix to support usbsdmux Signed-off-by: leongross <leon.gross@9elements.com> --------- Signed-off-by: leongross <leon.gross@9elements.com>
1 parent 3c2698f commit e53d7a8

6 files changed

Lines changed: 82 additions & 13 deletions

File tree

ci-tools/host-runner/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ There are a few secrets that this configuration relies on. They are not checked
4141
- This should be saved at `ci-tools/host-runner/secrets/google/prod`.
4242
- If you or your company does not already possess a key, the github-runner deployments [README](../github-runner/deployments/README.md) describes how to create one.
4343
1. User password
44-
- This configuration expects a hashed password to be present at `ci-tools/host-runner/secrets/host-runner-pass`.
44+
- This configuration expects a hashed password to be present at `ci-tools/host-runner/secrets/hostrunner-pass`.
4545
- Create the password by inputting it into the `mkpasswd` CLI tool.
4646
- You can create a shell that has `mkpasswd` using Nix: `$ nix shell nixpkgs#mkpasswd`.
4747

ci-tools/host-runner/configuration.nix

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ let
4444
export GCP_PROJECT="caliptra-github-ci"
4545
4646
cd /home/${user}
47-
4847
set -eux
4948
mkdir -p ci-images
5049
pushd ci-images
5150
52-
5351
${rtool}/bin/rtool download_artifact 379559 40993215 fpga-image.yml caliptra-fpga-image main > caliptra-fpga-image.zip
5452
${pkgs.unzip}/bin/unzip caliptra-fpga-image.zip
5553
(mv zcu104.img zcu104.img.old || true)
@@ -79,6 +77,12 @@ in
7977
boot.loader.grub.enable = false;
8078
boot.loader.generic-extlinux-compatible.enable = true;
8179

80+
# we need the sg module loaded for usbsdmux, see
81+
# https://github.com/linux-automation/usbsdmux?tab=readme-ov-file#troubleshooting
82+
boot.kernelModules = [
83+
"sg"
84+
];
85+
8286
time.timeZone = "America/Los_Angeles";
8387
i18n.defaultLocale = "en_US.UTF-8";
8488

@@ -115,6 +119,8 @@ in
115119
"ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAC3/lGx3rPr9Nns3aAS8faxKHOj/jgqLNFpjfXehz2kGhNC2EGRibXBHHP738KEG+rjA8HOsG8oHFmTFcOBJf+UqgDNmIfx7M5Db3cEgvhMcZSWck3Nb6ouIBwVchFgAupohpKmGroNuLB5QDuOE3cA8U7zN3y1L8uhUrDAxNPmS2Dvag== ttrippel@ttrippel.svl.corp.google.com"
116120
# jhand
117121
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNAmcxogmvhKGQy/kd5R+uB382XiSb1p/hlqx/lJv3IcxT3JDVk2cRuVxipirplizT6g5+a5FWH6fGrOizQ/Rd0= publickey"
122+
# leongross
123+
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEjT61pnWcD2+LDTEQLoSJgdAJ0cTuLEFY0FC6smSJx0LD2Liep3aEM/+kKOg7Hbnl02UbT+OQspGBqlzxjZdXk="
118124
];
119125
};
120126

@@ -136,6 +142,7 @@ in
136142
((pkgs.callPackage ./tools/fpga-boss.nix {}))
137143
rtool
138144
picocom
145+
usbsdmux
139146
];
140147

141148
programs.zsh.enable = true;
@@ -144,7 +151,12 @@ in
144151
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6001", OWNER="${user}", GROUP="users"
145152
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="2640", OWNER="${user}", GROUP="users"
146153
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="4050", OWNER="${user}", GROUP="users"
154+
155+
# usbsdmux
156+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="4041", OWNER="${user}", GROUP="users"
157+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="2640", OWNER="${user}", GROUP="users"
147158
'';
159+
services.udev.packages = [ pkgs.usbsdmux ];
148160

149161
# Host runner secrets
150162
environment.etc = {

ci-tools/host-runner/flake.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci-tools/host-runner/flake.nix

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@
2020
export GCP_PROJECT="caliptra-github-ci"
2121
2222
RAND_POSTFIX=$(${pkgs.python3}/bin/python3 -c 'import random; print("".join(random.choice("0123456789ABCDEF") for i in range(16)))')
23-
${fpga-boss-bin}/bin/caliptra-fpga-boss --zcu104 $ZCU_FTDI --sdwire $ZCU_SDWIRE serve $IMAGE -- ${rtool-bin}/bin/rtool jitconfig "$FPGA_TARGET" 379559 40993215 "$IDENTIFIER-$RAND_POSTFIX"
23+
24+
# check if we operate on ZCU_SDWIRE or USBSDMUX
25+
if [[ -z $USB_SDMUX ]] && [[ -n $ZCU_SDWIRE ]]; then
26+
SD_MUX="--sdwire $ZCU_SDWIRE"
27+
elif [[ -n $USB_SDMUX ]] && [[ -z $ZCU_SDWIRE ]]; then
28+
SD_MUX="--usbsdmux $USB_SDMUX"
29+
else
30+
echo "Invalid combination of ZCU_SDWIRE and USB_SDMUX"
31+
exit 1
32+
fi
33+
34+
${fpga-boss-bin}/bin/caliptra-fpga-boss --zcu104 $ZCU_FTDI $SD_MUX serve $IMAGE -- ${rtool-bin}/bin/rtool jitconfig "$FPGA_TARGET" 379559 40993215 "$IDENTIFIER-$RAND_POSTFIX"
2435
'';
2536
in
2637
{
@@ -63,5 +74,18 @@
6374
./hostrunners/kir-2.nix
6475
];
6576
};
77+
nixosConfigurations."caliptra-hostrunner-bo0" = nixpkgs.lib.nixosSystem {
78+
system = "aarch64-linux";
79+
specialArgs = {
80+
identifier = "0";
81+
user = "hostrunner";
82+
fpga-boss-script = fpga-boss-script;
83+
rtool = rtool-bin;
84+
};
85+
modules = [
86+
./configuration.nix
87+
./hostrunners/bo-0.nix
88+
];
89+
};
6690
};
6791
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{ config, pkgs, user, fpga-boss-script, ... }:
2+
{
3+
systemd.user.services.zcu-0 = {
4+
enable = true;
5+
description = "ZCU-0 Service";
6+
after = [ "network.target" ];
7+
wantedBy = [ "default.target" ];
8+
9+
serviceConfig = {
10+
Type = "simple";
11+
ExecStart = "${fpga-boss-script}/bin/fpga.sh";
12+
Restart = "on-failure";
13+
RestartSec = "15s";
14+
Environment = [
15+
''ZCU_FTDI="1-1.3"''
16+
''USB_SDMUX="00048.00643"''
17+
''IDENTIFIER="caliptra-bo-01"''
18+
''FPGA_TARGET=""caliptra-fpga,caliptra-fpga-nightly""''
19+
''IMAGE="/home/${user}/ci-images/zcu104.img"''
20+
''PATH=${pkgs.usbsdmux}/bin''
21+
];
22+
};
23+
};
24+
environment.systemPackages = with pkgs; [
25+
((pkgs.writeShellScriptBin "zcu-0-debug" ''
26+
#!${pkgs.bash}/bin/bash
27+
export ZCU_FTDI="1-1.3"
28+
export USB_SDMUX="00048.00643"
29+
30+
caliptra-fpga-boss --zcu104 $ZCU_FTDI --sdwire $USB_SDMUX "$@"
31+
''))
32+
];
33+
}

ci-tools/host-runner/tools/fpga-boss.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ rustPlatform.buildRustPackage rec {
1111
src = fetchFromGitHub {
1212
owner = "chipsalliance";
1313
repo = "caliptra-sw";
14-
rev = "10e4ed31a10b2c6d60642d7894412e2fc8b2b9fb";
15-
sha256 = "sha256-LIU6GDESwoYTL7KrGYZabopC8QRR8x70qQaU7XAVc5o=";
14+
rev = "b5f9a6bed0e0291a0179df8af250a51a90f29c5b";
15+
sha256 = "sha256-nzGj4kwvAJy9eULBzp1SUH0+A/MNEXi93BB5MHRO4Pc=";
1616
};
1717
sourceRoot = "${src.name}/ci-tools/fpga-boss";
1818
cargoHash = "sha256-cx+uHWFzeZHnX92G3UzfpAiT0SSWkEPP+5pxmZ/nbfY=";

0 commit comments

Comments
 (0)