diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..09946f7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,68 @@ +name: thead-opensbi + +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: "0 2 * * *" + +env: + xuetie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282 + toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz + ARCH: riscv + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + include: + - name: thead-gcc + toolchain_tripe: riscv64-unknown-linux-gnu- + - name: gcc-12 + toolchain_tripe: riscv64-linux-gnu- + env: + CROSS_COMPILE: ${{ matrix.toolchain_tripe }} + + steps: + - name: Install software + run: | + sudo apt update && \ + sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu cpp-12-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 + sudo update-alternatives --install \ + /usr/bin/riscv64-linux-gnu-gcc riscv64-gcc /usr/bin/riscv64-linux-gnu-gcc-12 10 + sudo update-alternatives --install \ + /usr/bin/riscv64-linux-gnu-g++ riscv64-g++ /usr/bin/riscv64-linux-gnu-g++-12 10 + sudo update-alternatives --install \ + /usr/bin/riscv64-linux-gnu-cpp riscv64-cpp /usr/bin/riscv64-linux-gnu-cpp-12 10 + + - name: Checkout opensbi + uses: actions/checkout@v3 + + - name: Configure toolchains + run: | + mkdir rootfs && mkdir rootfs/boot + wget ${xuetie_toolchain}/${toolchain_file_name} + tar -xvf ${toolchain_file_name} -C /opt + + - name: opensbi compile + run: | + export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH" + mkdir output + + pushd $PWD + make PLATFORM=generic + cp -v build/platform/generic/firmware/fw_dynamic.bin output/ + popd + tree ${GITHUB_WORKSPACE}/output + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: thead-opensbi-${{ matrix.name }} + path: output/fw_dynamic.bin + retention-days: 30 \ No newline at end of file