Skip to content

Commit 90f352d

Browse files
committed
feat(developer): add DeployKit quirk configuration format specification
1 parent c64ddde commit 90f352d

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
+++
2+
title = "DeployKit: Device-specific Quirks"
3+
description = ""
4+
+++
5+
6+
# Format Description
7+
8+
A quirk configuration is written in TOML, in the following format:
9+
10+
```toml
11+
[model]
12+
# Two modes of operation:
13+
#
14+
# - dmi:Match by DMI (modalias, or model alias), useful for model matching.
15+
# - path:Match by path, usually ones found in sysfs.
16+
type = [dmi|path]
17+
18+
# path_pattern/dmi_pattern may not be specified at the same time.
19+
20+
# Match by path - does a path exist (usually in sysfs)? Wildcards are allowed.
21+
#
22+
# For example, to match an LEFI-based platform.
23+
#
24+
# The following must be specified if type = path.
25+
path_pattern = "/sys/firmware/lefi"
26+
27+
# Match by DMI - taken from /sys/class/dmi/id/modalias, wildcards are allowed.
28+
#
29+
# For instance, the modalias for Loongson XA61200:
30+
#
31+
# dmi:bvnLoongson:bvrLoongson-UDK2018-V4.0.05756-prestable202405:bd05/23/24145323:svnLoongson:pnLoongson-3A6000-HV-7A2000-1w-V0.1-EVB:pvrToBeFilledByO.E.M:rvnToBeFilledByO.E.M:rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:rvrToBeFilledByO.E.M:cvnLoongson:ct3:cvrToBeFilledByO.E.M:skuToBeFilledByO.E.M:
32+
#
33+
# The following will match the motherboard/series:
34+
#
35+
# dmi:*svnLoongson:*pnLoongson-3A6000-HV-7A2000-1w-V0.1-EVB:*
36+
#
37+
# And the following will match a specific motherboard revision:
38+
#
39+
# dmi:*svnLoongson:*rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:*
40+
#
41+
# The following must be specified if type = dmi
42+
dmi_pattern = "dmi:*svnLoongson:*rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:*"
43+
44+
[quirk]
45+
# A command to execute for the quirk. The command to launch must have its
46+
# executable bit set (and the correct shebang specified, if it is a script).
47+
command = "/usr/share/deploykit-backend/quirks/loongson-xa61200/quirk.bash"
48+
49+
# Skip one or multiple stages, useful for platforms that may not be capable
50+
# of runnning certain installation procedures.
51+
#
52+
# Refer to deploykit-backend, specifically the `enum InstallationStage' in
53+
# install/src/lib.rs for a list of installation stages.
54+
#
55+
# Optional. The following example skips GRUB installation and SSH keygen.
56+
skip_stages = ["InstallGrub", "GenerateSshKey"]
57+
58+
```
59+
60+
# File Placement
61+
62+
Quirks should be placed under `/usr/share/deploykit-backend/quirks` and organised by a single-level subdirectory:
63+
64+
```
65+
- /usr/share/deploykit-backend/quirks
66+
- ./loongson-xa61200 # Model
67+
- ./quirk.toml # Quirk Configuration
68+
```
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
+++
2+
title = "DeployKit 机型规避数据格式"
3+
description = ""
4+
+++
5+
6+
# 格式说明
7+
8+
规避配置使用 TOML 格式编写,内容如下:
9+
10+
```toml
11+
[model]
12+
# 两种匹配方式:
13+
#
14+
# - dmi:使用 DMI 信息进行匹配,此处指的是 modalias - 机型别名,一般足够判定
15+
# 机型级别的规避
16+
# - path:使用系统路径特征,尤其是 sysfs 虚拟文件系统中的文件特征进行判断
17+
type = [dmi|path]
18+
19+
# 下列 path_pattern/dmi_pattern 不可同时指定
20+
21+
# 匹配某个路径是否存在(一般为 sysfs 下的虚拟文件),可使用通配符
22+
#
23+
# 下例匹配 LEFI 设备
24+
#
25+
# 如指定 type = path 则此项必填
26+
path_pattern = "/sys/firmware/lefi"
27+
28+
# 匹配 DMI 信息,使用 /sys/class/dmi/id/modalias 内容,可使用通配符
29+
#
30+
# 例如 Loongson XA61200 的 modalias 内容为:
31+
#
32+
# dmi:bvnLoongson:bvrLoongson-UDK2018-V4.0.05756-prestable202405:bd05/23/24145323:svnLoongson:pnLoongson-3A6000-HV-7A2000-1w-V0.1-EVB:pvrToBeFilledByO.E.M:rvnToBeFilledByO.E.M:rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:rvrToBeFilledByO.E.M:cvnLoongson:ct3:cvrToBeFilledByO.E.M:skuToBeFilledByO.E.M:
33+
#
34+
# 此处可匹配板型:
35+
#
36+
# dmi:*svnLoongson:*pnLoongson-3A6000-HV-7A2000-1w-V0.1-EVB:*
37+
#
38+
# 抑或具体的主板版本
39+
#
40+
# dmi:*svnLoongson:*rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:*
41+
#
42+
# 如指定 type = dmi 则此项必填
43+
dmi_pattern = "dmi:*svnLoongson:*rnLoongson-3A6000-HV-7A2000-1w-EVB-V1.21:*"
44+
45+
[quirk]
46+
# 执行规避命令,预期命令已设置有执行位(如命令为脚本则须正确定义 shebang)
47+
command = "/usr/share/deploykit-backend/quirks/loongson-xa61200/quirk.bash"
48+
49+
# 跳过某个或多个步骤,用于处理已知无法完成的步骤(数组形式)
50+
#
51+
# 查阅 deploykit-backend: install/src/lib.rs 中的 enum InstallationStage 即可
52+
# 获取步骤列表
53+
#
54+
# 此项选填;下例为跳过 GRUB 安装及 SSH 密钥生成
55+
skip_stages = ["InstallGrub", "GenerateSshKey"]
56+
```
57+
58+
# 文件摆放
59+
60+
规避配置应放置在 `/usr/share/deploykit-backend/quirks` 路径下,并以单级子目录进行分类:
61+
62+
```
63+
- /usr/share/deploykit-backend/quirks
64+
- ./loongson-xa61200 # 机型
65+
- ./quirk.toml # 规避配置
66+
```

0 commit comments

Comments
 (0)