diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000..af174986f303f --- /dev/null +++ b/Jenkinsfile @@ -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 + ''' + } + } + } + } + } +} diff --git a/dev-make b/dev-make new file mode 100755 index 0000000000000..efd829a9c8118 --- /dev/null +++ b/dev-make @@ -0,0 +1,3 @@ +#!/bin/bash + +exec make -f dev.mk "$@" diff --git a/dev-shell b/dev-shell new file mode 100755 index 0000000000000..030143824a132 --- /dev/null +++ b/dev-shell @@ -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 diff --git a/dev.mk b/dev.mk new file mode 100644 index 0000000000000..add613fff9bef --- /dev/null +++ b/dev.mk @@ -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) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000000..ca02d83de24eb --- /dev/null +++ b/docker/Dockerfile @@ -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 +