forked from pocopico/rp-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHDSN01
137 lines (108 loc) · 5.04 KB
/
HDSN01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: 构建
on:
workflow_dispatch:
inputs:
clean_cache:
description: 'Clear caches'
required: false
type: boolean
push:
branches:
- master
paths:
- "docker/**"
- "**.sh"
- "**.json"
jobs:
build:
runs-on: ubuntu-latest
name: 编译 "${{matrix.platform}} ${{matrix.version}}"
strategy:
fail-fast: false
matrix:
include:
# 两行一组,删除不需要的版本
- platform: ds920p
version: 7.0.1-42218
- platform: ds920p
version: 7.1.0-42661
steps:
- name: 检出项目文件
uses: actions/checkout@v3
- name: 缓存加速
uses: actions/cache@v3
with:
path: |
cache/*.pat
cache/*.org
docker/downloads/*.txz
key: ${{matrix.platform}}-${{matrix.version}}-${{ hashFiles('global_config.json') }}
restore-keys: ${{matrix.platform}}-${{matrix.version}}-
- name: 清理缓存
if: "${{ github.event.inputs.clean_cache == 'true' }}"
run: |
rm -rf cache/*.pat
rm -rf cache/*.org
rm -rf docker/downloads/*.txz
- name: 准备构建环境
run: |
./redpill_tool_chain.sh build ${{matrix.platform}}-${{matrix.version}}
- name: 配置引导镜像
run: |
cp sample_user_config.json ${{matrix.platform}}_user_config.json
# 调整VID和PID
sed -i -e 's/0x0781/0x5583/g' -e 's/0x0781/0x5583/g' ${{matrix.platform}}_user_config.json
# 调整SN和MAC,最好使用 actions secrets 引入,SN应该是固定值不应该每次生成
sn=`./redpill_tool_chain.sh sn ${{matrix.platform}} | grep 'Serial Number' | awk '{print $3}'`
sed -i -e "s/1234XXX123/${sn:="1130LWN123456"}/g" -e 's/XXYYXXYYXXYY/0011323D47F7/g' ${{matrix.platform}}_user_config.json
# 添加第二张网卡mac并设置网卡数量
# sed -i -e 's/0011323D47F7"/&,\n\t"mac2": "0011323D47F8",\n\t"netif_num": 2/' ${{matrix.platform}}_user_config.json
# 上行#字符用于跳过校验网卡数量
# 调整synoinfo
sed -i -e 's/"synoinfo": {},/"synoinfo": {\n\t"maxlanport": "2"\n },/' ${{matrix.platform}}_user_config.json
cat ${{matrix.platform}}_user_config.json
- name: 添加扩展驱动
if: matrix.platform != 'dva3221'
run: |
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-boot-wait.json
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-acpid.json
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-virtio.json
#添加 R8125、ESXI PVE虚拟化网卡驱动
./redpill_tool_chain.sh add https://raw.githubusercontent.com/pocopico/rp-ext/master/r8125/rpext-index.json
./redpill_tool_chain.sh add https://raw.githubusercontent.com/pocopico/rp-ext/master/vmxnet3/rpext-index.json
- name: 添加扩展驱动[dva3221]
if: matrix.platform == 'dva3221'
run: |
echo '等待整理兼容性扩展~😀'
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-boot-wait.json
- name: 添加 Misc shell
run: |
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-misc.json
- name: 添加 jumkey.dtb !!!Create your own device tree binary!!!
if: matrix.platform == 'ds920p' || matrix.platform == 'ds1621p' || matrix.platform == 'ds2422p'
run: |
./redpill_tool_chain.sh add https://github.com/tossp/redpill-tool-chain/raw/master/extensions/redpill-dtb.json
echo '!!!Create your own device tree binary!!!'
echo 'see https://github.com/jumkey/redpill-load/blob/develop/redpill-dtb/README.md'
- name: 预处理PAT
if: endsWith(matrix.version, '42661') && startsWith(matrix.platform, 'ds361')
run: |
sed -i 's/debian:8-slim/debian:10-slim/g' global_config.json
./redpill_tool_chain.sh build ${{matrix.platform}}-${{matrix.version}}
./redpill_tool_chain.sh pat ${{matrix.platform}}-${{matrix.version}}
sed -i 's/debian:10-slim/debian:8-slim/g' global_config.json
./redpill_tool_chain.sh build ${{matrix.platform}}-${{matrix.version}}
- name: 编译引导镜像
run: |
./redpill_tool_chain.sh auto ${{matrix.platform}}-${{matrix.version}}
- name: 上传引导镜像到 github actions
uses: actions/upload-artifact@v3
with:
name: dsm-${{matrix.platform}}-${{matrix.version}}
path: images/redpill-*.img
if-no-files-found: error
- name: 删除旧的工作流
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 1
keep_minimum_runs: 3