aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml103
-rw-r--r--README.txt4
-rw-r--r--ci/96b-avenger96.yml6
-rw-r--r--ci/96b-nitrogen.yml20
-rw-r--r--ci/arduino-nano-33-ble.yml21
-rw-r--r--ci/base.yml38
-rwxr-xr-xci/check-machine-coverage26
-rwxr-xr-xci/check-warnings19
-rw-r--r--ci/intel-x86-64.yml6
-rwxr-xr-xci/jobs-to-kas19
-rw-r--r--ci/logging.yml13
-rw-r--r--ci/meta-openembedded.yml11
-rw-r--r--ci/nrf52840dk-nrf52840.yml20
-rw-r--r--ci/qemu-cortex-m3.yml12
-rw-r--r--ci/qemu-nios2.yml10
-rw-r--r--ci/qemu-x86.yml10
-rw-r--r--ci/stm32mp157c-dk2.yml13
-rw-r--r--ci/testimage.yml9
-rwxr-xr-xci/update-repos40
-rw-r--r--meta-zephyr-bsp/conf/machine/qemu-nios2.conf2
-rw-r--r--meta-zephyr-core/classes/zephyrtest.bbclass2
-rw-r--r--meta-zephyr-core/conf/distro/zephyr.conf2
22 files changed, 402 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..43a19f9
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,103 @@
+image: ghcr.io/siemens/kas/kas:3.2
+
+variables:
+ CPU_REQUEST: ""
+ DEFAULT_TAG: ""
+ # These are needed as the k8s executor doesn't respect the container
+ # entrypoint by default
+ FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
+ FF_KUBERNETES_HONOR_ENTRYPOINT: 1
+
+stages:
+ - prep
+ - build
+
+# Common job fragment to get a worker ready
+.setup:
+ tags:
+ - $DEFAULT_TAG
+ stage: build
+ interruptible: true
+ variables:
+ KAS_WORK_DIR: $CI_PROJECT_DIR/work
+ KAS_REPO_REF_DIR: $CI_BUILDS_DIR/persist/repos
+ SSTATE_DIR: $CI_BUILDS_DIR/persist/sstate
+ DL_DIR: $CI_BUILDS_DIR/persist/downloads
+ BB_LOGCONFIG: $CI_PROJECT_DIR/ci/logging.yml
+ before_script:
+ - echo KAS_WORK_DIR = $KAS_WORK_DIR
+ - echo SSTATE_DIR = $SSTATE_DIR
+ - echo DL_DIR = $DL_DIR
+ - rm -rf $KAS_WORK_DIR
+ - mkdir --verbose --parents $KAS_WORK_DIR $KAS_REPO_REF_DIR $SSTATE_DIR $DL_DIR
+
+# Generalised fragment to do a Kas build
+.build:
+ extends: .setup
+ variables:
+ KUBERNETES_CPU_REQUEST: $CPU_REQUEST
+ script:
+ - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME")
+ - kas shell --update --force-checkout $KASFILES -c 'cat conf/*.conf'
+ - kas build $KASFILES
+ - ./ci/check-warnings $KAS_WORK_DIR/build/warnings.log
+ artifacts:
+ name: "logs"
+ when: on_failure
+ paths:
+ - $CI_PROJECT_DIR/work/build/tmp/work*/**/temp/log.do_*.*
+
+#
+# Prep stage, update repositories once
+#
+update-repos:
+ extends: .setup
+ stage: prep
+ script:
+ - flock --verbose --timeout 60 $KAS_REPO_REF_DIR ./ci/update-repos
+
+
+#
+# Bootstrap stage, machine coverage
+#
+
+# What percentage of machines in the layer do we build
+machine-coverage:
+ stage: prep
+ interruptible: true
+ script:
+ - ./ci/check-machine-coverage
+ coverage: '/Coverage: \d+/'
+ tags:
+ - $DEFAULT_TAG
+
+#
+# Build stage, the actual build jobs
+#
+
+96b-avenger96:
+ extends: .build
+
+96b-nitrogen:
+ extends: .build
+
+arduino-nano-33-ble:
+ extends: .build
+
+intel-x86-64:
+ extends: .build
+
+nrf52840dk-nrf52840:
+ extends: .build
+
+qemu-cortex-m3/testimage:
+ extends: .build
+
+qemu-nios2:
+ extends: .build
+
+qemu-x86/testimage:
+ extends: .build
+
+stm32mp157c-dk2:
+ extends: .build
diff --git a/README.txt b/README.txt
index ec860fd..5e0c4b6 100644
--- a/README.txt
+++ b/README.txt
@@ -9,9 +9,9 @@ Prerequisites:
==============
This layer depends on:
- Yocto distro (master)
+ Yocto distro (kirkstone)
git://git.yoctoproject.org/poky
- Python layer (meta-openembedded/meta-python)
+ Python layer (meta-openembedded/meta-python) (kirkstone)
git://git.openembedded.org/meta-openembedded
Modify local conf by adding:
diff --git a/ci/96b-avenger96.yml b/ci/96b-avenger96.yml
new file mode 100644
index 0000000..bcdccf3
--- /dev/null
+++ b/ci/96b-avenger96.yml
@@ -0,0 +1,6 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: 96b-avenger96
diff --git a/ci/96b-nitrogen.yml b/ci/96b-nitrogen.yml
new file mode 100644
index 0000000..9b685fe
--- /dev/null
+++ b/ci/96b-nitrogen.yml
@@ -0,0 +1,20 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: 96b-nitrogen
+
+target:
+ - zephyr-blinky
+ - zephyr-coap-client
+ - zephyr-coap-server
+ - zephyr-echo-client
+ - zephyr-hci-uart
+ - zephyr-helloworld
+ - zephyr-http-client
+ - zephyr-kernel-test-all
+ - zephyr-mqtt-publisher
+ - zephyr-peripheral-esp
+ - zephyr-peripheral-hr
+ - zephyr-philosophers
diff --git a/ci/arduino-nano-33-ble.yml b/ci/arduino-nano-33-ble.yml
new file mode 100644
index 0000000..1035118
--- /dev/null
+++ b/ci/arduino-nano-33-ble.yml
@@ -0,0 +1,21 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: arduino-nano-33-ble
+
+target:
+ - zephyr-blinky
+ - zephyr-coap-client
+ - zephyr-coap-server
+ - zephyr-echo-client
+ - zephyr-helloworld
+ - zephyr-http-client
+ - zephyr-kernel-test-all
+ - zephyr-mqtt-publisher
+ - zephyr-openthread-echo-client
+ - zephyr-openthread-rcp
+ - zephyr-peripheral-esp
+ - zephyr-peripheral-hr
+ - zephyr-philosophers
diff --git a/ci/base.yml b/ci/base.yml
new file mode 100644
index 0000000..bab03d3
--- /dev/null
+++ b/ci/base.yml
@@ -0,0 +1,38 @@
+header:
+ version: 11
+ includes:
+ - ci/meta-openembedded.yml
+
+distro: zephyr
+
+defaults:
+ repos:
+ refspec: kirkstone
+
+repos:
+ meta-zephyr:
+ layers:
+ meta-zephyr-core:
+ meta-zephyr-bsp:
+
+ poky:
+ url: https://git.yoctoproject.org/git/poky
+ layers:
+ meta:
+ meta-poky:
+
+env:
+ BB_LOGCONFIG: ""
+
+local_conf_header:
+ base: |
+ BB_SERVER_TIMEOUT = "60"
+ CONF_VERSION = "2"
+ INHERIT += "rm_work"
+
+machine: unset
+
+target:
+ - zephyr-helloworld
+ - zephyr-kernel-test-all
+ - zephyr-philosophers
diff --git a/ci/check-machine-coverage b/ci/check-machine-coverage
new file mode 100755
index 0000000..19f9571
--- /dev/null
+++ b/ci/check-machine-coverage
@@ -0,0 +1,26 @@
+#! /usr/bin/env python3
+
+from pathlib import Path
+import sys
+
+metazephyr = Path.cwd()
+
+if metazephyr.name != "meta-zephyr":
+ print("Not running inside meta-zephyr")
+ sys.exit(1)
+
+# All machine configurations
+machines = metazephyr.glob("meta-zephyr-bsp/conf/machine/*.conf")
+machines = set(p.stem for p in machines)
+
+# All kas files
+kas = metazephyr.glob("ci/*.yml")
+kas = set(p.stem for p in kas)
+
+missing = machines - kas
+print(f"The following machines are missing: {', '.join(sorted(missing))}.")
+
+covered = len(machines) - len(missing)
+total = len(machines)
+percent = int(covered / total * 100)
+print(f"Coverage: {percent}%")
diff --git a/ci/check-warnings b/ci/check-warnings
new file mode 100755
index 0000000..9d08010
--- /dev/null
+++ b/ci/check-warnings
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+# Expects the path to a log file as $1, and if this file has any content
+# then display the contents and exit with an error code.
+
+set -e -u
+
+LOGFILE=$1
+
+LINES=$(grep --invert-match "relocations in \.text" $LOGFILE | wc -l)
+if test "$LINES" -ne 0; then
+ echo ==============================
+ echo The build had warnings/errors:
+ echo ==============================
+ cat $LOGFILE
+ exit 1
+fi
+
+exit 0
diff --git a/ci/intel-x86-64.yml b/ci/intel-x86-64.yml
new file mode 100644
index 0000000..23e711c
--- /dev/null
+++ b/ci/intel-x86-64.yml
@@ -0,0 +1,6 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: intel-x86-64
diff --git a/ci/jobs-to-kas b/ci/jobs-to-kas
new file mode 100755
index 0000000..7057970
--- /dev/null
+++ b/ci/jobs-to-kas
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+# Read a GitLab CI job name on $1 and transform it to a
+# list of Kas yaml files
+
+set -e -u
+
+# Read Job namne from $1 and split on /
+IFS=/ read -r -a PARTS<<<$1
+
+# Prefix each part with ci/
+PARTS=("${PARTS[@]/#/ci/}")
+
+# Suffix each part with .yml
+PARTS=("${PARTS[@]/%/.yml}")
+
+# Print colon-separated
+IFS=":"
+echo "${PARTS[*]}"
diff --git a/ci/logging.yml b/ci/logging.yml
new file mode 100644
index 0000000..3af1029
--- /dev/null
+++ b/ci/logging.yml
@@ -0,0 +1,13 @@
+# Python logging configuration to write all warnings to a separate file
+version: 1
+
+handlers:
+ warnings:
+ class: logging.FileHandler
+ level: WARNING
+ filename: warnings.log
+ formatter: BitBake.logfileFormatter
+
+loggers:
+ BitBake:
+ handlers: [warnings]
diff --git a/ci/meta-openembedded.yml b/ci/meta-openembedded.yml
new file mode 100644
index 0000000..bed338d
--- /dev/null
+++ b/ci/meta-openembedded.yml
@@ -0,0 +1,11 @@
+header:
+ version: 11
+
+repos:
+ meta-openembedded:
+ url: https://git.openembedded.org/meta-openembedded
+ layers:
+ meta-filesystems:
+ meta-networking:
+ meta-oe:
+ meta-python:
diff --git a/ci/nrf52840dk-nrf52840.yml b/ci/nrf52840dk-nrf52840.yml
new file mode 100644
index 0000000..a0c1587
--- /dev/null
+++ b/ci/nrf52840dk-nrf52840.yml
@@ -0,0 +1,20 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: nrf52840dk-nrf52840
+
+target:
+ - zephyr-blinky
+ - zephyr-coap-client
+ - zephyr-coap-server
+ - zephyr-echo-client
+ - zephyr-helloworld
+ - zephyr-http-client
+ - zephyr-kernel-test-all
+ - zephyr-lvgl
+ - zephyr-mqtt-publisher
+ - zephyr-peripheral-esp
+ - zephyr-peripheral-hr
+ - zephyr-philosophers
diff --git a/ci/qemu-cortex-m3.yml b/ci/qemu-cortex-m3.yml
new file mode 100644
index 0000000..b01480c
--- /dev/null
+++ b/ci/qemu-cortex-m3.yml
@@ -0,0 +1,12 @@
+header:
+ version: 11
+ includes:
+ - ci/base.yml
+
+local_conf_header:
+ nonbuilding_tests: |
+ ZEPHYRTESTS:remove = "common context pending poll sleep"
+ qemu_opts: |
+ QB_OPT_APPEND = "-icount shift=3,align=off,sleep=on -rtc clock=vm"
+
+machine: qemu-cortex-m3
diff --git a/ci/qemu-nios2.yml b/ci/qemu-nios2.yml
new file mode 100644
index 0000000..b818371
--- /dev/null
+++ b/ci/qemu-nios2.yml
@@ -0,0 +1,10 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+local_conf_header:
+ nonbuilding_tests: |
+ ZEPHYRTESTS:remove = "interrupt"
+
+machine: qemu-nios2
diff --git a/ci/qemu-x86.yml b/ci/qemu-x86.yml
new file mode 100644
index 0000000..df744a1
--- /dev/null
+++ b/ci/qemu-x86.yml
@@ -0,0 +1,10 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+local_conf_header:
+ failing_tests: |
+ ZEPHYRTESTS:remove = "pending"
+
+machine: qemu-x86
diff --git a/ci/stm32mp157c-dk2.yml b/ci/stm32mp157c-dk2.yml
new file mode 100644
index 0000000..3dc04a5
--- /dev/null
+++ b/ci/stm32mp157c-dk2.yml
@@ -0,0 +1,13 @@
+header:
+ version: 9
+ includes:
+ - ci/base.yml
+
+machine: stm32mp157c-dk2
+
+target:
+ - zephyr-blinky
+ - zephyr-helloworld
+ - zephyr-kernel-test-all
+ - zephyr-philosophers
+ - zephyr-openamp-rsc-table
diff --git a/ci/testimage.yml b/ci/testimage.yml
new file mode 100644
index 0000000..83e17a7
--- /dev/null
+++ b/ci/testimage.yml
@@ -0,0 +1,9 @@
+header:
+ version: 11
+
+local_conf_header:
+ testimage: |
+ IMAGE_CLASSES += "testimage"
+ TEST_TARGET = "QemuTargetZephyr"
+ TEST_SUITES = "zephyr"
+ TESTIMAGE_AUTO = "1"
diff --git a/ci/update-repos b/ci/update-repos
new file mode 100755
index 0000000..fa638aa
--- /dev/null
+++ b/ci/update-repos
@@ -0,0 +1,40 @@
+#! /usr/bin/env python3
+
+# Update clones of the repositories we need in KAS_REPO_REF_DIR to speed up fetches
+
+import sys
+import os
+import subprocess
+import pathlib
+
+def repo_shortname(url):
+ # Taken from Kas (Repo.__getattr__) to ensure the logic is right
+ from urllib.parse import urlparse
+ url = urlparse(url)
+ return ('{url.netloc}{url.path}'
+ .format(url=url)
+ .replace('@', '.')
+ .replace(':', '.')
+ .replace('/', '.')
+ .replace('*', '.'))
+
+repositories = (
+ "https://git.yoctoproject.org/git/poky",
+ "https://git.openembedded.org/meta-openembedded",
+)
+
+if __name__ == "__main__":
+ if "KAS_REPO_REF_DIR" not in os.environ:
+ print("KAS_REPO_REF_DIR needs to be set")
+ sys.exit(1)
+
+ base_repodir = pathlib.Path(os.environ["KAS_REPO_REF_DIR"])
+
+ for repo in repositories:
+ repodir = base_repodir / repo_shortname(repo)
+ if repodir.exists():
+ print("Updating %s..." % repo)
+ subprocess.run(["git", "-C", repodir, "fetch"], check=True)
+ else:
+ print("Cloning %s..." % repo)
+ subprocess.run(["git", "clone", "--bare", repo, repodir], check=True)
diff --git a/meta-zephyr-bsp/conf/machine/qemu-nios2.conf b/meta-zephyr-bsp/conf/machine/qemu-nios2.conf
index de20320..c41f505 100644
--- a/meta-zephyr-bsp/conf/machine/qemu-nios2.conf
+++ b/meta-zephyr-bsp/conf/machine/qemu-nios2.conf
@@ -14,3 +14,5 @@ QB_OPT_APPEND = "-nographic"
QB_CPU = "-cpu nios2"
ARCH:qemu-nios2 = "nios2"
+
+TCLIBC = "glibc"
diff --git a/meta-zephyr-core/classes/zephyrtest.bbclass b/meta-zephyr-core/classes/zephyrtest.bbclass
index 248fd15..aa48e6c 100644
--- a/meta-zephyr-core/classes/zephyrtest.bbclass
+++ b/meta-zephyr-core/classes/zephyrtest.bbclass
@@ -50,4 +50,4 @@ python testdata_clean() {
os.remove(fname)
}
-addtask do_testdata_write before do_build after do_deploy
+addtask do_testdata_write before do_testimage after do_deploy
diff --git a/meta-zephyr-core/conf/distro/zephyr.conf b/meta-zephyr-core/conf/distro/zephyr.conf
index 6ecd421..bdf1821 100644
--- a/meta-zephyr-core/conf/distro/zephyr.conf
+++ b/meta-zephyr-core/conf/distro/zephyr.conf
@@ -4,7 +4,7 @@ DISTRO_VERSION = "1.0"
TARGET_VENDOR = "-yocto"
-TCLIBC = "newlib"
+TCLIBC ?= "newlib"
TEST_TARGET = "QemuTargetZephyr"
TEST_SUITES = "zephyr"