-
Notifications
You must be signed in to change notification settings - Fork 41
146 lines (123 loc) · 4.57 KB
/
build.yml
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
138
139
140
141
142
143
144
145
146
name: sophgo-bootloader
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
jobs:
build-bootloader:
runs-on: ubuntu-22.04
strategy:
matrix:
M_CHIP_NUM: [single, multi]
LINUX_BRANCH: [sg2042-dev, sg2042-dev-6.6]
env:
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.03.01
mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.03.01-nightly.tar.gz
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
ARCH: riscv
KBUILD_BUILD_USER: riscv
KBUILD_BUILD_HOST: riscv-builder
KDEB_COMPRESS: xz
CHIP: mango
CHIP_NUM: ${{ matrix.M_CHIP_NUM }}
BRANCH: ${{ matrix.LINUX_BRANCH }}
TOOLCHAIN_HOME: /opt/riscv/
steps:
- name: Checkout bootloader-riscv
uses: actions/checkout@v4
with:
path: bootloader-riscv
- name: Checkout zsbl
uses: actions/checkout@v4
with:
repository: sophgo/zsbl
path: zsbl
- name: Checkout opensbi
uses: actions/checkout@v4
with:
repository: sophgo/opensbi
path: opensbi
- name: Checkout sophgo-edk2
uses: actions/checkout@v4
with:
repository: sophgo/sophgo-edk2
path: sophgo-edk2
- name: Checkout linux-riscv
uses: actions/checkout@v4
with:
repository: sophgo/linux-riscv
path: linux-riscv
ref: ${{ matrix.LINUX_BRANCH }}
- uses: actions/setup-go@v5
with:
go-version: '1.21.13'
- run: go version
- name: Install software
run: |
sudo apt update && \
sudo apt install -y gdisk dosfstools g++-riscv64-linux-gnu build-essential \
libncurses-dev gawk flex bison openssl libssl-dev tree \
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf \
device-tree-compiler xz-utils \
qemu binfmt-support qemu-user-static curl wget \
automake autotools-dev python3 libmpc-dev libmpfr-dev libgmp-dev \
texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev \
ninja-build uuid-dev gcc-riscv64-unknown-elf
update-binfmts --display
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
tar -xvf ${mainline_toolchain_file_name} -C /opt
- name: prepare
run: mkdir -p artifact
- name: Compile zsbl & sbi
run: |
pushd bootloader-riscv
source scripts/envsetup.sh
# fix build variable in github action
source scripts/github_env.sh
build_rv_zsbl
build_rv_sbi
popd
- name: Compile edk2
run: |
pushd bootloader-riscv
source scripts/envsetup.sh
# fix build variable in github action
source scripts/github_env.sh
build_rv_edk2
popd
- name: Compile kernel
run: |
pushd bootloader-riscv
source scripts/envsetup.sh
# fix build variable in github action
source scripts/github_env.sh
build_rv_kernel
popd
- name: Compile u-root
run: |
pushd bootloader-riscv
source scripts/envsetup.sh
# fix build variable in github action
source scripts/github_env.sh
build_rv_uroot
popd
- name: Packege firmware
run: |
pushd bootloader-riscv
source scripts/envsetup.sh
# fix build variable in github action
source scripts/github_env.sh
build_rv_firmware_bin
build_rv_firmware_image
mkdir ~/firmware_artifact
cp -v $RV_FIRMWARE_INSTALL_DIR/firmware*.bin $GITHUB_WORKSPACE/firmware_${CHIP_NUM}_${BRANCH}.bin
cp -v $RV_FIRMWARE_INSTALL_DIR/firmware.img $GITHUB_WORKSPACE/firmware_${CHIP_NUM}_${BRANCH}.img
popd
- name: 'Upload Build Artifact'
uses: actions/upload-artifact@v3
with:
name: sophgo-bootloader-${{ matrix.M_CHIP_NUM }}-${{ matrix.LINUX_BRANCH }}
path: firmware_*
retention-days: 30