@@ -157,3 +157,58 @@ jobs:
157157 with :
158158 name : " u-root-sophgo-sg204x"
159159 path : dist
160+
161+ build-kernel :
162+ name : Build Linux Kernel
163+ runs-on : ubuntu-latest
164+ strategy :
165+ matrix :
166+ include :
167+ - target_name : sophgo-sg2044
168+ kernel_repo : revyos/linux
169+ # Branch revyos/6.18.y as of 20260226
170+ kernel_ref : a7aa9547d2b946aee64e68ff46ad0f61196fe798
171+ kernel_defconfig : kexec_defconfig
172+ - target_name : sophgo-sg2042
173+ kernel_repo : revyos/linux
174+ # Branch revyos/6.18.y as of 20260226
175+ kernel_ref : a7aa9547d2b946aee64e68ff46ad0f61196fe798
176+ kernel_defconfig : kexec_defconfig
177+ steps :
178+ - name : Cache Kernel Build
179+ id : cache-kernel-build
180+ uses : actions/cache@v5
181+ with :
182+ path : dist
183+ key : cache-kernel-build-${{ matrix.kernel_repo }}-${{ matrix.kernel_defconfig }}-${{ matrix.kernel_ref }}
184+ - uses : actions/checkout@v5
185+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
186+ - name : Setup Toolchains
187+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
188+ id : setup-gcc-toolchain
189+ uses : ./.github/actions/riscv64-gcc-toolchain
190+ - name : Checkout OpenSBI
191+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
192+ uses : actions/checkout@v6
193+ with :
194+ repository : ${{ matrix.kernel_repo }}
195+ path : linux
196+ # Branch sg204x as of 20260224
197+ ref : ${{ matrix.kernel_ref }}
198+ fetch-depth : 1
199+ - name : Build Kernel
200+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
201+ run : |
202+ make -j"$(nproc)" -C linux O=$(pwd)/build CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} ${{ matrix.kernel_defconfig }}
203+ make -j"$(nproc)" -C linux O=$(pwd)/build CROSS_COMPILE=${{ steps.setup-gcc-toolchain.outputs.full-prefix }} Image dtbs
204+ - name : Collect Kernel Binary
205+ if : ${{ steps.cache-kernel-build.outputs.cache-hit != 'true' }}
206+ run : |
207+ mkdir dist
208+ cp build/arch/riscv/boot/Image dist/riscv64_Image
209+ cp build/arch/riscv/boot/dts/sophgo/*.dtb dist
210+ - name : Upload Artifacts
211+ uses : actions/upload-artifact@v4
212+ with :
213+ name : " kernel-${{ matrix.target_name }}"
214+ path : dist
0 commit comments