Skip to content

Commit 8279baf

Browse files
committed
sg2042: build sd image
1 parent 677f424 commit 8279baf

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/sophgo-sg204x.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,78 @@ jobs:
212212
with:
213213
name: "kernel-${{ matrix.target_name }}"
214214
path: dist
215+
216+
pack-sdimage-sg2042:
217+
name: Pack SD Card Boot Image for SG2042
218+
needs:
219+
- build-zsbl
220+
- build-opensbi
221+
- build-u-root
222+
- build-kernel
223+
runs-on: ubuntu-latest
224+
strategy:
225+
matrix:
226+
include:
227+
# - zsbl_target_name: sophgo-sg2044-srd3-10
228+
# opensbi_target_name: sophgo-sg2044-rva23
229+
# kernel_target_name: sophgo-sg2044
230+
# - zsbl_target_name: sophgo-sg2044-srd3-10
231+
# opensbi_target_name: sophgo-sg2044
232+
# kernel_target_name: sophgo-sg2044
233+
- zsbl_target_name: sophgo-sg2042-milkv-pioneer
234+
opensbi_target_name: sophgo-sg2042
235+
kernel_target_name: sophgo-sg2042
236+
output_filename: firmware-linuxboot-sophgo-sg2042.img
237+
steps:
238+
- name: Checkout This Repo
239+
uses: actions/checkout@v5
240+
with:
241+
fetch-depth: 1
242+
path: u-boot-build
243+
- name: Setup Work Dirs
244+
run: |
245+
mkdir -p staging/riscv64
246+
mkdir -p dist
247+
- name: Fetch Pre-built ZSBL
248+
uses: actions/download-artifact@v5
249+
with:
250+
name: "zsbl-${{ matrix.zsbl_target_name }}"
251+
path: staging
252+
merge-multiple: true
253+
- name: Copy fip.bin
254+
run: |
255+
cp u-boot-build/sophgo-sg204x/blobs/sg2042/fip.bin staging
256+
- name: Fetch Pre-built OpenSBI
257+
uses: actions/download-artifact@v5
258+
with:
259+
name: "opensbi-${{ matrix.opensbi_target_name }}"
260+
path: staging/riscv64
261+
merge-multiple: true
262+
- name: Fetch Pre-built Kernel
263+
uses: actions/download-artifact@v5
264+
with:
265+
name: "kernel-${{ matrix.kernel_target_name }}"
266+
path: staging/riscv64
267+
merge-multiple: true
268+
- name: Fetch Pre-built u-root
269+
uses: actions/download-artifact@v5
270+
with:
271+
name: "u-root-sophgo-sg204x"
272+
path: staging/riscv64
273+
merge-multiple: true
274+
- name: Create SD Card Image
275+
run: |
276+
truncate -s 128M dist/${{ matrix.output_filename }}
277+
echo "type=c" | sfdisk dist/${{ matrix.output_filename }}
278+
LOOP_DEV="$(sudo losetup -Pf --show dist/${{ matrix.output_filename }})"
279+
sudo mkfs.vfat -n BOOTFIRM "${LOOP_DEV}p1"
280+
TEMP_MNT="$(mktemp -d)"
281+
sudo mount "${LOOP_DEV}p1" "${TEMP_MNT}"
282+
cp -r staging/* "${TEMP_MNT}/"
283+
sudo umount "${TEMP_MNT}"
284+
sudo losetup -d "${LOOP_DEV}"
285+
- name: Upload Artifacts
286+
uses: actions/upload-artifact@v4
287+
with:
288+
name: "${{ matrix.output_filename }}"
289+
path: dist

0 commit comments

Comments
 (0)