Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kas, layers and the kernel #560

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) Siemens AG, 2020-2022
# Copyright (c) Siemens AG, 2020-2024
#
# Authors:
# Jan Kiszka <[email protected]>
Expand All @@ -8,7 +8,7 @@
# COPYING.MIT file in the top-level directory.
#

image: ghcr.io/siemens/kas/kas-isar:4.0
image: ghcr.io/siemens/kas/kas-isar:4.4

variables:
GIT_STRATEGY: clone
Expand Down
8 changes: 0 additions & 8 deletions conf/distro/debian-snapshot.list

This file was deleted.

15 changes: 0 additions & 15 deletions conf/distro/iot2050-debian.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ KERNEL_NAME ?= "cip"
PREFERRED_VERSION_customizations ?= "0.1-iot2050-debian"
PREFERRED_VERSION_customizations-debug ?= "0.1-iot2050-debian"

OVERRIDES .= ':${PACKAGES_SELECTION}'

# packages-mainline: Use the mainline debian packages
# packages-snapshot: Use the snapshot debian packages
PACKAGES_SELECTION ?= "packages-mainline"

DISTRO_APT_SOURCES_MAINLINE_LIST := "${DISTRO_APT_SOURCES}"
DISTRO_APT_SOURCES_SNAPSHOT_LIST ?= "conf/distro/debian-snapshot.list"

DISTRO_APT_SOURCES:append:packages-snapshot = " ${DISTRO_APT_SOURCES_SNAPSHOT_LIST}"
DISTRO_APT_SOURCES:remove:packages-snapshot = "${DISTRO_APT_SOURCES_MAINLINE_LIST}"

HOST_DISTRO_APT_SOURCES:append:packages-snapshot = " ${DISTRO_APT_SOURCES_SNAPSHOT_LIST}"
HOST_DISTRO_APT_SOURCES:remove:packages-snapshot = "${DISTRO_APT_SOURCES_MAINLINE_LIST}"

SDK_INSTALL += "linux-headers-${KERNEL_NAME} mraa"
SDK_PREINSTALL += "zlib1g-dev:${DISTRO_ARCH} libjson-c-dev:${DISTRO_ARCH}"

Expand Down
136 changes: 86 additions & 50 deletions kas-container
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2018-2022
# Copyright (c) Siemens AG, 2018-2024
#
# Authors:
# Jan Kiszka <[email protected]>
Expand All @@ -27,13 +27,19 @@

set -e

KAS_IMAGE_VERSION_DEFAULT="4.4"
KAS_CONTAINER_IMAGE_PATH_DEFAULT="ghcr.io/siemens/kas"
KAS_CONTAINER_IMAGE_NAME_DEFAULT="kas"
KAS_CONTAINER_SELF_NAME="$(basename "$0")"

usage()
{
printf "%b" "Usage: $0 [OPTIONS] { build | shell } [KASOPTIONS] [KASFILE]\n"
printf "%b" " $0 [OPTIONS] { checkout | dump } [KASOPTIONS] [KASFILE]\n"
printf "%b" " $0 [OPTIONS] for-all-repos [KASOPTIONS] [KASFILE] COMMAND\n"
printf "%b" " $0 [OPTIONS] { clean | cleansstate | cleanall}\n"
printf "%b" " $0 [OPTIONS] menu [KCONFIG]\n"
SELF="${KAS_CONTAINER_SELF_NAME}"
printf "%b" "Usage: ${SELF} [OPTIONS] { build | shell } [KASOPTIONS] [KASFILE]\n"
printf "%b" " ${SELF} [OPTIONS] { checkout | dump } [KASOPTIONS] [KASFILE]\n"
printf "%b" " ${SELF} [OPTIONS] for-all-repos [KASOPTIONS] [KASFILE] COMMAND\n"
printf "%b" " ${SELF} [OPTIONS] { clean | cleansstate | cleanall} [KASFILE]\n"
printf "%b" " ${SELF} [OPTIONS] menu [KCONFIG]\n"
printf "%b" "\nPositional arguments:\n"
printf "%b" "build\t\t\tCheck out repositories and build target.\n"
printf "%b" "checkout\t\tCheck out repositories but do not build.\n"
Expand Down Expand Up @@ -80,6 +86,15 @@ usage()
exit 1
}

fatal_error(){
echo "${KAS_CONTAINER_SELF_NAME}: Error: $*" >&2
exit 1
}

warning(){
echo "${KAS_CONTAINER_SELF_NAME}: Warning: $*" >&2
}

trace()
{
[ -n "${KAS_VERBOSE}" ] && echo "+ $*" >&2
Expand Down Expand Up @@ -113,7 +128,6 @@ enable_oe_mode() {

run_clean() {
if [ -n "${KAS_ISAR_ARGS}" ]; then
set_container_image_var
# SC2086: Double quote to prevent globbing and word splitting.
# shellcheck disable=2086
trace ${KAS_CONTAINER_COMMAND} run -v "${KAS_BUILD_DIR}":/build:rw \
Expand All @@ -135,10 +149,6 @@ run_clean() {
fi
}

KAS_IMAGE_VERSION_DEFAULT="4.0"
KAS_CONTAINER_IMAGE_PATH_DEFAULT="ghcr.io/siemens/kas"
KAS_CONTAINER_IMAGE_NAME_DEFAULT="kas"

set_container_image_var() {
KAS_IMAGE_VERSION="${KAS_IMAGE_VERSION:-${KAS_IMAGE_VERSION_DEFAULT}}"
KAS_CONTAINER_IMAGE_NAME="${KAS_CONTAINER_IMAGE_NAME:-${KAS_CONTAINER_IMAGE_NAME_DEFAULT}}"
Expand Down Expand Up @@ -168,14 +178,12 @@ if [ -z "${KAS_CONTAINER_ENGINE}" ]; then
;;
*)
# The docker command is an unknown engine
echo "$0: docker command found, but unknown engine detected" >&2
exit 1
fatal_error "docker command found, but unknown engine detected"
esac
elif command -v podman >/dev/null; then
KAS_CONTAINER_ENGINE=podman
else
echo "$0: no container engine found, need docker or podman" >&2
exit 1
fatal_error "no container engine found, need docker or podman"
fi
fi

Expand All @@ -190,8 +198,7 @@ podman)
KAS_RUNTIME_ARGS="${KAS_RUNTIME_ARGS} --security-opt label=disable"
;;
*)
echo "$0: unknown container engine '${KAS_CONTAINER_ENGINE}'" >&2
exit 1
fatal_error "unknown container engine '${KAS_CONTAINER_ENGINE}'"
;;
esac

Expand All @@ -205,8 +212,7 @@ while [ $# -gt 0 ]; do
--with-loop-dev)
if ! KAS_LOOP_DEV=$(/sbin/losetup -f 2>/dev/null); then
if [ "$(id -u)" -eq 0 ]; then
echo "Error: loop device not available!"
exit 1
fatal_error "loop device not available!"
fi
sudo_command="/sbin/losetup -f"
sudo_message="[sudo] enter password to setup loop"
Expand All @@ -216,10 +222,9 @@ while [ $# -gt 0 ]; do
# shellcheck disable=2086
if ! KAS_LOOP_DEV=$(sudo -p "$sudo_message" $sudo_command \
2>/dev/null); then
echo "Error: loop device setup unsuccessful!"
echo "try calling '$sudo_command' with root" \
"permissions manually."
exit 1
fatal_error "loop device setup unsuccessful!" \
"try calling '$sudo_command' with root" \
"permissions manually."
fi
fi
KAS_WITH_LOOP_DEV="--device ${KAS_LOOP_DEV}"
Expand All @@ -236,6 +241,9 @@ while [ $# -gt 0 ]; do
shift 2
;;
--ssh-agent)
if [ -z "${SSH_AUTH_SOCK}" ]; then
fatal_error "no SSH agent running"
fi
KAS_SSH_AUTH_SOCK=$(readlink -fv "$SSH_AUTH_SOCK")
shift 1
;;
Expand Down Expand Up @@ -274,16 +282,16 @@ while [ $# -gt 0 ]; do
shift 2
;;
--version)
echo "$(basename "$0") $KAS_IMAGE_VERSION_DEFAULT"
echo "${KAS_CONTAINER_SELF_NAME} $KAS_IMAGE_VERSION_DEFAULT"
exit 0
;;
--*)
usage
;;
clean|cleansstate|cleanall)
[ $# -eq 1 ] || usage
run_clean "$1"
exit 0
KAS_CMD=$1
shift 1
break
;;
shell)
KAS_REPO_MOUNT_OPT_DEFAULT="rw"
Expand Down Expand Up @@ -322,15 +330,21 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do
case "$1" in
--skip|--target|--task)
KAS_OPTIONS="${KAS_OPTIONS} $1 $2"
shift 2
shift 1
shift 1 || KAS_OPTIONS="--help"
;;
-c|--cmd|--command)
KAS_BITBAKE_C_OPTION_ARGS="$2"
shift 2
shift 1
shift 1 || KAS_OPTIONS="--help"
;;
-E|--preserve-env)
echo "$1 is not supported with kas-container"
exit 1
fatal_error "$1 is not supported with ${KAS_CONTAINER_SELF_NAME}"
;;
--provenance)
KAS_OPTIONS="${KAS_OPTIONS} $1 $2"
shift 1
shift 1 || KAS_OPTIONS="--help"
;;
--)
KAS_EXTRA_BITBAKE_ARGS=$#
Expand All @@ -345,8 +359,7 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do
# shellcheck disable=2086
for FILE in $(IFS=':'; echo $1); do
if ! KAS_REAL_FILE="$(realpath -qe "$FILE")"; then
echo "Error: configuration file '${FILE}' not found"
exit 1
fatal_error "configuration file '${FILE}' not found"
fi
if [ -z "${KAS_FILES}" ]; then
KAS_FIRST_FILE="${KAS_REAL_FILE}"
Expand Down Expand Up @@ -395,7 +408,7 @@ if [ "${KAS_CMD}" = "menu" ]; then
set -- "$@" -e _KAS_REPO_DIR_HOST="$(readlink -fv "${KAS_REPO_DIR}")"
fi

BUILD_SYSTEM=$(tr '\n' '\f' 2>/dev/null < ${KAS_FIRST_FILE} | \
BUILD_SYSTEM=$(tr '\n' '\f' 2>/dev/null < "${KAS_FIRST_FILE}" | \
sed -e 's/\(.*\fconfig KAS_BUILD_SYSTEM\f\(.*\)\|.*\)/\2/' \
-e 's/\f\([[:alpha:]].*\|$\)//' \
-e 's/.*default \"\(.*\)\".*/\1/')
Expand All @@ -416,18 +429,24 @@ fi

set_container_image_var

# short circuit for clean* commands. We just need
# the build-system information, but no repo mounts, etc...
if echo "${KAS_CMD}" | grep -qe "^clean"; then
run_clean "${KAS_CMD}"
exit 0
fi

KAS_REPO_MOUNT_OPT="${KAS_REPO_MOUNT_OPT:-${KAS_REPO_MOUNT_OPT_DEFAULT}}"

KAS_FILES="$(echo "${KAS_FILES}" | sed 's|'"${KAS_REPO_DIR}"'/|/repo/|g')"

if [ "$(id -u)" -eq 0 ] && [ "${KAS_ALLOW_ROOT}" != "yes" ] ; then
echo "Error: Running as root - may break certain recipes."
echo "Better give a regular user docker access. Set" \
"KAS_ALLOW_ROOT=yes to override."
exit 1
fatal_error "Running as root - may break certain recipes." \
"Better give a regular user docker access. Set" \
"KAS_ALLOW_ROOT=yes to override."
fi

set -- "$@" -v "${KAS_REPO_DIR}":/repo:${KAS_REPO_MOUNT_OPT} \
set -- "$@" -v "${KAS_REPO_DIR}:/repo:${KAS_REPO_MOUNT_OPT}" \
-v "${KAS_WORK_DIR}":/work:rw -e KAS_WORK_DIR=/work \
-v "${KAS_BUILD_DIR}":/build:rw \
--workdir=/repo \
Expand All @@ -436,37 +455,42 @@ set -- "$@" -v "${KAS_REPO_DIR}":/repo:${KAS_REPO_MOUNT_OPT} \

if [ -n "${KAS_SSH_DIR}" ] ; then
if [ ! -d "${KAS_SSH_DIR}" ]; then
echo "Passed KAS_SSH_DIR '${KAS_SSH_DIR}' is not a directory"
exit 1
fatal_error "passed KAS_SSH_DIR '${KAS_SSH_DIR}' is not a directory"
fi
set -- "$@" -v "$(readlink -fv "${KAS_SSH_DIR}")":/var/kas/userdata/.ssh:ro
fi

if [ -n "${KAS_SSH_AUTH_SOCK}" ]; then
if [ ! -S "${KAS_SSH_AUTH_SOCK}" ]; then
echo "Passed SSH_AUTH_SOCK '${KAS_SSH_AUTH_SOCK}' is not a socket"
exit 1
fatal_error "passed SSH_AUTH_SOCK '${KAS_SSH_AUTH_SOCK}' is not a socket"
fi
set -- "$@" -v "${KAS_SSH_AUTH_SOCK}":/ssh-agent/ssh-auth-sock \
-e SSH_AUTH_SOCK=/ssh-agent/ssh-auth-sock
fi

if [ -n "${KAS_AWS_DIR}" ] ; then
if [ ! -d "${KAS_AWS_DIR}" ]; then
echo "Passed KAS_AWS_DIR '${KAS_AWS_DIR}' is not a directory"
exit 1
fatal_error "passed KAS_AWS_DIR '${KAS_AWS_DIR}' is not a directory"
fi
set -- "$@" -v "$(readlink -fv "${KAS_AWS_DIR}")":/var/kas/userdata/.aws:ro \
-e AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-/var/kas/userdata/.aws/config}" \
-e AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-/var/kas/userdata/.aws/credentials}"
fi
if [ -n "${AWS_WEB_IDENTITY_TOKEN_FILE}" ] ; then
if [ ! -f "${AWS_WEB_IDENTITY_TOKEN_FILE}" ]; then
echo "Passed AWS_WEB_IDENTITY_TOKEN_FILE '${AWS_WEB_IDENTITY_TOKEN_FILE}' is not a directory"
exit 1
fi
set -- "$@" -v "$(readlink -fv "${AWS_WEB_IDENTITY_TOKEN_FILE}")":/var/kas/userdata/.aws/web_identity_token:ro \
-e AWS_WEB_IDENTITY_TOKEN_FILE="${AWS_CONFIG_FILE:-/var/kas/userdata/.aws/web_identity_token}" \
-e AWS_ROLE_ARN="${AWS_ROLE_ARN}"
fi

KAS_GIT_CREDENTIAL_HELPER_DEFAULT=""

if [ -n "${KAS_GIT_CREDENTIAL_STORE}" ] ; then
if [ ! -f "${KAS_GIT_CREDENTIAL_STORE}" ]; then
echo "Passed KAS_GIT_CREDENTIAL_STORE '${KAS_GIT_CREDENTIAL_STORE}' is not a file"
exit 1
fatal_error "passed KAS_GIT_CREDENTIAL_STORE '${KAS_GIT_CREDENTIAL_STORE}' is not a file"
fi
KAS_GIT_CREDENTIAL_HELPER_DEFAULT="store --file=/var/kas/userdata/.git-credentials"
set -- "$@" -v "$(readlink -fv "${KAS_GIT_CREDENTIAL_STORE}")":/var/kas/userdata/.git-credentials:ro
Expand All @@ -483,6 +507,11 @@ if [ -f "${NETRC_FILE}" ]; then
-e NETRC_FILE="/var/kas/userdata/.netrc"
fi

if [ -f "${GITCONFIG_FILE}" ]; then
set -- "$@" -v "$(readlink -fv "${GITCONFIG_FILE}")":/var/kas/userdata/.gitconfig:ro \
-e GITCONFIG_FILE="/var/kas/userdata/.gitconfig"
fi

if [ -t 1 ]; then
set -- "$@" -t -i
fi
Expand All @@ -500,18 +529,24 @@ if [ -n "${SSTATE_DIR}" ]; then
-v "$(readlink -fv "${SSTATE_DIR}")":/sstate:rw \
-e SSTATE_DIR=/sstate
fi
if [ -n "${SSTATE_MIRRORS}" ]; then
if echo "${SSTATE_MIRRORS}" | grep -q "file:///"; then
warning "SSTATE_MIRRORS contains a local path." \
"Make sure to make this path available inside the container."
fi
set -- "$@" -e "SSTATE_MIRRORS=${SSTATE_MIRRORS}"
fi

if [ -n "${KAS_REPO_REF_DIR}" ]; then
if [ ! -d "${KAS_REPO_REF_DIR}" ]; then
echo "Passed KAS_REPO_REF_DIR '${KAS_REPO_REF_DIR}' is not a directory"
exit 1
fatal_error "Passed KAS_REPO_REF_DIR '${KAS_REPO_REF_DIR}' is not a directory"
fi
set -- "$@" \
-v "$(readlink -fv "${KAS_REPO_REF_DIR}")":/repo-ref:rw \
-e KAS_REPO_REF_DIR=/repo-ref
fi

for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK \
for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK KAS_CLONE_DEPTH \
KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS PARALLEL_MAKE \
GIT_CREDENTIAL_USEHTTPPATH; do
if [ -n "$(eval echo \$${var})" ]; then
Expand Down Expand Up @@ -559,4 +594,5 @@ while [ $KAS_EXTRA_BITBAKE_ARGS -gt 0 ]; do
KAS_EXTRA_BITBAKE_ARGS=$((KAS_EXTRA_BITBAKE_ARGS - 1))
done

# shellcheck disable=SC2086
trace ${KAS_CONTAINER_COMMAND} run "$@"
6 changes: 3 additions & 3 deletions kas/iot2050.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) Siemens AG, 2019-2023
# Copyright (c) Siemens AG, 2019-2024
#
# Authors:
# Le Jin <[email protected]>
Expand Down Expand Up @@ -27,13 +27,13 @@ repos:

isar:
url: https://github.com/ilbers/isar
commit: 9dc362cd7115074c0f60843e687ed89db5c9339a
commit: a2a997b66daf3d684a7ad29108971a463cfac522
layers:
meta:

cip-core:
url: https://gitlab.com/cip-project/cip-core/isar-cip-core.git
commit: 704353612238cb2ac1c16f29db6f314b60cd83b0
commit: bafd102601ae21c2b2643d536d62fb7cc5f98767

local_conf_header:
standard: |
Expand Down
Loading