Skip to content

drivers: k230: Add rtc driver #841

drivers: k230: Add rtc driver

drivers: k230: Add rtc driver #841

Workflow file for this run

name: xuantie-kernel-ci
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
env:
xt64_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1715148262346
xt64_toolchain_file_name: Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V2.10.0-20240419.tar.gz
rv32_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12
rv32_toolchain_file_name: riscv32-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
rv64_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12
rv64_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
rv64ilp32_toolchain: https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases/download/2024.03.08
rv64ilp32_toolchain_file_name: riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.03.08-nightly.tar.gz
jobs:
kernel-build:
strategy:
fail-fast: false
matrix:
include:
# RV64
- name: linux-64lp64-upstream
toolchain_variant: rv64_toolchain
toolchain_prefix: riscv64-unknown-linux-gnu-
config: defconfig
- name: linux-64lp64-xuantie
toolchain_variant: rv64_toolchain
toolchain_prefix: riscv64-unknown-linux-gnu-
config: defconfig
- name: linux-64lp64-test
toolchain_variant: rv64_toolchain
toolchain_prefix: riscv64-unknown-linux-gnu-
config: defconfig
# RV32
- name: linux-32ilp32-upstream
toolchain_variant: rv32_toolchain
toolchain_prefix: riscv32-unknown-linux-gnu-
config: rv32_defconfig
- name: linux-32ilp32-xuantie
toolchain_variant: rv32_toolchain
toolchain_prefix: riscv32-unknown-linux-gnu-
config: rv32_defconfig
- name: linux-32ilp32-test
toolchain_variant: rv32_toolchain
toolchain_prefix: riscv32-unknown-linux-gnu-
config: rv32_defconfig
# 64ilp32
- name: linux-64ilp32-sv39
toolchain_variant: rv64ilp32_toolchain
toolchain_prefix: riscv64-unknown-elf-
config: rv64ilp32_defconfig
- name: linux-64ilp32-sv32xt
toolchain_variant: rv64ilp32_toolchain
toolchain_prefix: riscv64-unknown-elf-
config: rv64ilp32_defconfig
- name: linux-64ilp32-test
toolchain_variant: rv64ilp32_toolchain
toolchain_prefix: riscv64-unknown-elf-
config: rv64ilp32_defconfig
runs-on: ubuntu-22.04
env:
CROSS_COMPILE: ${{ matrix.toolchain_prefix }}
steps:
- name: Install software
run: |
sudo apt update && \
sudo apt install -y build-essential
- name: Checkout source
uses: actions/checkout@v4
- name: Configure toolchains
run: |
if [ x"${{ matrix.toolchain_variant }}" = x"rv32_toolchain" ]; then
wget -qc ${rv32_toolchain}/${rv32_toolchain_file_name}
tar -xvf ${rv32_toolchain_file_name} -C /opt
rm -v ${rv32_toolchain_file_name}
fi
if [ x"${{ matrix.toolchain_variant }}" = x"rv64_toolchain" ]; then
wget -qc ${rv64_toolchain}/${rv64_toolchain_file_name}
tar -xvf ${rv64_toolchain_file_name} -C /opt
rm -v ${rv64_toolchain_file_name}
fi
if [ x"${{ matrix.toolchain_variant }}" = x"rv64ilp32_toolchain" ]; then
wget -qc ${rv64ilp32_toolchain}/${rv64ilp32_toolchain_file_name}
tar -xvf ${rv64ilp32_toolchain_file_name} -C /opt
rm -v ${rv64ilp32_toolchain_file_name}
fi
# while building upstream version, remove local source, use upstream version
- name: Set Upstream Source
run: |
if [ x"${{ matrix.name }}" = x"linux-32ilp32-upstream" ] || [ x"${{ matrix.name }}" = x"linux-64lp64-upstream" ] ; then
cd ..
wget -qc https://github.com/torvalds/linux/archive/ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
tar zxf ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
cp linux-xuantie-kernel/arch/riscv/configs/defconfig linux-ffc253263a1375a65fa6c9f62a893e9767fbebfa/arch/riscv/configs/defconfig
rm -rf linux-xuantie-kernel
mv linux-ffc253263a1375a65fa6c9f62a893e9767fbebfa linux-xuantie-kernel
cd linux-xuantie-kernel
fi
# patch defconfig and compile kernel source
- name: Compile Kernel
run: |
export PATH="/opt/riscv/bin:$PATH"
if [ x"${{ matrix.name }}" = x"linux-64lp64-test" ] || [ x"${{ matrix.name }}" = x"linux-32ilp32-test" ] ; then
scripts/kconfig/merge_config.sh -m arch/riscv/configs/${{ matrix.config }} .github/kernel_fragments/ftrace.fragment
mv .config arch/riscv/configs/${{ matrix.config }}
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32-sv32xt" ]; then
echo CONFIG_MMU_SV32=y >> arch/riscv/configs/64ilp32.config
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32-test" ] ; then
scripts/kconfig/merge_config.sh -m arch/riscv/configs/64ilp32.config .github/kernel_fragments/ftrace.fragment
mv .config arch/riscv/configs/64ilp32.config
fi
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g ${{ matrix.config }} all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
- name: Packaging Tarball
run: |
if [ -d .git ] ; then
git log --oneline -500 > git.log
else
touch git.log
fi
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install gdbmacros.txt git.log .config
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.tar.gz
path: ${{ matrix.name }}.tar.gz
retention-days: 90
xt-qemu-64lp64:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/xuantie-qemu:latest
strategy:
fail-fast: false
matrix:
cpu: [ c906fdv , c907fdvm-rv64 , c908v , c920 , c920v2]
kernel: [ linux-64lp64-upstream , linux-64lp64-xuantie , linux-64lp64-test]
include:
- core_count: 4
- cpu: c906fdv
core_count: 1
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs opensbi and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv64.ext2.tar.gz
tar -xvf rootfs_rv64.ext2.tar.gz
wget -qc https://github.com/riscv-software-src/opensbi/releases/download/v1.4/opensbi-1.4-rv-bin.tar.xz
xz -d opensbi-1.4-rv-bin.tar.xz
tar -xvf opensbi-1.4-rv-bin.tar
mv opensbi-1.4-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin .
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: |
qemu-system-riscv64 -cpu ${{ matrix.cpu }} -nographic -smp ${{ matrix.core_count }} -M virt -bios ./fw_dynamic.bin -kernel ./Image -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv64.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
xt-qemu-32ilp32:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/xuantie-qemu:latest
strategy:
fail-fast: false
matrix:
cpu: [ c907fdvm-rv32 ]
kernel: [ linux-32ilp32-upstream , linux-32ilp32-xuantie , linux-32ilp32-test ]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs opensbi and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv32.ext2.tar.gz
tar -xvf rootfs_rv32.ext2.tar.gz
wget -qc https://github.com/riscv-software-src/opensbi/releases/download/v1.4/opensbi-1.4-rv-bin.tar.xz
xz -d opensbi-1.4-rv-bin.tar.xz
tar -xvf opensbi-1.4-rv-bin.tar
mv opensbi-1.4-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin .
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: qemu-system-riscv32 -cpu ${{ matrix.cpu }} -nographic -smp 4 -M virt -bios ./fw_dynamic.bin -kernel ./Image -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv32.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,50,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
ruyi-qemu-64ilp32:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/ruyi-toolchain:latest
strategy:
fail-fast: false
matrix:
variant: [ Image ]
kernel: [ linux-64ilp32-sv39 , linux-64ilp32-test ]
include:
- cpu: rv64
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv32.ext2.tar.gz
tar -xvf rootfs_rv32.ext2.tar.gz
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: qemu-system-riscv64 -cpu ${{ matrix.cpu }} -nographic -smp 4 -M virt -kernel ./${{ matrix.variant }} -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv32.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,50,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
checkpatch:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: 'Calculate PR commits + 1'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Run checkpatch review
uses: webispy/checkpatch-action@v9