sophgo-bootloader #318
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | |
env: | |
toolchains_base_url: https://mirror.iscas.ac.cn/revyos/extra/tools/ | |
toolchain_elf_file_name: elf-gcc-2022.08.08.tar.gz | |
toolchain_linux_file_name: linux-gcc-2022.08.08.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 }} | |
ELF_TOOLCHAIN_HOME: /opt/riscv/elf-gcc-2022.08.08/ | |
LINUX_TOOLCHAIN_HOME: /opt/riscv/linux-gcc-2022.08.08/ | |
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 linux-riscv | |
uses: actions/checkout@v4 | |
with: | |
repository: sophgo/linux-riscv | |
path: linux-riscv | |
- 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 | |
update-binfmts --display | |
${wget_alias} ${toolchains_base_url}/${toolchain_elf_file_name} | |
sudo mkdir -p ${ELF_TOOLCHAIN_HOME} | |
sudo tar -xvf ${toolchain_elf_file_name} -C ${ELF_TOOLCHAIN_HOME} | |
${wget_alias} ${toolchains_base_url}/${toolchain_linux_file_name} | |
sudo mkdir -p ${LINUX_TOOLCHAIN_HOME} | |
sudo tar -xvf ${toolchain_linux_file_name} -C ${LINUX_TOOLCHAIN_HOME} | |
- 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 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: Compress Artifact | |
run: | | |
pushd bootloader-riscv | |
source scripts/envsetup.sh | |
pushd $RV_FIRMWARE_INSTALL_DIR | |
# Copy efi directory | |
mkdir -p ~/efi/riscv64 | |
cp $GITHUB_WORKSPACE/bootloader-riscv/firmware/fip.bin ~/efi/ | |
cp zsbl.bin ~/efi/ | |
cp fw_dynamic.bin ~/efi/riscv64 | |
cp riscv64_Image ~/efi/riscv64 | |
cp *.dtb ~/efi/riscv64 | |
cp initrd.img ~/efi/riscv64 | |
# Compress | |
pushd ~/efi/ | |
tar -zcvf $GITHUB_WORKSPACE/sophgo-bootloader-${{ matrix.M_CHIP_NUM }}-`date "+%y%m%d%H%M%S"`.tar.gz . | |
popd | |
popd | |
popd | |
- name: 'Upload Build Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sophgo-bootloader-${{ matrix.M_CHIP_NUM }} | |
path: sophgo-bootloader-${{ matrix.M_CHIP_NUM }}-*.tar.gz | |
retention-days: 10 |