-
Notifications
You must be signed in to change notification settings - Fork 29
144 lines (129 loc) · 5.23 KB
/
th1520.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
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//1705395627867
xt64_toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1-20240115.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
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-5.10.4-glibc-x86_64-V2.8.1/bin:$PATH"
fi
pushd kernel
make 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
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 umount -l mnt
zstd boot-lpi4amain-ci-${TIMESTAMP}.ext4
zstd root-lpi4amain-ci-${TIMESTAMP}.ext4
- name: 'Upload Artifact EMMC'
uses: actions/upload-artifact@v3
with:
retention-days: 30
name: th1520-${{ matrix.name }}
path: |
*.ext4.zst