From 4db6ead3dabc0bc35aa07e2fa8d994cd82a0abda Mon Sep 17 00:00:00 2001 From: Francesco Valla Date: Mon, 8 Jul 2024 00:39:27 +0200 Subject: [PATCH 1/2] distro-entry.sh: remove hardcoded SDK release number Remove the hardcoded Poky SDK release number from the distro-entry.sh script, which will select automatically the environment setup script with the higher release version in its path. Signed-off-by: Francesco Valla --- distro-entry.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/distro-entry.sh b/distro-entry.sh index b932828..a077afb 100755 --- a/distro-entry.sh +++ b/distro-entry.sh @@ -4,21 +4,15 @@ # SPDX-License-Identifier: GPL-2.0-only # -RELEASE="4.1" +ARCH="$(uname -m)" -if [ "$(uname -m)" = "aarch64" ]; then - SETUPSCRIPT="environment-setup-aarch64-pokysdk-linux" -elif [ "$(uname -m)" = "x86_64" ]; then - SETUPSCRIPT="environment-setup-x86_64-pokysdk-linux" -fi +# Search the environment setup script with the higher version number +SETUPSCRIPT="$(find /opt/poky -type f -name environment-setup-${ARCH}-pokysdk-linux 2>/dev/null | sort -r | head -n 1)" # This entry point is so that we can do distro specific changes to the launch. -if [ -e /opt/poky/${RELEASE}/${SETUPSCRIPT} ]; then +if [ ! -z "${SETUPSCRIPT}" ]; then # Buildtools has been installed so enable it - . /opt/poky/${RELEASE}/${SETUPSCRIPT} || exit 1 -elif [ -e /opt/poky/${RELEASE}/${SETUPSCRIPT} ]; then - # Buildtools(-make) has been installed so enable it - . /opt/poky/${RELEASE}/${SETUPSCRIPT} || exit 1 + . ${SETUPSCRIPT} || exit 1 fi exec "$@" From 92e9b9281672112624f64c01cda863231bb2322e Mon Sep 17 00:00:00 2001 From: Francesco Valla Date: Tue, 9 Jul 2024 14:39:30 +0200 Subject: [PATCH 2/2] Enhance install-buildtools.sh Various modifications to install-buildtools.sh: - perform a cleaner sanity check on the host architecture - download sha256sum file from yoctoproject.org instead of hardcoding the SHA256 of each setup script - make the buildtools type configurable from a command line parameter (this allows to remove install-buildtools-make.sh) Signed-off-by: Francesco Valla --- build_container.sh | 1 - .../alma/alma-8/alma-8-base/Dockerfile | 2 +- .../alma/alma-9/alma-9-base/Dockerfile | 6 +-- .../centos/centos-7/centos-7-base/Dockerfile | 2 +- .../debian-10/debian-10-base/Dockerfile | 2 +- .../fedora-40/fedora-40-base/Dockerfile | 2 +- .../opensuse-15.4-base/Dockerfile | 2 +- .../opensuse-15.5-base/Dockerfile | 2 +- .../ubuntu-18.04/ubuntu-18.04-base/Dockerfile | 2 +- install-buildtools-make.sh | 31 --------------- install-buildtools.sh | 38 +++++++++++++------ 11 files changed, 37 insertions(+), 53 deletions(-) delete mode 100644 install-buildtools-make.sh diff --git a/build_container.sh b/build_container.sh index ae9233e..58d2d28 100755 --- a/build_container.sh +++ b/build_container.sh @@ -27,7 +27,6 @@ workdir=$workdir/$TAG cp build-install-dumb-init.sh $workdir cp install-buildtools.sh $workdir -cp install-buildtools-make.sh $workdir cd $workdir baseimage=`grep FROM Dockerfile | sed -e 's/FROM //'` diff --git a/dockerfiles/alma/alma-8/alma-8-base/Dockerfile b/dockerfiles/alma/alma-8/alma-8-base/Dockerfile index be9c8f6..c1bb434 100644 --- a/dockerfiles/alma/alma-8/alma-8-base/Dockerfile +++ b/dockerfiles/alma/alma-8/alma-8-base/Dockerfile @@ -67,7 +67,7 @@ RUN dnf install -y 'dnf-command(config-manager)' && \ # of -make, install all the buildtools COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/alma/alma-9/alma-9-base/Dockerfile b/dockerfiles/alma/alma-9/alma-9-base/Dockerfile index 2ccd2a9..fee989e 100644 --- a/dockerfiles/alma/alma-9/alma-9-base/Dockerfile +++ b/dockerfiles/alma/alma-9/alma-9-base/Dockerfile @@ -64,9 +64,9 @@ RUN dnf install -y 'dnf-command(config-manager)' && \ # Install buildtools-make. The original reason this was needed was due to a # sanity check for make 4.1.2 -COPY install-buildtools-make.sh / -RUN bash /install-buildtools-make.sh && \ - rm /install-buildtools-make.sh +COPY install-buildtools.sh / +RUN bash /install-buildtools.sh make && \ + rm /install-buildtools.sh COPY build-install-dumb-init.sh / RUN bash build-install-dumb-init.sh && \ diff --git a/dockerfiles/centos/centos-7/centos-7-base/Dockerfile b/dockerfiles/centos/centos-7/centos-7-base/Dockerfile index b89fab1..93b0c0d 100644 --- a/dockerfiles/centos/centos-7/centos-7-base/Dockerfile +++ b/dockerfiles/centos/centos-7/centos-7-base/Dockerfile @@ -57,7 +57,7 @@ RUN yum -y install epel-release centos-release-scl && \ # build recent Yocto Project releases. Install the buildtools tarball to # provide the required tools. COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/debian/debian-10/debian-10-base/Dockerfile b/dockerfiles/debian/debian-10/debian-10-base/Dockerfile index e5c2f0a..2fb3f45 100644 --- a/dockerfiles/debian/debian-10/debian-10-base/Dockerfile +++ b/dockerfiles/debian/debian-10/debian-10-base/Dockerfile @@ -58,7 +58,7 @@ RUN apt-get clean && \ # of -make, install all the buildtools COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/fedora/fedora-40/fedora-40-base/Dockerfile b/dockerfiles/fedora/fedora-40/fedora-40-base/Dockerfile index 21e6983..186c2cb 100644 --- a/dockerfiles/fedora/fedora-40/fedora-40-base/Dockerfile +++ b/dockerfiles/fedora/fedora-40/fedora-40-base/Dockerfile @@ -74,7 +74,7 @@ RUN dnf -y update && \ # Install buildtools for wget COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/opensuse/opensuse-15.4/opensuse-15.4-base/Dockerfile b/dockerfiles/opensuse/opensuse-15.4/opensuse-15.4-base/Dockerfile index 97d9379..6cc251d 100644 --- a/dockerfiles/opensuse/opensuse-15.4/opensuse-15.4-base/Dockerfile +++ b/dockerfiles/opensuse/opensuse-15.4/opensuse-15.4-base/Dockerfile @@ -54,7 +54,7 @@ RUN zypper --non-interactive install \ # of -make, install all the buildtools COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/opensuse/opensuse-15.5/opensuse-15.5-base/Dockerfile b/dockerfiles/opensuse/opensuse-15.5/opensuse-15.5-base/Dockerfile index 2883aae..0bc69d7 100644 --- a/dockerfiles/opensuse/opensuse-15.5/opensuse-15.5-base/Dockerfile +++ b/dockerfiles/opensuse/opensuse-15.5/opensuse-15.5-base/Dockerfile @@ -51,7 +51,7 @@ RUN zypper --non-interactive install \ # of -make, install all the buildtools COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/dockerfiles/ubuntu/ubuntu-18.04/ubuntu-18.04-base/Dockerfile b/dockerfiles/ubuntu/ubuntu-18.04/ubuntu-18.04-base/Dockerfile index c95c321..1a6048f 100644 --- a/dockerfiles/ubuntu/ubuntu-18.04/ubuntu-18.04-base/Dockerfile +++ b/dockerfiles/ubuntu/ubuntu-18.04/ubuntu-18.04-base/Dockerfile @@ -58,7 +58,7 @@ RUN apt-get update && \ # Install buildtools due to python 3.8 COPY install-buildtools.sh / -RUN bash /install-buildtools.sh && \ +RUN bash /install-buildtools.sh extended && \ rm /install-buildtools.sh COPY build-install-dumb-init.sh / diff --git a/install-buildtools-make.sh b/install-buildtools-make.sh deleted file mode 100644 index e9819f1..0000000 --- a/install-buildtools-make.sh +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/bash - -# install-buildtools-make.sh -# -# Copyright (C) 2020-2021 Intel Corporation -# Copyright (C) 2022 Konsulko Group -# -# SPDX-License-Identifier: GPL-2.0-only -# -set -e - -RELEASE="4.1" -if [ "$(uname -m)" = "aarch64" ]; then - BUILDTOOLS="aarch64-buildtools-make-nativesdk-standalone-${RELEASE}.sh" - SHA256SUM="ed241869743ac795d1a988246953df5931f68c22108d6f86ebc485b773d28db4" -elif [ "$(uname -m)" = "x86_64" ]; then - BUILDTOOLS="x86_64-buildtools-make-nativesdk-standalone-${RELEASE}.sh" - SHA256SUM="d9cc8a4f76392e23f9b2854af78d460e99bb5e4cbb82de6ccca0f6be7506f652" -else - echo "Unsupported architecture, can't install buildtools-make." - exit 1 -fi - -wget https://downloads.yoctoproject.org/releases/yocto/yocto-${RELEASE}/buildtools/${BUILDTOOLS} - -echo "${SHA256SUM} ${BUILDTOOLS}" > SHA256SUMS -sha256sum -c SHA256SUMS -rm SHA256SUMS - -bash ${BUILDTOOLS} -y -rm ${BUILDTOOLS} diff --git a/install-buildtools.sh b/install-buildtools.sh index 73fc266..ead1c6a 100644 --- a/install-buildtools.sh +++ b/install-buildtools.sh @@ -9,22 +9,38 @@ set -e RELEASE="4.1" -if [ "$(uname -m)" = "aarch64" ]; then - BUILDTOOLS="aarch64-buildtools-extended-nativesdk-standalone-${RELEASE}.sh" - SHA256SUM="d5c0dd3e43c62f0465a9335f450d9f5f6861e4b3d39b0f04174bd50e6861c96e" -elif [ "$(uname -m)" = "x86_64" ]; then - BUILDTOOLS="x86_64-buildtools-extended-nativesdk-standalone-${RELEASE}.sh" - SHA256SUM="d360ac01016c848f713d6dd7848f25d0a5319e96e2dd279ab37ffcbd7320dbbe" + +ARCH="$(uname -m)" +case "${ARCH}" in + aarch64|x86_64) + ;; + *) + echo "Unsupported architecture '${ARCH}', can't install buildtools." + exit 1 + ;; +esac + +if [ $# -eq 0 ]; then + BUILDTOOLS="${ARCH}-buildtools-nativesdk-standalone-${RELEASE}.sh" else - echo "Unsupported architecture, can't install buildtools-make." - exit 1 + TYPE="${1}" + case "${TYPE}" in + docs|extended|make) + ;; + *) + echo "Invalid buildtools type '${TYPE}'." + exit 1 + ;; + esac + BUILDTOOLS="${ARCH}-buildtools-${TYPE}-nativesdk-standalone-${RELEASE}.sh" fi + +wget https://downloads.yoctoproject.org/releases/yocto/yocto-${RELEASE}/buildtools/${BUILDTOOLS}.sha256sum wget https://downloads.yoctoproject.org/releases/yocto/yocto-${RELEASE}/buildtools/${BUILDTOOLS} -echo "${SHA256SUM} ${BUILDTOOLS}" > SHA256SUMS -sha256sum -c SHA256SUMS -rm SHA256SUMS +sha256sum -c ${BUILDTOOLS}.sha256sum +rm ${BUILDTOOLS}.sha256sum bash ${BUILDTOOLS} -y rm ${BUILDTOOLS}