th1520-build #117
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: th1520-build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 3 * * *" | |
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 | |
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 | |
ARCH: riscv | |
KBUILD_BUILD_USER: builder | |
KBUILD_BUILD_HOST: ci-riscv-builder | |
KDEB_COMPRESS: none | |
KDEB_CHANGELOG_DIST: unstable | |
TH1520_IMAGE_BASE_URL: https://mirror.iscas.ac.cn/revyos/extra/images/lpi4amain | |
TH1520_IMAGE_DATE: 20240127 | |
TH1520_BOOT: boot-lpi4amain-20240127_105111.ext4.zst | |
TH1520_ROOT: root-lpi4amain-20240127_105111.ext4.zst | |
TH1520_UBOOT_BASE_URL: https://github.com/revyos/thead-u-boot/releases/download/20240529/ | |
TH1520_UBOOT: u-boot-with-spl-lpi4a-main.bin | |
jobs: | |
kernel: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linux-64lp64-xt | |
toolchain_tripe: riscv64-unknown-linux-gnu- | |
- name: linux-64lp64 | |
toolchain_tripe: riscv64-unknown-linux-gnu- | |
runs-on: ubuntu-22.04 | |
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 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 qemu-user-static binfmt-support zstd ninja-build wget | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
path: 'kernel' | |
- name: Configure toolchains | |
run: | | |
if [ x"${{ matrix.name }}" = x"linux-64lp64" ]; then | |
wget ${rv64_toolchain}/${rv64_toolchain_file_name} | |
tar -xvf ${rv64_toolchain_file_name} -C /opt | |
rm -v ${rv64_toolchain_file_name} | |
fi | |
if [ x"${{ matrix.name }}" = x"linux-64lp64-xt" ]; then | |
wget ${xt64_toolchain}/${xt64_toolchain_file_name} | |
tar -xvf ${xt64_toolchain_file_name} -C /opt | |
rm -v ${xt64_toolchain_file_name} | |
fi | |
- name: Compile | |
run: | | |
mkdir artifact | |
if [ x"${{ matrix.name }}" = x"linux-64lp64" ]; then | |
export PATH="/opt/riscv/bin:$PATH" | |
fi | |
if [ x"${{ matrix.name }}" = x"linux-64lp64-xt" ]; then | |
export PATH="/opt/Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V2.10.0/bin:$PATH" | |
fi | |
pushd kernel | |
make th1520_defconfig | |
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" | |
make -j$(nproc) bindeb-pkg | |
dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/artifact | |
popd | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.name }}.tar.gz | |
path: artifact/* | |
retention-days: 90 | |
- name: Checkout qemu | |
uses: actions/checkout@v4 | |
with: | |
repository: revyos/qemu | |
path: qemu | |
ref: ab8f84892a89feea60f1bb24432ff58ce6d2885c # TODO: remove this line | |
- name: build qemu | |
run: | | |
pushd qemu | |
./configure \ | |
--prefix=$HOME/qemu-install \ | |
--static \ | |
--target-list=riscv64-linux-user \ | |
--disable-system \ | |
--disable-pie \ | |
--interp-prefix=/etc/qemu-binfmt/%M | |
make -j$(nproc) | |
make install | |
sudo cp -fv $HOME/qemu-install/bin/qemu-riscv64 /usr/bin/qemu-riscv64-static | |
popd | |
ls -al /usr/bin/qemu-riscv64-static | |
sudo dpkg-reconfigure binfmt-support | |
- name: Download th1520 boot/root | |
run: | | |
wget ${TH1520_IMAGE_BASE_URL}/${TH1520_IMAGE_DATE}/${TH1520_BOOT} | |
wget ${TH1520_IMAGE_BASE_URL}/${TH1520_IMAGE_DATE}/${TH1520_ROOT} | |
- name: Reconfigure th1520 boot/root | |
run: | | |
export TIMESTAMP=$(date +%Y%m%d-%H%M%S) | |
zstd -d ${TH1520_BOOT} | |
mv boot*.ext4 boot-lpi4amain-ci-${TIMESTAMP}.ext4 | |
zstd -d ${TH1520_ROOT} | |
mv root*.ext4 root-lpi4amain-ci-${TIMESTAMP}.ext4 | |
rm -rf ${TH1520_BOOT} ${TH1520_ROOT} | |
mkdir -p mnt | |
sudo mount root-lpi4amain-ci-${TIMESTAMP}.ext4 mnt | |
sudo mount boot-lpi4amain-ci-${TIMESTAMP}.ext4 mnt/boot | |
# sdk 1.5.4 rootfs in mmcblk0p4 | |
sudo sed -i 's/mmcblk0p3/mmcblk0p4/g' mnt/etc/fstab | |
sudo sed -i 's/mmcblk0p3/mmcblk0p4/g' mnt/etc/default/u-boot | |
sudo chroot mnt sh -c "echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config" | |
sudo chroot mnt sh -c "echo root:root | chpasswd" | |
sudo chroot mnt sh -c 'apt remove -y linux-image* linux-headers*' | |
sudo dcmd cp -v ${GITHUB_WORKSPACE}/artifact/*.changes mnt/root | |
sudo chroot mnt sh -c 'dpkg -i /root/*.deb' | |
sudo chroot mnt sh -c 'apt update && apt dist-upgrade -y' | |
# Add preinstalled software | |
sudo chroot mnt sh -c 'apt install -y cpufrequtils python3-ruamel.yaml iperf firmware-realtek' | |
sudo umount -l mnt | |
zstd boot-lpi4amain-ci-${TIMESTAMP}.ext4 | |
zstd root-lpi4amain-ci-${TIMESTAMP}.ext4 | |
- name: 'Upload Artifact EMMC' | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 30 | |
name: th1520-${{ matrix.name }} | |
path: | | |
*.ext4.zst | |
test: | |
# env needed on target system: | |
# DUT_SERIAL: /dev/tty[device] | |
# DUT_IP: IP for th1520 board | |
# PC_IP: IP for host machine | |
runs-on: [self-hosted, th1520] | |
needs: [ | |
kernel | |
] | |
if: ${{ always() && !cancelled() && needs.kernel.result == 'success' }} | |
steps: | |
- name: 'Download artifact' | |
uses: actions/download-artifact@v4 | |
with: | |
name: th1520-linux-64lp64-xt | |
path: th1520-linux-64lp64-xt | |
- name: Download th1520 u-boot | |
run: | | |
wget ${TH1520_UBOOT_BASE_URL}/${TH1520_UBOOT} | |
- name: 'List all downloaded files' | |
run: ls -R $GITHUB_WORKSPACE | |
- name: Decompress image files | |
run: | | |
#zstd -df ./th1520-linux-64lp64/*.zst | |
zstd -df ./th1520-linux-64lp64-xt/*.zst | |
- name: 'Burn images into board' | |
run: | | |
init_cp2112.sh | |
# hold boot -> press reset -> flash uboot to ram -> fastboot reboot -> flash uboot,root,boot | |
# --hold boot key and reset-- | |
board_reset_to_boot.sh | |
# --flash u-boot-- | |
fastboot flash ram ${TH1520_UBOOT} | |
# --reset board-- | |
sleep 2 | |
fastboot reboot | |
# --flash root & boot-- | |
fastboot flash uboot ${TH1520_UBOOT} | |
sleep 2 | |
fastboot flash boot ./th1520-linux-64lp64-xt/boot*.ext4 | |
fastboot flash root ./th1520-linux-64lp64-xt/root*.ext4 | |
# --reset board-- | |
board_reset.sh | |
- name: 'Set up board' | |
run: | | |
sleep 90s | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
kermit_script.sh $DUT_SERIAL $DUT_IP | |
- name: 'Run CPU test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_multicore_cpu_coremark | |
xtbsptest --run test_multicore_cpu_dhrystone | |
xtbsptest --run test_multicore_cpu_task_affinity | |
- name: 'Run Ethernet test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_ethernet_as_server_TCP | |
xtbsptest --run test_ethernet_as_server_UDP | |
xtbsptest --run test_ethernet_as_client_TCP | |
xtbsptest --run test_ethernet_as_client_UDP | |
xtbsptest --run test_ethernet_ipv6 | |
xtbsptest --run test_ethernet_mac | |
- name: 'Run Memory test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_memtester_16M_1 | |
- name: 'Run eMMC test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_eMMC_func_blocklevel_dd_write | |
xtbsptest --run test_eMMC_func_blocklevel_dd_read | |
- name: 'Run RTC test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_generic_rtc_probe | |
xtbsptest --run test_generic_rtc_alarm | |
- name: 'Run CPUFreq test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test_cpufreq_freq_1500000 | |
- name: 'Run Audio test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test__audio__hw__audio8k16b1c_sle__10 | |
xtbsptest --run test__audio__hw__rx__ac8k16b1c_sle | |
- name: 'Run Video Out test' | |
run: | | |
source ~/.venv/bin/activate | |
source /opt/linux-xuantie-kernel-CI/env_setup.source | |
xtbsptest --update_config --dut_ser /dev/ttyUSB0 --dut_ip $DUT_IP --dut_login root --dut_password root | |
xtbsptest --run test____dsi0__800x1280_66d03__pri_800x1280_XR12____tiles_smpte | |
xtbsptest --run test____hdmi__1920x1080_60__pri_1920x1080_XR12____tiles | |
- name: 'Cleanup folder' | |
if: always() | |
run: | | |
# Remove all hidden files that have a dot as first character, including the .git folder | |
rm -rf ./.??* | |
#rm -rfv ./th1520-linux-64lp64 | |
rm -rfv ./th1520-linux-64lp64-xt | |
rm -f ${TH1520_UBOOT} |