Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
kernel-builder
Commits
ff476f2d
Commit
ff476f2d
authored
Feb 21, 2019
by
Angus Ainslie (Purism)
Browse files
initial commit
parents
Pipeline
#4424
passed with stage
in 15 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
ff476f2d
job
:
before_script
:
-
apt-get -y update
-
apt-get -y install shellcheck
tags
:
-
librem5
script
:
-
shellcheck build_kernel_deb.sh
Jenkinsfile
0 → 100644
View file @
ff476f2d
node
{
gitUrl
=
'https://source.puri.sm/librem5/kernel-builder.git'
artifacts
=
'files/*'
branch
=
'master'
parameters
{
string
(
name:
'board'
,
defaultValue:
"devkit"
,
description:
'What board type to build for?'
)
string
(
name:
'kernel_url'
,
defaultValue:
"https://source.puri.sm/Librem5/linux-emcraft"
,
description:
'Which kernel repo should get built?'
)
string
(
name:
'kernel_branch'
,
defaultValue:
"imx8-4.18-wip"
,
description:
'Which kernel branch should get built?'
)
string
(
name:
'build_type'
,
defaultValue:
"latest"
,
description:
'What type of build is this?'
)
string
(
name:
'publish'
,
defaultValue:
"false"
,
description:
'Should the image get published?'
)
string
(
name:
'MAKE_OPTS'
,
defaultValue:
""
,
description:
'extra make options'
)
}
stage
(
'Setup'
)
{
git
url:
gitUrl
,
branch:
branch
}
stage
(
'Build kernel'
)
{
sh
"KERNEL_REPO=${kernel_url} KERNEL_BRANCH=${kernel_branch} MAKE_OPTS=${MAKE_OPTS} ./build_kernel_deb.sh -b ${board}"
}
stage
(
'Publish'
)
{
if
(
"${params.publish}"
==
"true"
)
{
sh
"bin/publish_ci_files -b ${BUILD_NUMBER} -t kernel -T ${build_type} -o files files/*"
}
else
{
echo
"This kernel will not be published"
}
}
stage
(
'Results'
)
{
archive
artifacts
}
stage
(
'Clean up'
)
{
deleteDir
()
/* clean up our workspace */
}
stage
(
'Notify'
)
{
mail
to:
'librem5-team@lists.puri.sm'
,
subject:
"Build: ${currentBuild.fullDisplayName}"
,
body:
"Build finished ${env.BUILD_URL}"
}
}
build_kernel_deb.sh
0 → 100755
View file @
ff476f2d
#!/bin/bash
#
# Copyright (C) 2017-2019 Purism SPC
#
# SPDX-License-Identifier: GPL-3.0+
#
# Passed in via the environment
read
-r
-a
MAKE_OPTS
<<<
"
${
MAKE_OPTS
}
"
set
-u
set
-e
CWD
=
$(
pwd
)
OUTPUT_DIR
=
"
${
CWD
}
/output"
NPROC
=
$(
nproc
--all
)
pureos_board
=
devkit
CROSS_COMPILER
=
aarch64-linux-gnu-
ARCH
=
arm64
COMPILER_ARCH
=
arm64
GIT_OPTS
=(
--depth
1
)
DTS_FILE
=
""
RSI_VER
=
RS9116.NB0.NL.LNX.PURISM_FW_UPGRADE.1.0.5
build_redpine
()
{
tar
-xf
"files/
${
RSI_VER
}
.tgz"
RSI_BUILD_PATH
=
"
${
RSI_VER
}
/rsi/"
ESCAPED_KERNEL_DIR
=
$(
echo
"
${
LINUX_DIR
}
"
|
sed
's/\//\\\//g'
)
sed
"s/KERNELDIR=.*/KERNELDIR=
${
ESCAPED_KERNEL_DIR
}
/"
-i
"
${
RSI_BUILD_PATH
}
/Makefile"
cd
${
RSI_BUILD_PATH
}
make
-j
"
${
NPROC
}
"
"
${
MAKE_OPTS
[@]
}
"
ARCH
=
"
${
ARCH
}
"
CROSS_COMPILE
=
"
${
CROSS_COMPILER
}
"
-C
"
${
CWD
}
/
${
LINUX_DIR
}
"
M
=
"
$PWD
"
modules
cd
"
${
CWD
}
/
${
RSI_BUILD_PATH
}
"
&&
tar
-cf
"
${
OUTPUT_DIR
}
/rsi_upgrade.tar"
./
*
.ko
cd
"
${
CWD
}
/
${
RSI_VER
}
/Firmware"
&&
tar
-cf
"
${
OUTPUT_DIR
}
/rsi_firmware.tar"
./
*
cd
"
${
CWD
}
"
}
usage
()
{
echo
"Usage :
$1
"
echo
" -h Display this help message."
echo
" -b [imx6|imx8|ec-som|devkit] select the board type."
}
while
getopts
":hb:"
opt
;
do
case
${
opt
}
in
b
)
pureos_board
=
$OPTARG
;;
\?
)
echo
"Invalid Option: -
$OPTARG
"
1>&2
usage
"
$0
"
exit
0
;;
h
)
usage
"
$0
"
exit
0
;;
esac
done
LINUX_DIR
=
"linux-
${
pureos_board
}
"
case
${
pureos_board
}
in
imx6
)
KERNEL_BRANCH
=
"
${
KERNEL_BRANCH
:-
purism
-nitrogen6_4.16.x
}
"
KERNEL_REPO
=
"
${
KERNEL_REPO
:-
https
://source.puri.sm/Librem5/linux-nitrogen6.git
}
"
DOT_CONFIG
=
"
${
DOT_CONFIG
:-
imx6_dot_config
}
"
CROSS_COMPILER
=
arm-linux-gnueabihf-
ARCH
=
arm
COMPILER_ARCH
=
armhf
;;
imx8
)
KERNEL_BRANCH
=
"
${
KERNEL_BRANCH
:-
imx_4
.9.51_imx8m_beta
}
"
KERNEL_REPO
=
"
${
KERNEL_REPO
:-
https
://source.codeaurora.org/external/imx/linux-imx.git
}
"
DOT_CONFIG
=
"
${
DOT_CONFIG
:-
imx8_dot_config
}
"
;;
ec-som
)
KERNEL_BRANCH
=
"
${
KERNEL_BRANCH
:imx8-4.18-wip
}
"
KERNEL_REPO
=
"
${
KERNEL_REPO
:-
https
://source.puri.sm/Librem5/linux-emcraft.git
}
"
DOT_CONFIG
=
"
${
DOT_CONFIG
:-
emcraft
-som-imx8_defconfig
}
"
;;
devkit
)
KERNEL_BRANCH
=
"
${
KERNEL_BRANCH
:-
imx8
-4.18-wip
}
"
KERNEL_REPO
=
"
${
KERNEL_REPO
:-
https
://source.puri.sm/Librem5/linux-next.git
}
"
DOT_CONFIG
=
"
${
DOT_CONFIG
:-
librem5
-devkit_defconfig
}
"
;;
\?
)
echo
"unrecognized board type
${
pureos_board
}
"
exit
1
;;
esac
if
[
!
-e
"
${
LINUX_DIR
}
"
]
;
then
echo
"Cloning kernel"
git clone
"
${
GIT_OPTS
[@]
}
"
-b
"
${
KERNEL_BRANCH
}
"
"
${
KERNEL_REPO
}
"
"
${
LINUX_DIR
}
"
cd
"
${
LINUX_DIR
}
"
else
cd
"
${
LINUX_DIR
}
"
echo
"Updating kernel"
git pull
"
${
GIT_OPTS
[@]
}
"
"
${
KERNEL_REPO
}
"
"
${
KERNEL_BRANCH
}
"
git checkout
"
${
KERNEL_BRANCH
}
"
fi
if
[
!
-e
.config
]
;
then
echo
"Configuring kernel"
if
[
-e
"../
${
DOT_CONFIG
}
"
]
;
then
cp
"../
${
DOT_CONFIG
}
"
.config
make
"
${
MAKE_OPTS
[@]
}
"
ARCH
=
"
${
ARCH
}
"
CROSS_COMPILE
=
"
${
CROSS_COMPILER
}
"
oldconfig
else
make
"
${
MAKE_OPTS
[@]
}
"
ARCH
=
"
${
ARCH
}
"
CROSS_COMPILE
=
"
${
CROSS_COMPILER
}
"
"
${
DOT_CONFIG
}
"
fi
fi
if
[
-n
"
${
DTS_FILE
}
"
]
;
then
echo
"Adding device tree file"
cp
"../
${
DTS_FILE
}
"
"arch/
${
ARCH
}
/boot/dts/"
fi
echo
"Building kernel"
make
-j
"
${
NPROC
}
"
"
${
MAKE_OPTS
[@]
}
"
ARCH
=
"
${
ARCH
}
"
CROSS_COMPILE
=
"
${
CROSS_COMPILER
}
"
bindeb-pkg
echo
"Moving kernel"
mkdir
-p
"
${
OUTPUT_DIR
}
"
mv
../
*${
COMPILER_ARCH
}
.deb ../
*
.buildinfo ../
*
.changes
"
${
OUTPUT_DIR
}
"
echo
"
${
KERNEL_REPO
}
"
>
"
${
OUTPUT_DIR
}
/kernel-git-
${
ARCH
}
.txt"
git log |
head
-n
1 |
awk
'{ print $2 };'
>>
"
${
OUTPUT_DIR
}
/kernel-git-
${
ARCH
}
.txt"
cd
"
${
CWD
}
"
echo
"kernel-builder"
>>
"
${
OUTPUT_DIR
}
/kernel-git-
${
ARCH
}
.txt"
git log |
head
-n
1 |
awk
'{ print $2 };'
>>
"
${
OUTPUT_DIR
}
/kernel-git-
${
ARCH
}
.txt"
case
"
${
pureos_board
}
"
in
devkit
)
build_redpine
;;
*
)
;;
esac
files/RS9116.NB0.NL.LNX.PURISM_FW_UPGRADE.1.0.5.tgz
0 → 100644
View file @
ff476f2d
File added
publish_files
0 → 100755
View file @
ff476f2d
#!/bin/bash
#
# Copyright (C) 2017-2019 Purism SPC
#
# SPDX-License-Identifier: GPL-3.0+
#
set
-e
DATE
=
$(
date
--iso
)
REMOTE
=
librem5@storage.puri.sm
BUILD_DIR
=
""
OUT_DIR
=
""
BUILD_TYPE
=
"latest"
usage
()
{
echo
"Usage :
$1
"
echo
" -h Display this help message."
echo
" -b build number"
echo
" -t a tag for the type of build"
echo
" -o output path"
echo
" -T build type [ci|unstable]"
}
while
getopts
":hb:t:o:T:"
opt
;
do
case
${
opt
}
in
b
)
BUILD_NUMBER
=
$OPTARG
echo
"Build number :
${
BUILD_NUMBER
}
"
;;
t
)
TAG
=
$OPTARG
echo
"Tag :
${
TAG
}
"
;;
o
)
OUT_DIR
=
$OPTARG
echo
"Out dir :
${
OUT_DIR
}
"
;;
T
)
BUILD_TYPE
=
$OPTARG
echo
"Build type :
${
BUILD_TYPE
}
"
;;
\?
)
echo
"Invalid Option: -
$OPTARG
"
1>&2
usage
"
$0
"
exit
0
;;
h
)
usage
"
$0
"
exit
0
;;
esac
done
shift
"
$((
OPTIND-1
))
"
FILES
=
"
$@
"
echo
"Copying files
${
FILES
}
"
[
-z
${
TAG
}
]
||
BUILD_DIR
=
"
${
TAG
}
-"
BUILD_DIR+
=
"
${
DATE
}
"
[
-z
${
BUILD_NUMBER
}
]
||
BUILD_DIR+
=
"-B
${
BUILD_NUMBER
}
"
TARGET
=
"librem5/binaries/
${
BUILD_TYPE
}
/
${
BUILD_DIR
}
"
[
-z
${
OUT_DIR
}
]
||
TARGET+
=
"/
${
OUT_DIR
}
"
echo
"Uploading to
${
REMOTE
}
:
${
TARGET
}
"
ssh
-p
3376
${
REMOTE
}
"mkdir -p
${
TARGET
}
"
ssh
-p
3376
${
REMOTE
}
"mkdir -p librem5/binaries/
${
BUILD_TYPE
}
/latest/
${
OUT_DIR
}
"
for
FILE
in
${
FILES
}
;
do
echo
"Uploding file
${
FILE
}
"
BASE
=
`
basename
${
FILE
}
`
scp
-P
3376
-r
${
FILE
}
"
${
REMOTE
}
:
${
TARGET
}
"
ssh
-p
3376
${
REMOTE
}
"ln -rnsf
${
TARGET
}
/
${
BASE
}
librem5/binaries/
${
BUILD_TYPE
}
/latest/
${
OUT_DIR
}
/
${
BASE
}
"
done
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment