-
Notifications
You must be signed in to change notification settings - Fork 21
103 lines (87 loc) · 3.85 KB
/
kernel.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
name: revyos-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
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: 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
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
# if [ x"$(cat .config | grep CONFIG_MODULES=y)" = x"CONFIG_MODULES=y" ]; then
# sudo make INSTALL_MOD_PATH=${GITHUB_WORKSPACE}/rootfs/ modules_install -j$(nproc)
# fi
# sudo make INSTALL_PATH=${GITHUB_WORKSPACE}/rootfs/boot install -j$(nproc)
# Copy deb
sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/rootfs/
# build perf & install
# make LDFLAGS=-static NO_LIBELF=1 NO_JVMTI=1 VF=1 -C tools/perf/
# sudo mkdir -p ${GITHUB_WORKSPACE}/rootfs/sbin/
# sudo cp -v tools/perf/perf ${GITHUB_WORKSPACE}/rootfs/sbin/perf-thead
# Install Kernel
# sudo cp -v arch/riscv/boot/Image ${GITHUB_WORKSPACE}/rootfs/boot/
# 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/{light-lpi4a.dtb,light-lpi4a-16gb.dtb} ${GITHUB_WORKSPACE}/rootfs/boot/
popd
- name: compress
run: tar -zcvf thead-kernel-${{ matrix.name }}.tar.gz rootfs
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: thead-kernel-${{ matrix.name }}.tar.gz
path: thead-kernel-${{ matrix.name }}.tar.gz
retention-days: 30