diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3df56c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +.git/ +.repo/ +app/ +buildroot/ +debian/ +device/ +docs/ +external/ +kernel/ +npu/ +prebuilts/ +rkbin/ +tools/ +u-boot/ +linux-u-boot/ +linux-kernel/ +linux-build/ diff --git a/.jenkinsignore b/.jenkinsignore new file mode 100644 index 0000000..d79d394 --- /dev/null +++ b/.jenkinsignore @@ -0,0 +1,7 @@ +rockpro64_3399v7.1/ +.repo/ +ccache/ +kernel/ +u-boot/ +rkbin/ +arm-trusted-firmware/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7f4c316 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +FROM amd64/ubuntu:focal + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update -y && \ + apt-get install -y python git-core gnupg flex bison gperf build-essential \ + zip curl zlib1g-dev libc6-dev-i386 rsync \ + lib32ncurses5-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 libarchive-tools qemu-user-static \ + xz-utils ruby-dev debootstrap multistrap libssl-dev parted \ + live-build jq locales \ + gawk swig libpython2-dev libusb-1.0-0-dev \ + pkg-config autoconf golang-go \ + python3-distutils python3-dev \ + openjdk-8-jdk \ + eatmydata && \ + apt-get autoclean + +RUN locale-gen en_US.UTF-8 + +ENV LANG=en_US.UTF-8 \ + LANGUAGE=en_US:en \ + LC_ALL=en_US.UTF-8 \ + USER=root \ + HOME=/root + +RUN git config --global user.email "you@rock64" && \ + git config --global user.name "ROCK64 Shell" + +RUN gem install fpm + +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/ + +RUN which github-release +RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && \ + chmod +x /usr/local/bin/repo + +RUN git clone https://github.com/rockchip-linux/rkflashtool && \ + make -C rkflashtool install && \ + rm -rf rkflashtool + +RUN git clone https://github.com/rockchip-linux/rkdeveloptool && \ + cd rkdeveloptool && \ + autoreconf -i && \ + ./configure && \ + make install && \ + cd .. && \ + rm -rf rkdeveloptool + +RUN ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ +ENV LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib:$LD_LIBRARY_PATH + +# Enable passwordless sudo for users under the "sudo" group +RUN sed -i -e \ + 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \ + /etc/sudoers diff --git a/Jenkinsfile b/Jenkinsfile index 5b29635..cd15f18 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,103 +1,92 @@ -/** -properties([ - parameters([ - string(defaultValue: '1.0', description: 'Current version number', name: 'VERSION'), - text(defaultValue: '', description: 'A list of changes', name: 'CHANGES'), - choice(choices: 'all\njessie-minimal-rock64\njessie-openmediavault-rock64\nstretch-minimal-rock64\nxenial-i3-rock64\nxenial-mate-rock64\nxenial-minimal-rock64\nlinux-virtual', description: 'What makefile image to target', name: 'MAKE_TARGET') - booleanParam(defaultValue: true, description: 'Whether to upload to Github for release or not', name: 'GITHUB_UPLOAD'), - booleanParam(defaultValue: false, description: 'If build should be marked as pre-release', name: 'GITHUB_PRERELEASE'), - string(defaultValue: 'rock64 rockpro64', description: 'Board targets', name: 'BOARD_TARGETs'), - string(defaultValue: 'ayufan-rock64', description: 'GitHub username or organization', name: 'GITHUB_USER'), - string(defaultValue: 'linux-build', description: 'GitHub repository', name: 'GITHUB_REPO'), - ]) -]) -*/ +pipeline { + + + + + agent { label 'master' } + parameters { + + choice(name: 'TFC_PART_NUMBER_TO_BUILD',choices: 'tfc_j9500mtwx50tc_01a\nnextpart#',description: 'Which TFC Part to build') + booleanParam(defaultValue: false, description: 'Clone All Repositories', name: 'CLONE') + booleanParam(defaultValue: true, description: 'Build U-Boot', name: 'U_BOOT') + booleanParam(defaultValue: true, description: 'Build Kernel', name: 'Kernel') + choice(name: 'MAKE_TARGET' ,choices: 'buster-mate-arm64\nlinux-virtual', description: 'What makefile image to target') + choice(name: 'BOARD_TARGET' ,choices: 'rockpro64\nrockpro', description: 'What board to build') + string(defaultValue: '1.0', description: 'Current version number', name: 'VERSION') + text(defaultValue: '', description: 'A list of changes', name: 'CHANGES') + string(defaultValue: 'rockpro64', description: 'Board target', name: 'BOARD_TARGETs') + string(defaultValue: 'ThreeFiveDisplays-RockPro64', description: 'GitHub username or organization', name: 'GITHUB_USER') + string(defaultValue: 'linux-build', description: 'GitHub repository', name: 'GITHUB_REPO') + } + stages { + stage('display') { + steps { + echo "Setting Parameters" + } + } +} +} node('docker && linux-build') { timestamps { wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) { stage('Environment') { checkout scm - - def environment = docker.image('ayufan/rock64-dockerfiles:x86_64') - + def environment = docker.build('rockpro64/linux-build:focal') + environment.inside("--privileged -u 0:0") { withEnv([ "USE_CCACHE=true", "RELEASE_NAME=$VERSION", "RELEASE=$BUILD_NUMBER", - "BOARD_TARGETs=$BOARD_TARGETs" ]) { stage('Prepare') { sh '''#!/bin/bash set -xe export CCACHE_DIR=$WORKSPACE/ccache ccache -M 0 -F 0 - git clean -ffdx -e ccache + repo init -u https://github.com/ThreeFiveDisplays-RockPro64/linux-manifests -b rockpro64 -m default.xml + + repo sync -j1 --fail-fast --force-sync + #repo sync -j 20 -c --force-sync ''' } stage('Images') { sh '''#!/bin/bash + export USER=jenkins set -xe export CCACHE_DIR=$WORKSPACE/ccache - for i in $BOARD_TARGETs; do - make -j$(nproc) BOARD_TARGET=$i $MAKE_TARGET - done - ''' - } - } - - withEnv([ - "VERSION=$VERSION", - "CHANGES=$CHANGES", - "GITHUB_PRERELEASE=$GITHUB_PRERELEASE", - "GITHUB_USER=$GITHUB_USER", - "GITHUB_REPO=$GITHUB_REPO" - ]) { - stage('Release') { - if (params.GITHUB_UPLOAD) { - sh '''#!/bin/bash - set -xe - shopt -s nullglob - - github-release release \ - --tag "${VERSION}" \ - --name "$VERSION: $BUILD_TAG" \ - --description "${CHANGES}\n\n${BUILD_URL}" \ - --draft - - github-release upload \ - --tag "${VERSION}" \ - --name "manifest.xml" \ - --file "manifest.xml" - - for file in *.xz; do - github-release upload \ - --tag "${VERSION}" \ - --name "$(basename "$file")" \ - --file "$file" & - done - - wait - - if [[ "$GITHUB_PRERELEASE" == "true" ]]; then - github-release edit \ - --tag "${VERSION}" \ - --name "$VERSION: $BUILD_TAG" \ - --description "${CHANGES}\n\n${BUILD_URL}" \ - --pre-release - else - github-release edit \ - --tag "${VERSION}" \ - --name "$VERSION: $BUILD_TAG" \ - --description "${CHANGES}\n\n${BUILD_URL}" + export ARCH=arm64 + export CROSS_COMPILE=aarch64-linux-gnu- + export ARCH=arm64 + + if ($Kernel) then + #cd kernel + cd linux-build + + make -j$(nproc) $MAKE_TARGET + #make focal mate arm64 rockpro64 + #make rk3399_linux_defconfig + #make all + #make dtbs + #make dtbs_install + #make modules + #make INSTALL_MOD_PATH=output modules_install + cd .. fi + if ($U_BOOT) then + cd u-boot + make rockpro-rk3399_defconfig + make + cd.. + cp u-boot/u-boot-dtb.bin uboot_builder/rk3399 + cd uboot_builder/rk3399/ + ./make-uboot.sh + cd .. + fi ''' - } else { - echo 'Flagged as an no upload release job' } - } } } }