From 9084b86a20da0c280b9d312d303e75186db00019 Mon Sep 17 00:00:00 2001 From: Manjoo Bentur Date: Thu, 16 Oct 2025 10:30:36 +0200 Subject: [PATCH 1/8] Revert "Delete tests/lib/Kiwi.py" This reverts commit b4d7098f4d9c3d7ba33efecee9b1d0df93f02f02. --- tests/lib/Kiwi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/lib/Kiwi.py diff --git a/tests/lib/Kiwi.py b/tests/lib/Kiwi.py new file mode 100644 index 0000000..a671c69 --- /dev/null +++ b/tests/lib/Kiwi.py @@ -0,0 +1,11 @@ +from utils import run_command + +class Kiwi: + + def kiwi_is_available(self): + (lines, _stdout, _stderr) = run_command('source /build/venv/bin/activate; kiwi-ng -v') + assert lines[-2].startswith('KIWI ') + + def berrymill_is_available(self): + (_lines, stdout, _stderr) = run_command('source /build/venv/bin/activate; berrymill -h') + assert 'usage: berrymill' in stdout From c9f199fb5a36e9cd7d908dd029fad0876b91f1d3 Mon Sep 17 00:00:00 2001 From: Manjoo Bentur Date: Thu, 16 Oct 2025 10:31:06 +0200 Subject: [PATCH 2/8] Revert "Delete tests/kiwi.robot" This reverts commit 9eed9984fe1dc104bf029efaef6b2582b36e5e4f. --- tests/kiwi.robot | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/kiwi.robot diff --git a/tests/kiwi.robot b/tests/kiwi.robot new file mode 100644 index 0000000..4898211 --- /dev/null +++ b/tests/kiwi.robot @@ -0,0 +1,20 @@ +*** Settings *** +Library lib/Setup.py +Library lib/Kiwi.py +Suite Setup Setup +Suite Teardown Teardown +Keyword Tags kiwi + +*** Test Cases *** + +SDK shall provide Kiwi-ng and Berrymill + [Tags] fast + Kiwi Is Available + Berrymill Is Available + +*** Keywords *** +Setup + Run Container + +Teardown + Stop Container From 4e33513ba998c2a90fd848149fc937aedee1c3e6 Mon Sep 17 00:00:00 2001 From: Manjoo Bentur Date: Thu, 16 Oct 2025 10:31:23 +0200 Subject: [PATCH 3/8] Revert "Delete layers/kiwi directory" This reverts commit edff0d746d6a9647472774266d951b1907fd2650. --- layers/kiwi/Dockerfile | 39 +++++++++++++ layers/kiwi/conf/berrymill/berrymill.conf | 50 ++++++++++++++++ .../kiwi/conf/berrymill/berrymill_local.conf | 56 ++++++++++++++++++ layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml | 32 ++++++++++ layers/kiwi/conf/kiwi/kiwi.yml | 10 ++++ layers/kiwi/scripts/apt/berrymill_local_repo | 28 +++++++++ layers/kiwi/scripts/apt/gen_app_apt_repo | 58 +++++++++++++++++++ layers/kiwi/scripts/apt/serve_packages | 29 ++++++++++ layers/kiwi/scripts/apt/stop_server | 8 +++ layers/kiwi/scripts/berrymill/box_build_image | 10 ++++ .../kiwi/scripts/berrymill/cross_build_image | 10 ++++ layers/kiwi/scripts/berrymill/kvm_build_image | 10 ++++ .../scripts/berrymill/prepare_image_build | 56 ++++++++++++++++++ layers/kiwi/scripts/gpg/gen_key_script | 9 +++ layers/kiwi/scripts/gpg/gen_sign_key | 29 ++++++++++ layers/kiwi/scripts/kiwi/check_image_build | 35 +++++++++++ 16 files changed, 469 insertions(+) create mode 100644 layers/kiwi/Dockerfile create mode 100644 layers/kiwi/conf/berrymill/berrymill.conf create mode 100644 layers/kiwi/conf/berrymill/berrymill_local.conf create mode 100644 layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml create mode 100644 layers/kiwi/conf/kiwi/kiwi.yml create mode 100755 layers/kiwi/scripts/apt/berrymill_local_repo create mode 100755 layers/kiwi/scripts/apt/gen_app_apt_repo create mode 100755 layers/kiwi/scripts/apt/serve_packages create mode 100755 layers/kiwi/scripts/apt/stop_server create mode 100755 layers/kiwi/scripts/berrymill/box_build_image create mode 100755 layers/kiwi/scripts/berrymill/cross_build_image create mode 100755 layers/kiwi/scripts/berrymill/kvm_build_image create mode 100644 layers/kiwi/scripts/berrymill/prepare_image_build create mode 100644 layers/kiwi/scripts/gpg/gen_key_script create mode 100755 layers/kiwi/scripts/gpg/gen_sign_key create mode 100755 layers/kiwi/scripts/kiwi/check_image_build diff --git a/layers/kiwi/Dockerfile b/layers/kiwi/Dockerfile new file mode 100644 index 0000000..6efaf76 --- /dev/null +++ b/layers/kiwi/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:latest + +ARG CONTAINER_USER="ebcl" + +# "Activate" Python env +ENV VIRTUAL_ENV=/build/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +USER root + +# Copy berrymill config +RUN mkdir -p /etc/berrymill +COPY conf/berrymill/berrymill_local.conf /etc/berrymill +COPY conf/berrymill/berrymill.conf /etc/berrymill +COPY conf/kiwi/kiwi-boxed-plugin.yml /etc/berrymill +COPY conf/kiwi/kiwi.yml /etc + +# Copy linux.elektrobit.com repo key +RUN mkdir -p /etc/berrymill/keyrings.d +RUN cp /etc/apt/trusted.gpg.d/elektrobit.gpg /etc/berrymill/keyrings.d/ + +USER $CONTAINER_USER +WORKDIR /build + +# Install berrymill +RUN pip install kiwi==10.1.2 kiwi-boxed-plugin==0.2.36 +RUN pip install 'berrymill @ git+https://github.com/tomirgang/berrymill.git@f4ff87f08edf5f178284a5a689e2b6e301faad35' + +# copy apt helper scripts +COPY scripts/apt/* /build/bin/ + +# copy berrymill helper scripts +COPY scripts/berrymill/* /build/bin/ + +# copy gpg helper scripts +COPY scripts/gpg/* /build/bin/ + +# copy kiwi helper scripts +COPY scripts/kiwi/* /build/bin/ diff --git a/layers/kiwi/conf/berrymill/berrymill.conf b/layers/kiwi/conf/berrymill/berrymill.conf new file mode 100644 index 0000000..b7048de --- /dev/null +++ b/layers/kiwi/conf/berrymill/berrymill.conf @@ -0,0 +1,50 @@ +# Global repositories will not be added, if set to "false" +use-global-repos: false +# Default location +boxed_plugin_conf: /etc/berrymill/kiwi_boxed_plugin.yml + +# Repository setup +repos: + # These below are repo names. + # They are just free form tags that are addressed later + release: + # Architecture + # Conforms to Debian standard: https://wiki.debian.org/SupportedArchitectures + amd64: + # Just an alias of the repo, free form + EBcL: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: prod + + EBcL-Not-Supported: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: all + + arm64: + EBcL: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: prod + + EBcL-Not-Supported: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: all + + EBcL-NXP-RDB2: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl_nxp_public + components: nxp_public + diff --git a/layers/kiwi/conf/berrymill/berrymill_local.conf b/layers/kiwi/conf/berrymill/berrymill_local.conf new file mode 100644 index 0000000..525c0cc --- /dev/null +++ b/layers/kiwi/conf/berrymill/berrymill_local.conf @@ -0,0 +1,56 @@ +# Global repositories will not be added, if set to "false" +use-global-repos: false +# Default location +boxed_plugin_conf: /etc/berrymill/kiwi_boxed_plugin.yml + +# Repository setup +repos: + # These below are repo names. + # They are just free form tags that are addressed later + release: + # Architecture + # Conforms to Debian standard: https://wiki.debian.org/SupportedArchitectures + amd64: + # Just an alias of the repo, free form + EBcL: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: prod + + EBcL-Not-Supported: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: all + + app: + url: http://CONTAINERIP:8000 + type: apt-deb + key: file:///build//result_app/dists/local/Release.key + name: local + components: main + + arm64: + EBcL: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: prod + + EBcL-Not-Supported: + url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 + type: apt-deb + key: file:///etc/berrymill/keyrings.d/elektrobit.gpg + name: ebcl + components: all + + app: + url: http://CONTAINERIP:8000 + type: apt-deb + key: file:///build//result_app/dists/local/Release.key + name: local + components: main diff --git a/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml b/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml new file mode 100644 index 0000000..4b5552b --- /dev/null +++ b/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml @@ -0,0 +1,32 @@ +box: + - + name: ubuntu + mem_mb: 8096 + processors: 4 + console: hvc0 + arch: + - + name: x86_64 + cmdline: + - root=/dev/vda3 + - rd.plymouth=0 + - selinux=0 + source: https://linux.elektrobit.com/boxes/images + packages_file: Ubuntu-Box.x86_64-1.22.04-System-BuildBox.report + boxfiles: + - Ubuntu-Box.x86_64-1.22.04-Kernel-BuildBox.tar.xz + - Ubuntu-Box.x86_64-1.22.04-System-BuildBox.qcow2 + use_initrd: true + + - + name: aarch64 + cmdline: + - root=/dev/vda2 + - rd.plymouth=0 + - selinux=0 + source: https://linux.elektrobit.com/boxes/images + packages_file: Ubuntu-Box.aarch64-1.22.04-System-BuildBox.report + boxfiles: + - Ubuntu-Box.aarch64-1.22.04-Kernel-BuildBox.tar.xz + - Ubuntu-Box.aarch64-1.22.04-System-BuildBox.qcow2 + use_initrd: true diff --git a/layers/kiwi/conf/kiwi/kiwi.yml b/layers/kiwi/conf/kiwi/kiwi.yml new file mode 100644 index 0000000..1593278 --- /dev/null +++ b/layers/kiwi/conf/kiwi/kiwi.yml @@ -0,0 +1,10 @@ +# KIWI - Build configuration file + +# Setup access options for the Open BuildService +obs: + # Use linux.elektrobit.com as OBS base url + - download_url: https://linux.elektrobit.com/ + # Specify if the BuildService download server is public or private. + # This information is used to verify if the request to populate + # the repositories via the imageinclude attribute is possible + - public: true diff --git a/layers/kiwi/scripts/apt/berrymill_local_repo b/layers/kiwi/scripts/apt/berrymill_local_repo new file mode 100755 index 0000000..615e6d3 --- /dev/null +++ b/layers/kiwi/scripts/apt/berrymill_local_repo @@ -0,0 +1,28 @@ +#!/bin/bash + +# get current IP of SDK container +IP=$(hostname -I | cut -d " " -f1 -s) + +BASE_FOLDER="/workspace/images" + +if [ ! -f "${BASE_FOLDER}/berrymill.template" ]; then + # copy the default template + cp /etc/berrymill/berrymill_local.conf ${BASE_FOLDER}/berrymill.template +fi + +if [ -f "${BASE_FOLDER}" ]; then + # if already a berrymill config exists + cat ${BASE_FOLDER}/berrymill.conf | grep "${IP}" + if [ $? -ne 0 ]; then + # and the config doesn't contain the local IP + # backup the config + mv ${BASE_FOLDER}/berrymill.conf ${BASE_FOLDER}/berrymill_$(date +%s).old + # and add the right config + cp ${BASE_FOLDER}/berrymill.template ${BASE_FOLDER}/berrymill.conf + sed -i "s/CONTAINERIP/${IP}/g" ${BASE_FOLDER}/berrymill.conf + fi +else + # genrate a berrymill config + cp ${BASE_FOLDER}/berrymill.template ${BASE_FOLDER}/berrymill.conf + sed -i "s/CONTAINERIP/${IP}/g" ${BASE_FOLDER}/berrymill.conf +fi diff --git a/layers/kiwi/scripts/apt/gen_app_apt_repo b/layers/kiwi/scripts/apt/gen_app_apt_repo new file mode 100755 index 0000000..5d19461 --- /dev/null +++ b/layers/kiwi/scripts/apt/gen_app_apt_repo @@ -0,0 +1,58 @@ +#!/bin/bash + +# Generate the apt repo metadata +cd /build/results/packages + +mkdir -p dists/local/main/{binary-arm64,binary-amd64} + +dpkg-scanpackages -m -a amd64 . /dev/null > dists/local/main/binary-amd64/Packages +dpkg-scanpackages -m -a arm64 . /dev/null > dists/local/main/binary-arm64/Packages +dpkg-scanpackages -m -a amd64 . /dev/null | gzip -9c > dists/local/main/binary-amd64/Packages.gz +dpkg-scanpackages -m -a arm64 . /dev/null | gzip -9c > dists/local/main/binary-arm64/Packages.gz +dpkg-scanpackages -m -a amd64 . /dev/null | xz -9 > dists/local/main/binary-amd64/Packages.xz +dpkg-scanpackages -m -a arm64 . /dev/null | xz -9 > dists/local/main/binary-arm64/Packages.xz + +# generate the release file +cd dists/local + +do_hash() { + HASH_NAME=$1 + HASH_CMD=$2 + echo "${HASH_NAME}:" + for f in $(find -type f -name "Packages*"); do + f=$(echo $f | cut -c3-) # remove ./ prefix + if [ "$f" = "Release" ]; then + continue + fi + echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)" + done +} + +cat > Release << EOF +Origin: EBcL workspace local repository +Label: LocalRepo +Suite: local +Codename: local +Version: 1.0 +Architectures: amd64 arm64 +Description: An example software repository +Components: main +Date: $(date -Ru) +EOF + +do_hash "MD5Sum" "md5sum" >> Release +do_hash "SHA1" "sha1sum" >> Release +do_hash "SHA256" "sha256sum" >> Release + +# Generate Release signature +gpg -b --output Release.gpg --armor Release + +# Generate InRelease file +gpg --clearsign -o InRelease Release + +# Export signing key +gpg --export $DEBMAIL > Release.key + +# Update local apt config +sudo cp Release.key /etc/apt/trusted.gpg.d/local.gpg +sudo bash -c "echo 'deb file:/build/results/packages local main' > /etc/apt/sources.list.d/local.list" diff --git a/layers/kiwi/scripts/apt/serve_packages b/layers/kiwi/scripts/apt/serve_packages new file mode 100755 index 0000000..3a5cde6 --- /dev/null +++ b/layers/kiwi/scripts/apt/serve_packages @@ -0,0 +1,29 @@ +#!/bin/bash + +# Ensure berrymill conf has correct container IP +berrymill_local_repo + +if [ -z "$APT_PATH" ]; then + export APT_PATH="/build/results/packages" +fi + +if [ -n "$1" ]; then + APT_PATH=$1 + # complete apt path + if [[ "${APT_PATH}" != "/"* ]]; then + # handle relative path + if [ ! -d "${APT_PATH}" ]; then + # relative path from current folder does not exist + # use relative path in workspace apps folder + APT_PATH="/build/workspace/${APT_PATH}" + else + APT_PATH=$(realpath $APT_PATH) + fi + fi + export APT_PATH=${APT_PATH} +fi + +# serve the apt repo +echo "Now serving the local apt repository from ${APT_PATH}." +echo "Press Strg + C to stop the server." +python3 -m http.server --directory ${APT_PATH} diff --git a/layers/kiwi/scripts/apt/stop_server b/layers/kiwi/scripts/apt/stop_server new file mode 100755 index 0000000..a609a2f --- /dev/null +++ b/layers/kiwi/scripts/apt/stop_server @@ -0,0 +1,8 @@ +#!/bin/bash + +PROC=$(lsof -i :8000 | grep LISTEN) +if [ $? -eq 0 ]; then + echo "Killing process ${PROC}." + PID=$(lsof -i :8000 | grep LISTEN | awk '{print $2}') + kill $PID +fi diff --git a/layers/kiwi/scripts/berrymill/box_build_image b/layers/kiwi/scripts/berrymill/box_build_image new file mode 100755 index 0000000..75fc9ca --- /dev/null +++ b/layers/kiwi/scripts/berrymill/box_build_image @@ -0,0 +1,10 @@ +#!/bin/bash + +# copy image to tmp +source prepare_image_build $@ + +# run berrymill +berrymill -c $BERRYMILL_CFG -d -a amd64 -i $APPLIANCE --clean build --box-memory 4G --target-dir /tmp/result_image --no-accel --cpu qemu64-v1 + +set -e +check_image_build diff --git a/layers/kiwi/scripts/berrymill/cross_build_image b/layers/kiwi/scripts/berrymill/cross_build_image new file mode 100755 index 0000000..6dda28f --- /dev/null +++ b/layers/kiwi/scripts/berrymill/cross_build_image @@ -0,0 +1,10 @@ +#!/bin/bash + +# copy image to tmp +source prepare_image_build $@ + +# run berrymill +berrymill -c $BERRYMILL_CFG -d -a arm64 -i $APPLIANCE --clean build --cross --box-memory 4G --target-dir /tmp/result_image + +set -e +check_image_build diff --git a/layers/kiwi/scripts/berrymill/kvm_build_image b/layers/kiwi/scripts/berrymill/kvm_build_image new file mode 100755 index 0000000..af8058d --- /dev/null +++ b/layers/kiwi/scripts/berrymill/kvm_build_image @@ -0,0 +1,10 @@ +#!/bin/bash + +# copy image to tmp +source prepare_image_build $@ + +# run berrymill +sudo -E env PATH=$PATH berrymill -c $BERRYMILL_CFG -d -a amd64 -i $APPLIANCE --clean build --target-dir /tmp/result_image + +set -e +check_image_build diff --git a/layers/kiwi/scripts/berrymill/prepare_image_build b/layers/kiwi/scripts/berrymill/prepare_image_build new file mode 100644 index 0000000..3c0ed3e --- /dev/null +++ b/layers/kiwi/scripts/berrymill/prepare_image_build @@ -0,0 +1,56 @@ +#!/bin/bash + +source /build/venv/bin/activate + +# get appliance name +if [ $# -eq 0 ]; then + APPLIANCE="/tmp/build/images/appliance.kiwi" + echo "Using default $APPLIANCE" +else + APPLIANCE=$1 +fi + +# complete appliance path +if [[ "${APPLIANCE}" != "/"* ]]; then + # handle relative path + if [ ! -f "${APPLIANCE}" ]; then + # relative path from current folder does not exist + # use relative path in workspace images folder + APPLIANCE="/tmp/build/images/$APPLIANCE" + fi +fi + +APPLIANCE=$(realpath $APPLIANCE) + +if [ ! -f "$APPLIANCE" ]; then + echo "Appliance file $APPLIANCE not found!" + exit 1 +fi + +echo "Building appliance ${APPLIANCE}" + +# clean old result folder +sudo rm -rf /tmp/result_image + +FILENAME="$(basename "${APPLIANCE}")" + +echo "Appliance file ${FILENAME}" + +export APPLIANCE + +# check if user berrymill config exists +BUILD_FOLDER=$(dirname "${APPLIANCE}") +if [ -f "${BUILD_FOLDER}/berrymill.conf" ]; then + # use config from specific image folder + BERRYMILL_CFG="${BUILD_FOLDER}/berrymill.conf" +else + if [ -f "/workspace/images/berrymill.conf" ]; then + # use config form workspace images folder + BERRYMILL_CFG="/workspace/images/berrymill.conf" + else + # use default config + BERRYMILL_CFG="/etc/berrymill/berrymill.conf" + fi +fi + +export BERRYMILL_CFG diff --git a/layers/kiwi/scripts/gpg/gen_key_script b/layers/kiwi/scripts/gpg/gen_key_script new file mode 100644 index 0000000..dc5672a --- /dev/null +++ b/layers/kiwi/scripts/gpg/gen_key_script @@ -0,0 +1,9 @@ +Key-Type: 1 +Key-Length: 4096 +Subkey-Type: 1 +Subkey-Length: 4096 +Name-Real: DEBFULLNAME +Name-Email: DEBEMAIL +Expire-Date: 0 +%no-ask-passphrase +%no-protection diff --git a/layers/kiwi/scripts/gpg/gen_sign_key b/layers/kiwi/scripts/gpg/gen_sign_key new file mode 100755 index 0000000..9626f94 --- /dev/null +++ b/layers/kiwi/scripts/gpg/gen_sign_key @@ -0,0 +1,29 @@ +#!/bin/bash + +# Ensure env is up-to-date +source /workspace/identity/env +GNUPGHOME="/workspace/gpg-keys/.gnupg" +export GNUPGHOME + +# prepare folder if not exists +mkdir -p $GNUPGHOME +chmod -R 700 $GNUPGHOME + +# generate gnupg script +mkdir -p /workspace/gpg-keys +cp /build/bin/gen_key_script /workspace/gpg-keys/ +sed -i "s/DEBFULLNAME/${DEBFULLNAME}/g" /workspace/gpg-keys/gen_key_script +sed -i "s/DEBEMAIL/${DEBEMAIL}/g" /workspace/gpg-keys/gen_key_script + +# test if key already exists +gpg --list-secret-keys $DEBEMAIL +# get appliance name +if [ $? -ne 0 ]; then + gpg --batch --gen-key /workspace/gpg-keys/gen_key_script +fi + +gpg --list-keys +gpg --list-secret-keys + +sudo chown -R ebcl:ebcl $GNUPGHOME +sudo chmod -R 700 $GNUPGHOME diff --git a/layers/kiwi/scripts/kiwi/check_image_build b/layers/kiwi/scripts/kiwi/check_image_build new file mode 100755 index 0000000..bbda4af --- /dev/null +++ b/layers/kiwi/scripts/kiwi/check_image_build @@ -0,0 +1,35 @@ +#!/bin/bash + +if [ ! -d "/tmp/result_image" ]; then + echo "Build failed! No results folder found." + exit 1 +fi + +# copy result to ouput folder +sudo chown -R ebcl:ebcl /tmp/result_image +cp -R /tmp/result_image/* /build/results/images + +BUILD_RESULT=$(find /tmp/result_image/* -maxdepth 0 -type d | head -n 1) +if [ -z "$BUILD_RESULT" ]; then + echo "ERROR: No build result found!" + exit 1 +fi + +BUILD_RESULT=$(basename $BUILD_RESULT) +BUILD_LOG="/tmp/result_image/${BUILD_RESULT}/result.log" + +if [ -f $BUILD_LOG ]; then + cat $BUILD_LOG | grep "\[[ ]*ERROR[ ]*\]:" + if [ $? -eq 0 ]; then + echo "ERROR: Build failed, see result.log!" + exit 1 + else + echo "SUCCESS: Build was successful!" + exit 0 + fi +else + echo "ERROR: No build log found!" + exit 1 +fi + +rm -rf /tmp/result_image From 0bc7e2df8a353e987d0a186dbd74fead75123cb9 Mon Sep 17 00:00:00 2001 From: Manjoo Bentur Date: Thu, 16 Oct 2025 10:31:41 +0200 Subject: [PATCH 4/8] Revert "Remove kiwi" This reverts commit c8df7cfc8b36a36408252a6aa8670753732c7e2d. --- configuration/build_config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/configuration/build_config.yaml b/configuration/build_config.yaml index 2c77dd0..7bd25ec 100644 --- a/configuration/build_config.yaml +++ b/configuration/build_config.yaml @@ -7,6 +7,7 @@ Layers: - ../layers/base - ../layers/yocto - ../layers/pbuilder + - ../layers/kiwi - ../layers/appdev - ../layers/build_tools - ../layers/vscode From 2a312e462eb9fc070df8ed060e5e22c75aa47442 Mon Sep 17 00:00:00 2001 From: Matthias Beckert Date: Wed, 29 Oct 2025 09:12:19 +0100 Subject: [PATCH 5/8] reduced layer to minimal set of helper scripts --- configuration/build_config.yaml | 2 +- layers/helper/Dockerfile | 17 ++++++ .../scripts/apt/gen_app_apt_repo | 0 .../scripts/apt/serve_packages | 3 - .../{kiwi => helper}/scripts/apt/stop_server | 0 .../scripts/gpg/gen_key_script | 0 .../{kiwi => helper}/scripts/gpg/gen_sign_key | 0 layers/kiwi/Dockerfile | 39 ------------- layers/kiwi/conf/berrymill/berrymill.conf | 50 ----------------- .../kiwi/conf/berrymill/berrymill_local.conf | 56 ------------------- layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml | 32 ----------- layers/kiwi/conf/kiwi/kiwi.yml | 10 ---- layers/kiwi/scripts/apt/berrymill_local_repo | 28 ---------- layers/kiwi/scripts/berrymill/box_build_image | 10 ---- .../kiwi/scripts/berrymill/cross_build_image | 10 ---- layers/kiwi/scripts/berrymill/kvm_build_image | 10 ---- .../scripts/berrymill/prepare_image_build | 56 ------------------- layers/kiwi/scripts/kiwi/check_image_build | 35 ------------ tests/kiwi.robot | 20 ------- tests/lib/Kiwi.py | 11 ---- 20 files changed, 18 insertions(+), 371 deletions(-) create mode 100644 layers/helper/Dockerfile rename layers/{kiwi => helper}/scripts/apt/gen_app_apt_repo (100%) rename layers/{kiwi => helper}/scripts/apt/serve_packages (91%) rename layers/{kiwi => helper}/scripts/apt/stop_server (100%) rename layers/{kiwi => helper}/scripts/gpg/gen_key_script (100%) rename layers/{kiwi => helper}/scripts/gpg/gen_sign_key (100%) delete mode 100644 layers/kiwi/Dockerfile delete mode 100644 layers/kiwi/conf/berrymill/berrymill.conf delete mode 100644 layers/kiwi/conf/berrymill/berrymill_local.conf delete mode 100644 layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml delete mode 100644 layers/kiwi/conf/kiwi/kiwi.yml delete mode 100755 layers/kiwi/scripts/apt/berrymill_local_repo delete mode 100755 layers/kiwi/scripts/berrymill/box_build_image delete mode 100755 layers/kiwi/scripts/berrymill/cross_build_image delete mode 100755 layers/kiwi/scripts/berrymill/kvm_build_image delete mode 100644 layers/kiwi/scripts/berrymill/prepare_image_build delete mode 100755 layers/kiwi/scripts/kiwi/check_image_build delete mode 100644 tests/kiwi.robot delete mode 100644 tests/lib/Kiwi.py diff --git a/configuration/build_config.yaml b/configuration/build_config.yaml index 7bd25ec..6ecaa26 100644 --- a/configuration/build_config.yaml +++ b/configuration/build_config.yaml @@ -7,7 +7,7 @@ Layers: - ../layers/base - ../layers/yocto - ../layers/pbuilder - - ../layers/kiwi + - ../layers/helper - ../layers/appdev - ../layers/build_tools - ../layers/vscode diff --git a/layers/helper/Dockerfile b/layers/helper/Dockerfile new file mode 100644 index 0000000..d1782b4 --- /dev/null +++ b/layers/helper/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:latest + +ARG CONTAINER_USER="ebcl" + +# "Activate" Python env +ENV VIRTUAL_ENV=/build/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +USER $CONTAINER_USER +WORKDIR /build + +# copy apt helper scripts +COPY scripts/apt/* /build/bin/ + +# copy gpg helper scripts +COPY scripts/gpg/* /build/bin/ + diff --git a/layers/kiwi/scripts/apt/gen_app_apt_repo b/layers/helper/scripts/apt/gen_app_apt_repo similarity index 100% rename from layers/kiwi/scripts/apt/gen_app_apt_repo rename to layers/helper/scripts/apt/gen_app_apt_repo diff --git a/layers/kiwi/scripts/apt/serve_packages b/layers/helper/scripts/apt/serve_packages similarity index 91% rename from layers/kiwi/scripts/apt/serve_packages rename to layers/helper/scripts/apt/serve_packages index 3a5cde6..2bbf40d 100755 --- a/layers/kiwi/scripts/apt/serve_packages +++ b/layers/helper/scripts/apt/serve_packages @@ -1,8 +1,5 @@ #!/bin/bash -# Ensure berrymill conf has correct container IP -berrymill_local_repo - if [ -z "$APT_PATH" ]; then export APT_PATH="/build/results/packages" fi diff --git a/layers/kiwi/scripts/apt/stop_server b/layers/helper/scripts/apt/stop_server similarity index 100% rename from layers/kiwi/scripts/apt/stop_server rename to layers/helper/scripts/apt/stop_server diff --git a/layers/kiwi/scripts/gpg/gen_key_script b/layers/helper/scripts/gpg/gen_key_script similarity index 100% rename from layers/kiwi/scripts/gpg/gen_key_script rename to layers/helper/scripts/gpg/gen_key_script diff --git a/layers/kiwi/scripts/gpg/gen_sign_key b/layers/helper/scripts/gpg/gen_sign_key similarity index 100% rename from layers/kiwi/scripts/gpg/gen_sign_key rename to layers/helper/scripts/gpg/gen_sign_key diff --git a/layers/kiwi/Dockerfile b/layers/kiwi/Dockerfile deleted file mode 100644 index 6efaf76..0000000 --- a/layers/kiwi/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM ubuntu:latest - -ARG CONTAINER_USER="ebcl" - -# "Activate" Python env -ENV VIRTUAL_ENV=/build/venv -ENV PATH="$VIRTUAL_ENV/bin:$PATH" - -USER root - -# Copy berrymill config -RUN mkdir -p /etc/berrymill -COPY conf/berrymill/berrymill_local.conf /etc/berrymill -COPY conf/berrymill/berrymill.conf /etc/berrymill -COPY conf/kiwi/kiwi-boxed-plugin.yml /etc/berrymill -COPY conf/kiwi/kiwi.yml /etc - -# Copy linux.elektrobit.com repo key -RUN mkdir -p /etc/berrymill/keyrings.d -RUN cp /etc/apt/trusted.gpg.d/elektrobit.gpg /etc/berrymill/keyrings.d/ - -USER $CONTAINER_USER -WORKDIR /build - -# Install berrymill -RUN pip install kiwi==10.1.2 kiwi-boxed-plugin==0.2.36 -RUN pip install 'berrymill @ git+https://github.com/tomirgang/berrymill.git@f4ff87f08edf5f178284a5a689e2b6e301faad35' - -# copy apt helper scripts -COPY scripts/apt/* /build/bin/ - -# copy berrymill helper scripts -COPY scripts/berrymill/* /build/bin/ - -# copy gpg helper scripts -COPY scripts/gpg/* /build/bin/ - -# copy kiwi helper scripts -COPY scripts/kiwi/* /build/bin/ diff --git a/layers/kiwi/conf/berrymill/berrymill.conf b/layers/kiwi/conf/berrymill/berrymill.conf deleted file mode 100644 index b7048de..0000000 --- a/layers/kiwi/conf/berrymill/berrymill.conf +++ /dev/null @@ -1,50 +0,0 @@ -# Global repositories will not be added, if set to "false" -use-global-repos: false -# Default location -boxed_plugin_conf: /etc/berrymill/kiwi_boxed_plugin.yml - -# Repository setup -repos: - # These below are repo names. - # They are just free form tags that are addressed later - release: - # Architecture - # Conforms to Debian standard: https://wiki.debian.org/SupportedArchitectures - amd64: - # Just an alias of the repo, free form - EBcL: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: prod - - EBcL-Not-Supported: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: all - - arm64: - EBcL: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: prod - - EBcL-Not-Supported: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: all - - EBcL-NXP-RDB2: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl_nxp_public - components: nxp_public - diff --git a/layers/kiwi/conf/berrymill/berrymill_local.conf b/layers/kiwi/conf/berrymill/berrymill_local.conf deleted file mode 100644 index 525c0cc..0000000 --- a/layers/kiwi/conf/berrymill/berrymill_local.conf +++ /dev/null @@ -1,56 +0,0 @@ -# Global repositories will not be added, if set to "false" -use-global-repos: false -# Default location -boxed_plugin_conf: /etc/berrymill/kiwi_boxed_plugin.yml - -# Repository setup -repos: - # These below are repo names. - # They are just free form tags that are addressed later - release: - # Architecture - # Conforms to Debian standard: https://wiki.debian.org/SupportedArchitectures - amd64: - # Just an alias of the repo, free form - EBcL: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: prod - - EBcL-Not-Supported: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: all - - app: - url: http://CONTAINERIP:8000 - type: apt-deb - key: file:///build//result_app/dists/local/Release.key - name: local - components: main - - arm64: - EBcL: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: prod - - EBcL-Not-Supported: - url: https://linux.elektrobit.com/eb-corbos-linux/1.1.1 - type: apt-deb - key: file:///etc/berrymill/keyrings.d/elektrobit.gpg - name: ebcl - components: all - - app: - url: http://CONTAINERIP:8000 - type: apt-deb - key: file:///build//result_app/dists/local/Release.key - name: local - components: main diff --git a/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml b/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml deleted file mode 100644 index 4b5552b..0000000 --- a/layers/kiwi/conf/kiwi/kiwi-boxed-plugin.yml +++ /dev/null @@ -1,32 +0,0 @@ -box: - - - name: ubuntu - mem_mb: 8096 - processors: 4 - console: hvc0 - arch: - - - name: x86_64 - cmdline: - - root=/dev/vda3 - - rd.plymouth=0 - - selinux=0 - source: https://linux.elektrobit.com/boxes/images - packages_file: Ubuntu-Box.x86_64-1.22.04-System-BuildBox.report - boxfiles: - - Ubuntu-Box.x86_64-1.22.04-Kernel-BuildBox.tar.xz - - Ubuntu-Box.x86_64-1.22.04-System-BuildBox.qcow2 - use_initrd: true - - - - name: aarch64 - cmdline: - - root=/dev/vda2 - - rd.plymouth=0 - - selinux=0 - source: https://linux.elektrobit.com/boxes/images - packages_file: Ubuntu-Box.aarch64-1.22.04-System-BuildBox.report - boxfiles: - - Ubuntu-Box.aarch64-1.22.04-Kernel-BuildBox.tar.xz - - Ubuntu-Box.aarch64-1.22.04-System-BuildBox.qcow2 - use_initrd: true diff --git a/layers/kiwi/conf/kiwi/kiwi.yml b/layers/kiwi/conf/kiwi/kiwi.yml deleted file mode 100644 index 1593278..0000000 --- a/layers/kiwi/conf/kiwi/kiwi.yml +++ /dev/null @@ -1,10 +0,0 @@ -# KIWI - Build configuration file - -# Setup access options for the Open BuildService -obs: - # Use linux.elektrobit.com as OBS base url - - download_url: https://linux.elektrobit.com/ - # Specify if the BuildService download server is public or private. - # This information is used to verify if the request to populate - # the repositories via the imageinclude attribute is possible - - public: true diff --git a/layers/kiwi/scripts/apt/berrymill_local_repo b/layers/kiwi/scripts/apt/berrymill_local_repo deleted file mode 100755 index 615e6d3..0000000 --- a/layers/kiwi/scripts/apt/berrymill_local_repo +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# get current IP of SDK container -IP=$(hostname -I | cut -d " " -f1 -s) - -BASE_FOLDER="/workspace/images" - -if [ ! -f "${BASE_FOLDER}/berrymill.template" ]; then - # copy the default template - cp /etc/berrymill/berrymill_local.conf ${BASE_FOLDER}/berrymill.template -fi - -if [ -f "${BASE_FOLDER}" ]; then - # if already a berrymill config exists - cat ${BASE_FOLDER}/berrymill.conf | grep "${IP}" - if [ $? -ne 0 ]; then - # and the config doesn't contain the local IP - # backup the config - mv ${BASE_FOLDER}/berrymill.conf ${BASE_FOLDER}/berrymill_$(date +%s).old - # and add the right config - cp ${BASE_FOLDER}/berrymill.template ${BASE_FOLDER}/berrymill.conf - sed -i "s/CONTAINERIP/${IP}/g" ${BASE_FOLDER}/berrymill.conf - fi -else - # genrate a berrymill config - cp ${BASE_FOLDER}/berrymill.template ${BASE_FOLDER}/berrymill.conf - sed -i "s/CONTAINERIP/${IP}/g" ${BASE_FOLDER}/berrymill.conf -fi diff --git a/layers/kiwi/scripts/berrymill/box_build_image b/layers/kiwi/scripts/berrymill/box_build_image deleted file mode 100755 index 75fc9ca..0000000 --- a/layers/kiwi/scripts/berrymill/box_build_image +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# copy image to tmp -source prepare_image_build $@ - -# run berrymill -berrymill -c $BERRYMILL_CFG -d -a amd64 -i $APPLIANCE --clean build --box-memory 4G --target-dir /tmp/result_image --no-accel --cpu qemu64-v1 - -set -e -check_image_build diff --git a/layers/kiwi/scripts/berrymill/cross_build_image b/layers/kiwi/scripts/berrymill/cross_build_image deleted file mode 100755 index 6dda28f..0000000 --- a/layers/kiwi/scripts/berrymill/cross_build_image +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# copy image to tmp -source prepare_image_build $@ - -# run berrymill -berrymill -c $BERRYMILL_CFG -d -a arm64 -i $APPLIANCE --clean build --cross --box-memory 4G --target-dir /tmp/result_image - -set -e -check_image_build diff --git a/layers/kiwi/scripts/berrymill/kvm_build_image b/layers/kiwi/scripts/berrymill/kvm_build_image deleted file mode 100755 index af8058d..0000000 --- a/layers/kiwi/scripts/berrymill/kvm_build_image +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# copy image to tmp -source prepare_image_build $@ - -# run berrymill -sudo -E env PATH=$PATH berrymill -c $BERRYMILL_CFG -d -a amd64 -i $APPLIANCE --clean build --target-dir /tmp/result_image - -set -e -check_image_build diff --git a/layers/kiwi/scripts/berrymill/prepare_image_build b/layers/kiwi/scripts/berrymill/prepare_image_build deleted file mode 100644 index 3c0ed3e..0000000 --- a/layers/kiwi/scripts/berrymill/prepare_image_build +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -source /build/venv/bin/activate - -# get appliance name -if [ $# -eq 0 ]; then - APPLIANCE="/tmp/build/images/appliance.kiwi" - echo "Using default $APPLIANCE" -else - APPLIANCE=$1 -fi - -# complete appliance path -if [[ "${APPLIANCE}" != "/"* ]]; then - # handle relative path - if [ ! -f "${APPLIANCE}" ]; then - # relative path from current folder does not exist - # use relative path in workspace images folder - APPLIANCE="/tmp/build/images/$APPLIANCE" - fi -fi - -APPLIANCE=$(realpath $APPLIANCE) - -if [ ! -f "$APPLIANCE" ]; then - echo "Appliance file $APPLIANCE not found!" - exit 1 -fi - -echo "Building appliance ${APPLIANCE}" - -# clean old result folder -sudo rm -rf /tmp/result_image - -FILENAME="$(basename "${APPLIANCE}")" - -echo "Appliance file ${FILENAME}" - -export APPLIANCE - -# check if user berrymill config exists -BUILD_FOLDER=$(dirname "${APPLIANCE}") -if [ -f "${BUILD_FOLDER}/berrymill.conf" ]; then - # use config from specific image folder - BERRYMILL_CFG="${BUILD_FOLDER}/berrymill.conf" -else - if [ -f "/workspace/images/berrymill.conf" ]; then - # use config form workspace images folder - BERRYMILL_CFG="/workspace/images/berrymill.conf" - else - # use default config - BERRYMILL_CFG="/etc/berrymill/berrymill.conf" - fi -fi - -export BERRYMILL_CFG diff --git a/layers/kiwi/scripts/kiwi/check_image_build b/layers/kiwi/scripts/kiwi/check_image_build deleted file mode 100755 index bbda4af..0000000 --- a/layers/kiwi/scripts/kiwi/check_image_build +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -if [ ! -d "/tmp/result_image" ]; then - echo "Build failed! No results folder found." - exit 1 -fi - -# copy result to ouput folder -sudo chown -R ebcl:ebcl /tmp/result_image -cp -R /tmp/result_image/* /build/results/images - -BUILD_RESULT=$(find /tmp/result_image/* -maxdepth 0 -type d | head -n 1) -if [ -z "$BUILD_RESULT" ]; then - echo "ERROR: No build result found!" - exit 1 -fi - -BUILD_RESULT=$(basename $BUILD_RESULT) -BUILD_LOG="/tmp/result_image/${BUILD_RESULT}/result.log" - -if [ -f $BUILD_LOG ]; then - cat $BUILD_LOG | grep "\[[ ]*ERROR[ ]*\]:" - if [ $? -eq 0 ]; then - echo "ERROR: Build failed, see result.log!" - exit 1 - else - echo "SUCCESS: Build was successful!" - exit 0 - fi -else - echo "ERROR: No build log found!" - exit 1 -fi - -rm -rf /tmp/result_image diff --git a/tests/kiwi.robot b/tests/kiwi.robot deleted file mode 100644 index 4898211..0000000 --- a/tests/kiwi.robot +++ /dev/null @@ -1,20 +0,0 @@ -*** Settings *** -Library lib/Setup.py -Library lib/Kiwi.py -Suite Setup Setup -Suite Teardown Teardown -Keyword Tags kiwi - -*** Test Cases *** - -SDK shall provide Kiwi-ng and Berrymill - [Tags] fast - Kiwi Is Available - Berrymill Is Available - -*** Keywords *** -Setup - Run Container - -Teardown - Stop Container diff --git a/tests/lib/Kiwi.py b/tests/lib/Kiwi.py deleted file mode 100644 index a671c69..0000000 --- a/tests/lib/Kiwi.py +++ /dev/null @@ -1,11 +0,0 @@ -from utils import run_command - -class Kiwi: - - def kiwi_is_available(self): - (lines, _stdout, _stderr) = run_command('source /build/venv/bin/activate; kiwi-ng -v') - assert lines[-2].startswith('KIWI ') - - def berrymill_is_available(self): - (_lines, stdout, _stderr) = run_command('source /build/venv/bin/activate; berrymill -h') - assert 'usage: berrymill' in stdout From c0410396de4ef34e0069377fc6721b73d5749a22 Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Mon, 24 Nov 2025 09:38:30 +0100 Subject: [PATCH 6/8] bump version --- configuration/build_config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/build_config.yaml b/configuration/build_config.yaml index 6ecaa26..8557d71 100644 --- a/configuration/build_config.yaml +++ b/configuration/build_config.yaml @@ -1,8 +1,8 @@ Base-Name: ebcl_dev_container Repository: ghcr.io/elektrobit Base-Container: ubuntu:22.04 -Version: v1.7.0 -Version_packages: v1.7.0 +Version: v1.8.0 +Version_packages: v1.8.0 Layers: - ../layers/base - ../layers/yocto From 1a496ec2040e94d068780fe853836f254b38b2fb Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Mon, 24 Nov 2025 09:52:29 +0100 Subject: [PATCH 7/8] check with pre-release first --- configuration/build_config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/build_config.yaml b/configuration/build_config.yaml index 8557d71..c61ae25 100644 --- a/configuration/build_config.yaml +++ b/configuration/build_config.yaml @@ -1,8 +1,8 @@ Base-Name: ebcl_dev_container Repository: ghcr.io/elektrobit Base-Container: ubuntu:22.04 -Version: v1.8.0 -Version_packages: v1.8.0 +Version: v1.8.0-pre2 +Version_packages: v1.8.0-pre2 Layers: - ../layers/base - ../layers/yocto From 59645a7c2602b0d7af1e6a68b0a2efb55ff6ddfd Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Wed, 26 Nov 2025 09:39:43 +0100 Subject: [PATCH 8/8] update version to v1.8.0 in build_config.yaml --- configuration/build_config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/build_config.yaml b/configuration/build_config.yaml index c61ae25..8557d71 100644 --- a/configuration/build_config.yaml +++ b/configuration/build_config.yaml @@ -1,8 +1,8 @@ Base-Name: ebcl_dev_container Repository: ghcr.io/elektrobit Base-Container: ubuntu:22.04 -Version: v1.8.0-pre2 -Version_packages: v1.8.0-pre2 +Version: v1.8.0 +Version_packages: v1.8.0 Layers: - ../layers/base - ../layers/yocto