From acdc1db97b4089cf9f9b6d33c034c4ea91d3bca0 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Sat, 23 Sep 2023 08:58:25 +0800 Subject: [PATCH] [NFU] ci: kernel auto build Signed-off-by: Han Gao --- .github/workflows/kernel.yml | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .github/workflows/kernel.yml diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml new file mode 100644 index 00000000000000..1e45f078e94851 --- /dev/null +++ b/.github/workflows/kernel.yml @@ -0,0 +1,113 @@ +name: revyos-mainline-kernel-build + +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 + board: lpi4a + KBUILD_BUILD_USER: builder + KBUILD_BUILD_HOST: revyos-riscv-builder + KDEB_COMPRESS: xz + KDEB_CHANGELOG_DIST: unstable + +jobs: + kernel: + strategy: + fail-fast: false + matrix: + include: + - name: thead-gcc + toolchain_tripe: riscv64-unknown-linux-gnu- + - name: gcc-12 + toolchain_tripe: riscv64-linux-gnu- + + runs-on: ubuntu-22.04 + env: + CROSS_COMPILE: ${{ matrix.toolchain_tripe }} + + steps: + - name: "Update APT sources" + run: | + sudo apt update + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: true + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: Install software + run: | + sudo apt install -y gdisk dosfstools g++-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 \ + devscripts debhelper pahole + 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 + + - name: Checkout kernel + uses: actions/checkout@v3 + with: + path: 'kernel' + + - name: Configure toolchains + run: | + mkdir rootfs && mkdir rootfs/boot + if [ x"${{ matrix.name }}" = x"thead-gcc" ]; then + wget ${xuetie_toolchain}/${toolchain_file_name} + tar -xvf ${toolchain_file_name} -C /opt + fi + + - name: Compile Kernel && Install + run: | + export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH" + + pushd kernel + make revyos_defconfig + export KDEB_PKGVERSION="$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" + #if [ x"${{ matrix.name }}" = x"gcc-12" ]; then + # echo "CONFIG_THEAD_ISA=n" >> .config + #elif [ x"${{ matrix.name }}" = x"thead-gcc" ]; then + # echo "CONFIG_THEAD_ISA=y" >> .config + #fi + make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}" + make -j$(nproc) dtbs + + # Copy deb + sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/rootfs/ + + # record commit-id + git rev-parse HEAD > kernel-commitid + sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/rootfs/boot/ + + # Install DTB + sudo cp -v arch/riscv/boot/dts/thead/*.dtb ${GITHUB_WORKSPACE}/rootfs/boot/ + popd + + - name: compress + run: tar -zcvf thead-mainline-kernel-${{ matrix.name }}.tar.gz rootfs + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: thead-mainline-kernel-${{ matrix.name }}.tar.gz + path: thead-mainline-kernel-${{ matrix.name }}.tar.gz + retention-days: 30