File tree Expand file tree Collapse file tree 5 files changed +300
-204
lines changed
Expand file tree Collapse file tree 5 files changed +300
-204
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ workflow_call :
3+ inputs :
4+ target_name :
5+ required : true
6+ type : string
7+ kernel_repo :
8+ required : true
9+ type : string
10+ kernel_ref :
11+ required : true
12+ type : string
13+ kernel_defconfig :
14+ required : true
15+ type : string
16+
17+ jobs :
18+ build-kernel :
19+ name : Build Kernel
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v6
23+ with :
24+ path : ctx
25+ - name : Cache Kernel Build
26+ id : cache-kernel-build
27+ uses : actions/cache@v5
28+ with :
29+ path : dist
30+ key : cache-kernel-build-${{ inputs.target_name }}-ref=${{ inputs.kernel_ref }}-def=${{ inputs.kernel_defconfig }}-wf=${{ hashFiles('ctx/.github/workflows/.sophgo-sg204x.kernel-build.yml') }}
31+ - name : Setup Toolchains
32+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
33+ id : setup-gcc-toolchain
34+ uses : ./ctx/.github/actions/riscv64-gcc-toolchain
35+ - name : Checkout Kernel
36+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
37+ uses : actions/checkout@v6
38+ with :
39+ repository : ${{ inputs.kernel_repo }}
40+ path : linux
41+ ref : ${{ inputs.kernel_ref }}
42+ fetch-depth : 1
43+ - name : Build Kernel
44+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
45+ run : |
46+ make -j"$(nproc)" -C linux O=$(pwd)/build ARCH=riscv CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} ${{ inputs.kernel_defconfig }}
47+ make -j"$(nproc)" -C linux O=$(pwd)/build ARCH=riscv CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} Image dtbs
48+ - name : Collect Kernel Binary
49+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
50+ run : |
51+ mkdir dist
52+ cp build/arch/riscv/boot/Image dist/riscv64_Image
53+ cp build/arch/riscv/boot/dts/sophgo/*.dtb dist
54+ - name : Upload Artifacts
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : " kernel-${{ inputs.target_name }}"
58+ path : dist
Original file line number Diff line number Diff line change 1+ on :
2+ workflow_call :
3+ inputs :
4+ target_name :
5+ required : true
6+ type : string
7+ opensbi_repo :
8+ required : true
9+ type : string
10+ opensbi_ref :
11+ required : true
12+ type : string
13+
14+ jobs :
15+ build-opensbi :
16+ name : Build OpenSBI
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v6
20+ with :
21+ path : ctx
22+ - name : Cache OpenSBI Build
23+ id : cache-opensbi-build
24+ uses : actions/cache@v5
25+ with :
26+ path : dist
27+ key : cache-opensbi-build-${{ inputs.target_name }}-ref=${{ inputs.opensbi_ref }}-wf=${{ hashFiles('ctx/.github/workflows/.sophgo-sg204x.opensbi-build.yml') }}
28+ - name : Setup Toolchains
29+ if : ${{ steps.cache-opensbi-build.outputs.cache-hit != 'true' }}
30+ id : setup-gcc-toolchain
31+ uses : ./ctx/.github/actions/riscv64-gcc-toolchain
32+ - name : Checkout OpenSBI
33+ if : ${{ steps.cache-opensbi-build.outputs.cache-hit != 'true' }}
34+ uses : actions/checkout@v6
35+ with :
36+ repository : ${{ inputs.opensbi_repo }}
37+ path : opensbi
38+ ref : ${{ inputs.opensbi_ref }}
39+ fetch-depth : 1
40+ - name : Build OpenSBI
41+ if : ${{ steps.cache-opensbi-build.outputs.cache-hit != 'true' }}
42+ run : |
43+ make -j"$(nproc)" -C opensbi O=$(pwd)/build CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} PLATFORM=generic FW_PIC=y BUILD_INFO=y
44+ - name : Collect OpenSBI Binary
45+ if : ${{ steps.cache-opensbi-build.outputs.cache-hit != 'true' }}
46+ run : |
47+ mkdir dist
48+ cp build/platform/generic/firmware/fw_dynamic.bin dist/fw_dynamic.bin
49+ - name : Upload Artifacts
50+ uses : actions/upload-artifact@v4
51+ with :
52+ name : " opensbi-${{ inputs.target_name }}"
53+ path : dist
Original file line number Diff line number Diff line change 1+ on :
2+ workflow_call :
3+ inputs :
4+ target_name :
5+ required : true
6+ type : string
7+ u_root_repo :
8+ required : true
9+ type : string
10+ u_root_ref :
11+ required : true
12+ type : string
13+
14+ jobs :
15+ build-u-root :
16+ name : Build u-root
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v6
20+ with :
21+ path : ctx
22+ - name : Cache u-root Build
23+ id : cache-u-root-build
24+ uses : actions/cache@v5
25+ with :
26+ path : dist
27+ key : cache-u-root-build-${{ inputs.target_name }}-ref=${{ inputs.u_root_ref }}-wf=${{ hashFiles('ctx/.github/workflows/.sophgo-sg204x.u-root-build.yml') }}
28+ - name : Setup Golang
29+ if : ${{ steps.cache-u-root-build.outputs.cache-hit != 'true' }}
30+ uses : actions/setup-go@v6
31+ with :
32+ go-version : ' 1.17'
33+ cache : true
34+ - name : Checkout u-root
35+ if : ${{ steps.cache-u-root-build.outputs.cache-hit != 'true' }}
36+ uses : actions/checkout@v6
37+ with :
38+ repository : ${{ inputs.u_root_repo }}
39+ path : u-root
40+ # Branch sg204x-v0.15 as of 20260225
41+ ref : ${{ inputs.u_root_ref }}
42+ fetch-depth : 1
43+ - name : Build u-root
44+ if : ${{ steps.cache-u-root-build.outputs.cache-hit != 'true' }}
45+ working-directory : u-root
46+ run : |
47+ go build
48+ GOOS=linux GOARCH=riscv64 ./u-root -uroot-source . -build bb -uinitcmd="boot" -o initrd.img core boot
49+ - name : Collect u-root Binary
50+ if : ${{ steps.cache-u-root-build.outputs.cache-hit != 'true' }}
51+ run : |
52+ mkdir dist
53+ cp u-root/initrd.img dist/initrd.img
54+ - name : Upload Artifacts
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : " u-root-${{ inputs.target_name }}"
58+ path : dist
Original file line number Diff line number Diff line change 1+ on :
2+ workflow_call :
3+ inputs :
4+ target_name :
5+ required : true
6+ type : string
7+ zsbl_repo :
8+ required : true
9+ type : string
10+ zsbl_ref :
11+ required : true
12+ type : string
13+ zsbl_defconfig :
14+ required : true
15+ type : string
16+
17+ jobs :
18+ build-zsbl :
19+ name : Build ZSBL
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v6
23+ with :
24+ path : ctx
25+ - name : Cache ZSBL Build
26+ id : cache-zsbl-build
27+ uses : actions/cache@v5
28+ with :
29+ path : dist
30+ key : cache-zsbl-build-${{ inputs.target_name }}-ref=${{ inputs.zsbl_ref }}-wf=${{ hashFiles('ctx/.github/workflows/.sophgo-sg204x.zsbl-build.yml') }}
31+ - name : Setup Toolchains
32+ if : ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
33+ id : setup-gcc-toolchain
34+ uses : ./ctx/.github/actions/riscv64-gcc-toolchain
35+ - name : Checkout ZSBL
36+ if : ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
37+ uses : actions/checkout@v6
38+ with :
39+ repository : ${{ inputs.zsbl_repo }}
40+ path : zsbl
41+ ref : ${{ inputs.zsbl_ref }}
42+ fetch-depth : 1
43+ - name : Build ZSBL
44+ if : ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
45+ working-directory : zsbl
46+ run : |
47+ make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} "${{ inputs.zsbl_defconfig }}"
48+ make -j"$(nproc)" CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} USE_LINUX_BOOT=1 zsbl.bin
49+ - name : Collect ZSBL Binary
50+ if : ${{ steps.cache-zsbl-build.outputs.cache-hit != 'true' }}
51+ run : |
52+ mkdir dist
53+ cp zsbl/zsbl.bin dist/zsbl.bin
54+ - name : Upload Artifacts
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : " zsbl-${{ inputs.target_name }}"
58+ path : dist
You can’t perform that action at this time.
0 commit comments