Skip to content

Commit

Permalink
add CI scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen <[email protected]>
  • Loading branch information
StephenInVamrs committed Jul 15, 2019
1 parent 2c5a33f commit 05ed687
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 0 deletions.
82 changes: 82 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
properties([
parameters([
string(defaultValue: '100', description: 'RELEASE number', name: 'RELEASE_NUMBER'),
string(defaultValue: 'stable-4.4-rockpis', description: 'RELEASE number', name: 'RELEASE_REPO_BRANCH'),
string(defaultValue: 'rk3308_linux_defconfig', description: 'kernel defconfig', name: 'KERNEL_DEFCONFIG'),
string(defaultValue: 'radxa', description: 'GitHub username or organization', name: 'GITHUB_USER'),
string(defaultValue: 'kernel', description: 'GitHub repository', name: 'GITHUB_REPO'),
])
])
*/

node {
timestamps {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
stage "Environment"
checkout scm

def environment = docker.build('build-environment:build-kernel', 'docker')

environment.inside("--privileged -u 0:0") {
withEnv([
"USE_CCACHE=true",
"KERNEL_DEFCONFIG=$KERNEL_DEFCONFIG",
"RELEASE_NUMBER=$BUILD_NUMBER",
"RELEASE_REPO_BRANCH=$RELEASE_REPO_BRANCH",
"GITHUB_USER=$GITHUB_USER",
"GITHUB_REPO=$GITHUB_REPO",
]) {
stage ('Environment') {
sh '''#!/bin/bash
set -xe
tar xvf ./gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar -C /usr/local/
'''
}

stage ('Package') {
sh '''#!/bin/bash
set -xe
make distclean
./dev-make kernel-package
'''
}

stage ('Release') {
sh '''#!/bin/bash
set -xe
shopt -s nullglob
export RELEASE_NAME="$(./dev-make version)"
export RELEASE_TITLE="$(./dev-make version)"
export DESCRIPTION=" "
github-release release \
--target ${RELEASE_REPO_BRANCH} \
--tag "${RELEASE_NAME}" \
--name "${RELEASE_TITLE}" \
--description "${DESCRIPTION}" \
--draft
for file in ../*$(./dev-make info)*.deb; do
github-release upload \
--tag "${RELEASE_NAME}" \
--name "$(basename "$file")" \
--file "$file"
done
github-release edit \
--tag "${RELEASE_NAME}" \
--name "${RELEASE_TITLE}" \
--description "${DESCRIPTION}"
rm ../*$(./dev-make info)*.deb
'''
}
}
}
}
}
}
3 changes: 3 additions & 0 deletions dev-make
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec make -f dev.mk "$@"
26 changes: 26 additions & 0 deletions dev-shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

CURDIR="$PWD"

case $(uname -s) in
Linux)
echo "Building Docker environment..."
docker build -q -t build-docker:build-kernel docker/
echo "Enter Docker container..."
exec docker run \
--rm \
-it \
-e HOME -v "${HOME}:${HOME}" \
--privileged \
-h build-env \
-v "${CURDIR}:${CURDIR}" \
-w "${CURDIR}" \
build-docker:build-kernel \
"$@"
;;

*)
echo "Not supported: $(uname -s)"
exit 1
;;
esac
32 changes: 32 additions & 0 deletions dev.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
RELEASE_NUMBER ?=
KERNEL_DEFCONFIG ?= rk3308_linux_defconfig

KERNEL_VERSION ?= $(shell $(KERNEL_MAKE) -s kernelversion)
KERNEL_RELEASE ?= $(shell $(KERNEL_MAKE) -s kernelrelease)
KDEB_PKGVERSION ?= $(KERNEL_VERSION)-$(RELEASE_NUMBER)-rockchip

KERNEL_MAKE ?= make \
ARCH=arm64 \
CROSS_COMPILE="/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"

.config: arch/arm64/configs/$(KERNEL_DEFCONFIG)
$(KERNEL_MAKE) $(KERNEL_DEFCONFIG)

.PHONY: .scmversion
.scmversion:
ifneq (,$(RELEASE_NUMBER))
@echo "-$(RELEASE_NUMBER)-rockchip-g$$(git rev-parse --short HEAD)" > .scmversion
else
@echo "-rockchip-dev" > .scmversion
endif

version:
@echo "$(KDEB_PKGVERSION)"

.PHONY: info
info: .config .scmversion
@echo $(shell cat .scmversion)

.PHONY: kernel-package
kernel-package: .config .scmversion
LOCALVERSION=$(shell cat .scmversion) KDEB_PKGVERSION=$(KDEB_PKGVERSION) $(KERNEL_MAKE) bindeb-pkg -j$$(nproc)
25 changes: 25 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:bionic

RUN apt-get update -y && \
apt-get install -y git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip mtools u-boot-tools \
htop iotop sysstat iftop pigz bc device-tree-compiler lunzip \
dosfstools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi ccache \
sudo cpio nano vim kmod kpartx wget bsdtar qemu-user-static \
pxz ruby-dev debootstrap multistrap libssl-dev parted \
live-build linaro-image-tools \
apt-utils automake bc binfmt-support bison ca-certificates \
cmake crossbuild-essential-arm64 \
devscripts dh-exec dh-make dpkg-dev fakeroot gdisk git libncurses5 \
libncurses5-dev locales pkg-config pv python python3-dev python-dev \
swig udev apt-transport-https eatmydata e2fsprogs

RUN curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar -C /tmp -jx && \
mv /tmp/bin/linux/amd64/github-release /usr/local/bin/

ENV USER=root \
HOME=/root

0 comments on commit 05ed687

Please sign in to comment.