Skip to content

Commit 05ed687

Browse files
add CI scripts
Signed-off-by: Stephen <[email protected]>
1 parent 2c5a33f commit 05ed687

File tree

5 files changed

+168
-0
lines changed

5 files changed

+168
-0
lines changed

Jenkinsfile

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
properties([
3+
parameters([
4+
string(defaultValue: '100', description: 'RELEASE number', name: 'RELEASE_NUMBER'),
5+
string(defaultValue: 'stable-4.4-rockpis', description: 'RELEASE number', name: 'RELEASE_REPO_BRANCH'),
6+
string(defaultValue: 'rk3308_linux_defconfig', description: 'kernel defconfig', name: 'KERNEL_DEFCONFIG'),
7+
string(defaultValue: 'radxa', description: 'GitHub username or organization', name: 'GITHUB_USER'),
8+
string(defaultValue: 'kernel', description: 'GitHub repository', name: 'GITHUB_REPO'),
9+
])
10+
])
11+
*/
12+
13+
node {
14+
timestamps {
15+
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
16+
stage "Environment"
17+
checkout scm
18+
19+
def environment = docker.build('build-environment:build-kernel', 'docker')
20+
21+
environment.inside("--privileged -u 0:0") {
22+
withEnv([
23+
"USE_CCACHE=true",
24+
"KERNEL_DEFCONFIG=$KERNEL_DEFCONFIG",
25+
"RELEASE_NUMBER=$BUILD_NUMBER",
26+
"RELEASE_REPO_BRANCH=$RELEASE_REPO_BRANCH",
27+
"GITHUB_USER=$GITHUB_USER",
28+
"GITHUB_REPO=$GITHUB_REPO",
29+
]) {
30+
stage ('Environment') {
31+
sh '''#!/bin/bash
32+
set -xe
33+
34+
tar xvf ./gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar -C /usr/local/
35+
'''
36+
}
37+
38+
stage ('Package') {
39+
sh '''#!/bin/bash
40+
set -xe
41+
42+
make distclean
43+
./dev-make kernel-package
44+
'''
45+
}
46+
47+
stage ('Release') {
48+
sh '''#!/bin/bash
49+
set -xe
50+
shopt -s nullglob
51+
52+
export RELEASE_NAME="$(./dev-make version)"
53+
export RELEASE_TITLE="$(./dev-make version)"
54+
export DESCRIPTION=" "
55+
56+
github-release release \
57+
--target ${RELEASE_REPO_BRANCH} \
58+
--tag "${RELEASE_NAME}" \
59+
--name "${RELEASE_TITLE}" \
60+
--description "${DESCRIPTION}" \
61+
--draft
62+
63+
for file in ../*$(./dev-make info)*.deb; do
64+
github-release upload \
65+
--tag "${RELEASE_NAME}" \
66+
--name "$(basename "$file")" \
67+
--file "$file"
68+
done
69+
70+
github-release edit \
71+
--tag "${RELEASE_NAME}" \
72+
--name "${RELEASE_TITLE}" \
73+
--description "${DESCRIPTION}"
74+
75+
rm ../*$(./dev-make info)*.deb
76+
'''
77+
}
78+
}
79+
}
80+
}
81+
}
82+
}

dev-make

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
exec make -f dev.mk "$@"

dev-shell

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
CURDIR="$PWD"
4+
5+
case $(uname -s) in
6+
Linux)
7+
echo "Building Docker environment..."
8+
docker build -q -t build-docker:build-kernel docker/
9+
echo "Enter Docker container..."
10+
exec docker run \
11+
--rm \
12+
-it \
13+
-e HOME -v "${HOME}:${HOME}" \
14+
--privileged \
15+
-h build-env \
16+
-v "${CURDIR}:${CURDIR}" \
17+
-w "${CURDIR}" \
18+
build-docker:build-kernel \
19+
"$@"
20+
;;
21+
22+
*)
23+
echo "Not supported: $(uname -s)"
24+
exit 1
25+
;;
26+
esac

dev.mk

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
RELEASE_NUMBER ?=
2+
KERNEL_DEFCONFIG ?= rk3308_linux_defconfig
3+
4+
KERNEL_VERSION ?= $(shell $(KERNEL_MAKE) -s kernelversion)
5+
KERNEL_RELEASE ?= $(shell $(KERNEL_MAKE) -s kernelrelease)
6+
KDEB_PKGVERSION ?= $(KERNEL_VERSION)-$(RELEASE_NUMBER)-rockchip
7+
8+
KERNEL_MAKE ?= make \
9+
ARCH=arm64 \
10+
CROSS_COMPILE="/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
11+
12+
.config: arch/arm64/configs/$(KERNEL_DEFCONFIG)
13+
$(KERNEL_MAKE) $(KERNEL_DEFCONFIG)
14+
15+
.PHONY: .scmversion
16+
.scmversion:
17+
ifneq (,$(RELEASE_NUMBER))
18+
@echo "-$(RELEASE_NUMBER)-rockchip-g$$(git rev-parse --short HEAD)" > .scmversion
19+
else
20+
@echo "-rockchip-dev" > .scmversion
21+
endif
22+
23+
version:
24+
@echo "$(KDEB_PKGVERSION)"
25+
26+
.PHONY: info
27+
info: .config .scmversion
28+
@echo $(shell cat .scmversion)
29+
30+
.PHONY: kernel-package
31+
kernel-package: .config .scmversion
32+
LOCALVERSION=$(shell cat .scmversion) KDEB_PKGVERSION=$(KDEB_PKGVERSION) $(KERNEL_MAKE) bindeb-pkg -j$$(nproc)

docker/Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:bionic
2+
3+
RUN apt-get update -y && \
4+
apt-get install -y git-core gnupg flex bison gperf build-essential \
5+
zip curl zlib1g-dev libc6-dev-i386 \
6+
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
7+
libgl1-mesa-dev libxml2-utils xsltproc unzip mtools u-boot-tools \
8+
htop iotop sysstat iftop pigz bc device-tree-compiler lunzip \
9+
dosfstools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
10+
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi ccache \
11+
sudo cpio nano vim kmod kpartx wget bsdtar qemu-user-static \
12+
pxz ruby-dev debootstrap multistrap libssl-dev parted \
13+
live-build linaro-image-tools \
14+
apt-utils automake bc binfmt-support bison ca-certificates \
15+
cmake crossbuild-essential-arm64 \
16+
devscripts dh-exec dh-make dpkg-dev fakeroot gdisk git libncurses5 \
17+
libncurses5-dev locales pkg-config pv python python3-dev python-dev \
18+
swig udev apt-transport-https eatmydata e2fsprogs
19+
20+
RUN curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar -C /tmp -jx && \
21+
mv /tmp/bin/linux/amd64/github-release /usr/local/bin/
22+
23+
ENV USER=root \
24+
HOME=/root
25+

0 commit comments

Comments
 (0)