Skip to content

Commit 381b52a

Browse files
committed
sg204x: refactoring pipeline
1 parent 9929b31 commit 381b52a

File tree

2 files changed

+81
-52
lines changed

2 files changed

+81
-52
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build ZSBL
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target_name:
7+
required: true
8+
type: string
9+
zsbl_repo:
10+
required: true
11+
type: string
12+
zsbl_ref:
13+
required: true
14+
type: string
15+
zsbl_defconfig:
16+
required: true
17+
type: string
18+
19+
jobs:
20+
build-zsbl:
21+
name: Build ZSBL
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v6
25+
with:
26+
path: ctx
27+
- name: Cache ZSBL Build
28+
id: cache-zsbl-build
29+
uses: actions/cache@v5
30+
with:
31+
path: dist
32+
key: cache-zsbl-build-${{ inputs.target_name }}-ref=${{ inputs.zsbl_ref }}-wf=${{ hashFiles('ctx/.github/workflows/.sophgo-sg204x.zsbl-build.yml') }}
33+
- name: Setup Toolchains
34+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
35+
id: setup-gcc-toolchain
36+
uses: ./.github/actions/riscv64-gcc-toolchain
37+
- name: Checkout ZSBL
38+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
39+
uses: actions/checkout@v6
40+
with:
41+
repository: ${{ inputs.zsbl_repo }}
42+
path: zsbl
43+
ref: ${{ inputs.zsbl_ref }}
44+
fetch-depth: 1
45+
- name: Build ZSBL
46+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
47+
working-directory: zsbl
48+
run: |
49+
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} "${{ inputs.zsbl_defconfig }}"
50+
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} USE_LINUX_BOOT=1 zsbl.bin
51+
- name: Collect ZSBL Binary
52+
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
53+
run: |
54+
mkdir dist
55+
cp zsbl/zsbl.bin dist/zsbl.bin
56+
- name: Upload Artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: "zsbl-${{ inputs.target_name }}"
60+
path: dist

.github/workflows/sophgo-sg204x.yml

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,29 @@ on:
44
push:
55
paths:
66
- '.github/workflows/sophgo-sg204x.yml'
7+
- '.github/workflows/.sophgo-sg204x.*'
78
- 'sophgo-sg204x/**'
89

910
jobs:
1011

11-
build-zsbl:
12-
name: Build ZSBL
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
include:
17-
- target_name: sophgo-sg2044-srd3-10
18-
zsbl_defconfig: sg2044_defconfig
19-
- target_name: sophgo-sg2042-milkv-pioneer
20-
zsbl_defconfig: sg2042_defconfig
21-
env:
22-
ZSBL_COMMIT_ID: 45054e711d81fbfa1c2167829402d26795199ae7
23-
steps:
24-
- name: Cache ZSBL Build
25-
id: cache-zsbl-build
26-
uses: actions/cache@v5
27-
with:
28-
path: dist
29-
key: cache-zsbl-build-${{ matrix.target_name }}-${{ env.ZSBL_COMMIT_ID }}
30-
- uses: actions/checkout@v5
31-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
32-
- name: Setup Toolchains
33-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
34-
id: setup-gcc-toolchain
35-
uses: ./.github/actions/riscv64-gcc-toolchain
36-
- name: Checkout ZSBL
37-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
38-
uses: actions/checkout@v6
39-
with:
40-
repository: revyos/zsbl
41-
path: zsbl
42-
# Branch sg204x as of 20260224
43-
ref: ${{ env.ZSBL_COMMIT_ID }}
44-
fetch-depth: 1
45-
- name: Build ZSBL
46-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
47-
working-directory: zsbl
48-
run: |
49-
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} "${{ matrix.zsbl_defconfig }}"
50-
make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} USE_LINUX_BOOT=1 zsbl.bin
51-
- name: Collect ZSBL Binary
52-
if: ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
53-
run: |
54-
mkdir dist
55-
cp zsbl/zsbl.bin dist/zsbl.bin
56-
- name: Upload Artifacts
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: "zsbl-${{ matrix.target_name }}"
60-
path: dist
12+
build-zsbl-sg2042:
13+
name: Build ZSBL for SG2042
14+
uses: ./.github/workflows/.sophgo-sg204x.zsbl-build.yml
15+
with:
16+
target_name: sophgo-sg2042
17+
zsbl_repo: revyos/zsbl
18+
# Branch sg204x as of 20260227
19+
zsbl_ref: 45054e711d81fbfa1c2167829402d26795199ae7
20+
zsbl_defconfig: sg2042_defconfig
21+
build-zsbl-sg2044:
22+
name: Build ZSBL for SG2044
23+
uses: ./.github/workflows/.sophgo-sg204x.zsbl-build.yml
24+
with:
25+
target_name: sophgo-sg2044
26+
zsbl_repo: revyos/zsbl
27+
# Branch sg204x as of 20260227
28+
zsbl_ref: 45054e711d81fbfa1c2167829402d26795199ae7
29+
zsbl_defconfig: sg2044_defconfig
6130

6231
build-opensbi:
6332
name: Build OpenSBI
@@ -216,7 +185,7 @@ jobs:
216185
pack-sdimage-sg2042:
217186
name: Pack SD Card Boot Image for SG2042
218187
needs:
219-
- build-zsbl
188+
- build-zsbl-sg2042
220189
- build-opensbi
221190
- build-u-root
222191
- build-kernel
@@ -230,7 +199,7 @@ jobs:
230199
# - zsbl_target_name: sophgo-sg2044-srd3-10
231200
# opensbi_target_name: sophgo-sg2044
232201
# kernel_target_name: sophgo-sg2044
233-
- zsbl_target_name: sophgo-sg2042-milkv-pioneer
202+
- zsbl_target_name: sophgo-sg2042
234203
opensbi_target_name: sophgo-sg2042
235204
kernel_target_name: sophgo-sg2042
236205
output_filename: firmware-linuxboot-sophgo-sg2042.img

0 commit comments

Comments
 (0)