Packages
Nerves System - Kria KR260
Current section
5 Versions
Jump to
Current section
5 Versions
Compare versions
8
files changed
+100
additions
-14
deletions
| @@ -47,7 +47,7 @@ Keys used by this system are: | |
| 47 47 | |
| 48 48 | Key | Example Value | Description |
| 49 49 | :--------------------- | :---------------- | :---------- |
| 50 | - `nerves_serial_number` | `"12345678"` | By default, this string is used to create unique hostnames and Erlang node names. If unset, it defaults to part of the Raspberry Pi's device ID. |
| 50 | + `nerves_serial_number` | `"12345678"` | By default, this string is used to create unique hostnames and Erlang node names. If unset, it defaults to 4-digits, part of MAC address. |
| 51 51 | |
| 52 52 | The normal procedure would be to set these keys once in manufacturing or before |
| 53 53 | deployment and then leave them alone. |
| @@ -79,3 +79,92 @@ provisioning.conf file location by setting the environment variable | |
| 79 79 | will set the `nerves_serial_number`, if you override the location to this file, |
| 80 80 | you will be responsible for setting this yourself. |
| 81 81 | |
| 82 | + ## FPGA |
| 83 | + |
| 84 | + This system provides [dfx-mgr](https://github.com/Xilinx/dfx-mgr), so we can load/unload accelerators |
| 85 | + by following steps. |
| 86 | + |
| 87 | + - Add `dfx-mgrd` under the application supervisor, `lib/[project name]/application.ex`. |
| 88 | + It's recommended to use [MuonTrap.Daemon](https://hexdocs.pm/muontrap/MuonTrap.Daemon.html). |
| 89 | + **IMPORTANT**: `dfx-mgrd` must be to run on RW partition. (It writes state.txt on it... |
| 90 | + |
| 91 | + ```elixir |
| 92 | + def children(_target) do |
| 93 | + [ |
| 94 | + # Children for all targets except host |
| 95 | + # Starts a worker by calling: Kr260Test.Worker.start_link(arg) |
| 96 | + # {Kr260Test.Worker, arg}, |
| 97 | + ] ++ dfx_mgrd() |
| 98 | + end |
| 99 | + |
| 100 | + defp dfx_mgrd() do |
| 101 | + dfx_mgrd = "/usr/bin/dfx-mgrd" |
| 102 | + |
| 103 | + if File.exists?(dfx_mgrd) do |
| 104 | + # nerves_system_kr260 provides `/lib/firmware` as tmpfs |
| 105 | + [{MuonTrap.Daemon, [dfx_mgrd, [], [cd: "/lib/firmware"]]}] |
| 106 | + else |
| 107 | + [] |
| 108 | + end |
| 109 | + end |
| 110 | + ``` |
| 111 | + |
| 112 | + - load/unload accelerators by `dfx-mgr-client`. |
| 113 | + It's recommended to create wrapper but following example use client directly :). |
| 114 | + |
| 115 | + ``` |
| 116 | + # list packages |
| 117 | + iex()> cmd "dfx-mgr-client -listPackage" |
| 118 | + Accelerator Accel_type Base Base_type #slots(PL+AIE) Active_slot |
| 119 | + |
| 120 | + k26-starter-kits XRT_FLAT k26-starter-kits XRT_FLAT (0+0) 0 |
| 121 | + ``` |
| 122 | + |
| 123 | + ``` |
| 124 | + # unload |
| 125 | + iex()> cmd "dfx-mgr-client -remove" |
| 126 | + remove from slot 0 returns: 0 (Ok) |
| 127 | + ``` |
| 128 | + |
| 129 | + ``` |
| 130 | + # load |
| 131 | + iex()> cmd "dfx-mgr-client -load k26-starter-kits" |
| 132 | + Loaded to slot 0 |
| 133 | + ``` |
| 134 | + |
| 135 | + ### About the default firmware |
| 136 | + |
| 137 | + The default firmware can be specified by `rootfs_overlay/etc/dfx-mgrd/default_firmware`. |
| 138 | + |
| 139 | + User can change it by your Nerves project's `rootfs_overlay/etc/dfx-mgrd/default_firmware`. |
| 140 | + |
| 141 | + Would like to know more details? Let's read https://github.com/Xilinx/dfx-mgr/tree/xilinx_v2022.1_update2#daemonconf. |
| 142 | + |
| 143 | + **NOTE:This system specified `k26-starter-kits` for default, but doesn't include the firmware.** |
| 144 | + |
| 145 | + ### FAQ |
| 146 | + |
| 147 | + Q: Where should accelerators be located? |
| 148 | + |
| 149 | + A: Put them under your Nerves project's `rootfs_overlay/usr/lib/firmware/xilinx`. |
| 150 | + |
| 151 | + ### dfx-mgr details for DEV |
| 152 | + |
| 153 | + 1. `dfx-mgrd` needs some RW area. |
| 154 | + 1. `/configfs`, literally [configfs](https://www.kernel.org/doc/Documentation/filesystems/configfs/configfs.txt) |
| 155 | + We prepared it as configfs by erlinit, see. `rootfs_overlay/etc/erlinit.config` |
| 156 | + 1. `/lib/firmware`, accelerator's `*.dtbo` is copied to here by `dfx-mgrd` |
| 157 | + We prepared it as tmpfs by erlinit, see. `rootfs_overlay/etc/erlinit.config` |
| 158 | + 1. `dfx-mgrd` must run on RW area, 'cause it writes some files to run. |
| 159 | + We recommended to use tmpfs(RAM) for it. |
| 160 | + |
| 161 | + ## Fan Control |
| 162 | + |
| 163 | + In the case of [Ubuntu for Kria SOMs](https://ubuntu.com/download/amd-xilinx), fan control is enabled after boot. |
| 164 | + So the fan will not run at full speed. |
| 165 | + Ubuntu uses `/usr/sbin/fancontrol`, **bash script**, and it is configured by `/etc/fancontrol`. |
| 166 | + `/usr/sbin/fancontrol` controls the fan via `/sys/class/hwmon/hwmonN/pwmN(tempN_input)`. |
| 167 | + |
| 168 | + On the other hand, this system doesn't control the fan. |
| 169 | + This system provides `/sys/class/hwmon/hwmonN/pwmN(tempN_input)`, but not uses `bash`. |
| 170 | + So we don't use `fancontrol`. |
| @@ -1 +1 @@ | |
| 1 | - 0.0.3 |
| 1 | + 0.1.0 |
| @@ -11,12 +11,8 @@ | |
| 11 11 | <<"rootfs_overlay/lib/firmware/MOUNTPOINT">>,<<"rootfs_overlay/configfs">>, |
| 12 12 | <<"rootfs_overlay/configfs/MOUNTPOINT">>,<<"rootfs_overlay/usr">>, |
| 13 13 | <<"rootfs_overlay/usr/lib">>,<<"rootfs_overlay/usr/lib/firmware">>, |
| 14 | - <<"rootfs_overlay/usr/lib/firmware/xilinx">>, |
| 15 | - <<"rootfs_overlay/usr/lib/firmware/xilinx/k26-starter-kits">>, |
| 16 | - <<"rootfs_overlay/usr/lib/firmware/xilinx/k26-starter-kits/k26_starter_kits.bit.bin">>, |
| 17 | - <<"rootfs_overlay/usr/lib/firmware/xilinx/k26-starter-kits/shell.json">>, |
| 18 | - <<"rootfs_overlay/usr/lib/firmware/xilinx/k26-starter-kits/k26_starter_kits.dtbo">>, |
| 19 | - <<"rootfs_overlay/usr/bin">>,<<"rootfs_overlay/usr/bin/load_accel">>, |
| 14 | + <<"rootfs_overlay/usr/lib/firmware/xilinx">>,<<"rootfs_overlay/usr/bin">>, |
| 15 | + <<"rootfs_overlay/usr/bin/load_accel">>, |
| 20 16 | <<"rootfs_overlay/usr/bin/accel-bzip2">>, |
| 21 17 | <<"rootfs_overlay/usr/bin/accel-container">>, |
| 22 18 | <<"rootfs_overlay/usr/bin/accel-aes">>, |
| @@ -52,4 +48,4 @@ | |
| 52 48 | {<<"optional">>,false}, |
| 53 49 | {<<"repository">>,<<"hexpm">>}, |
| 54 50 | {<<"requirement">>,<<"~> 1.6.0">>}]]}. |
| 55 | - {<<"version">>,<<"0.0.3">>}. |
| 51 | + {<<"version">>,<<"0.1.0">>}. |
| @@ -53,4 +53,9 @@ BR2_NERVES_SYSTEM_NAME="nerves_system_kr260" | |
| 53 53 | BR2_NERVES_ADDITIONAL_IMAGE_FILES="${NERVES_DEFCONFIG_DIR}/fwup.conf" |
| 54 54 | BR2_PACKAGE_NBTTY=y |
| 55 55 | BR2_PACKAGE_NERVES_CONFIG=y |
| 56 | + BR2_PACKAGE_XMUTIL=y |
| 56 57 | BR2_PACKAGE_DFX_MGR=y |
| 58 | + BR2_PACKAGE_AXI_QOS=y |
| 59 | + BR2_PACKAGE_DDR_QOS=y |
| 60 | + BR2_PACKAGE_IMAGE_UPDATE=y |
| 61 | + BR2_PACKAGE_XLNX_PLATFORMSTATS=y |
| @@ -63,7 +63,7 @@ | |
| 63 63 | -m pstore:/sys/fs/pstore:pstore:nodev,noexec,nosuid: |
| 64 64 | -m tmpfs:/sys/fs/cgroup:tmpfs:nodev,noexec,nosuid:mode=755,size=1024k |
| 65 65 | -m cpu:/sys/fs/cgroup/cpu:cgroup:nodev,noexec,nosuid:cpu |
| 66 | - # for kr260 |
| 66 | + # for dfx-mgrd |
| 67 67 | -m configfs:/configfs:configfs:nodev,noexec,nosuid: |
| 68 68 | -m tmpfs:/lib/firmware:tmpfs:nodev,noexec,nosuid:mode=755,size=64M |
Loading more files…