-
Notifications
You must be signed in to change notification settings - Fork 26
164 lines (152 loc) · 6.45 KB
/
k230.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: k230-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
rv64ilp32_toolchain: https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases/download/2024.06.25
rv64ilp32_toolchain_file_name: riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.06.25-nightly.tar.gz
ARCH: riscv
KBUILD_BUILD_USER: builder
KBUILD_BUILD_HOST: ci-riscv-builder
KDEB_COMPRESS: none
KDEB_CHANGELOG_DIST: unstable
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-
- name: linux-64ilp32
toolchain_tripe: riscv64-unknown-elf-
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
if [ x"${{ matrix.name }}" = x"linux-64ilp32" ]; then
wget ${rv64ilp32_toolchain}/${rv64ilp32_toolchain_file_name}
tar -xvf ${rv64ilp32_toolchain_file_name} -C /opt
rm -v ${rv64ilp32_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
if [ x"${{ matrix.name }}" = x"linux-64ilp32" ]; then
export PATH="/opt/riscv/bin:$PATH"
fi
pushd kernel
make k230_defconfig
if [ x"${{ matrix.name }}" = x"linux-64ilp32" ]; then
rm .config
make k230_defconfig 64ilp32.config
fi
make -j$(nproc)
make INSTALL_MOD_PATH=./modules_install modules_install
make INSTALL_HDR_PATH=./headers_install headers_install
cp -vf arch/riscv/boot/dts/canaan/*.dtb ./
cp -vf arch/riscv/boot/Image ./
cp -vf Documentation/admin-guide/kdump/gdbmacros.txt ./
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install gdbmacros.txt *.dtb
cp -vf ${{ matrix.name }}.tar.gz ${GITHUB_WORKSPACE}/artifact
cp -vf arch/riscv/boot/Image ${GITHUB_WORKSPACE}/artifact
cp -vf arch/riscv/boot/dts/canaan/*.dtb ${GITHUB_WORKSPACE}/artifact
popd
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: k230-${{ matrix.name }}.tar.gz
path: artifact/*
retention-days: 90
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, k230d]
needs: [
kernel
]
if: ${{ always() && !cancelled() && needs.kernel.result == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: k230-linux-64ilp32.tar.gz
path: k230-linux-64ilp32
- name: 'Prepare files'
run: |
cp /opt/CI-tools/k230-ci/fw_dynamic.bin k230-linux-64ilp32/
cp /opt/CI-tools/k230-ci/gdbinit k230-linux-64ilp32/
- name: 'List all downloaded files'
run: ls -R $GITHUB_WORKSPACE
- name: 'test kernel'
run: |
export PATH="/opt/Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V2.10.0/bin:$PATH"
cd k230-linux-64ilp32
init_cp2112.sh
# reset board -> intercept uboot -> start debug server -> load kernel using gdb
# --push reset key to reset--
board_reset.sh
# --intercept uboot--
intercept_uboot.sh /dev/ttyACM1
# --start debug server--
DebugServerConsole > /dev/null 2>&1 &
echo "debug server started"
# --load kernel using gdb--
riscv64-unknown-linux-gnu-gdb -ex "target remote 127.0.0.1:1026" -ex "reset" -ex "reset" -x gdbinit > /dev/null 2>&1 &
echo "gdb started"
# --wait (print serial log will be better)--
# sleep 60
print_kernel_load_log.sh /dev/ttyACM1
# --run command to check kernel--
check_kernel.sh /dev/ttyACM1
cd ..
- name: 'Cleanup'
if: always()
run: |
# killall remaining processes
killall DebugServerConsole.elf > /dev/null 2>&1 || true
killall riscv64-unknown-linux-gnu-gdb > /dev/null 2>&1 || true
# Remove all hidden files that have a dot as first character, including the .git folder
rm -rf ./.??*
rm -rfv ./k230-linux-64ilp32.tar.gz
rm -rfv ./k230-linux-64ilp32