public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>,
	Baurzhan Ismagulov <ibr@ilbers.de>
Cc: Chao Zeng <chao.zeng@siemens.com>, Le Jin <le.jin@siemens.com>,
	Christopher Larson <kergoth@gmail.com>
Subject: Re: [PATCH v3 5/6] sdk: Inject sysroot path when calling relocated toolchain
Date: Mon, 31 Aug 2020 18:32:23 +0200	[thread overview]
Message-ID: <e1b959e8-164a-592b-ff44-9d21139c3416@siemens.com> (raw)
In-Reply-To: <d88a7256-0661-6137-ab36-c6e3e92c4696@siemens.com>

On 14.07.20 22:22, [ext] Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This removes the need to specify --sysroot=/path/to/sdkroot when calling
> gcc or ld from the SDK.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Changes in v3:
>  - fix ARMv7
> 
> I just had to pull this into another downstream layer today, so I 
> thought it would be good to send this update and remember the whole 
> series.
> 
>  meta/classes/image-sdk-extension.bbclass         |  8 ++++++++
>  .../sdkchroot/files/gcc-sysroot-wrapper.sh       | 16 ++++++++++++++++
>  .../sdkchroot/files/relocate-sdk.sh              |  3 +++
>  meta/recipes-devtools/sdkchroot/sdkchroot.bb     |  2 ++
>  4 files changed, 29 insertions(+)
>  create mode 100755 meta/recipes-devtools/sdkchroot/files/gcc-sysroot-wrapper.sh
> 
> diff --git a/meta/classes/image-sdk-extension.bbclass b/meta/classes/image-sdk-extension.bbclass
> index 6e76b04d..ebc6f342 100644
> --- a/meta/classes/image-sdk-extension.bbclass
> +++ b/meta/classes/image-sdk-extension.bbclass
> @@ -32,6 +32,14 @@ do_populate_sdk() {
>          fi
>      done
>  
> +    # Set up sysroot wrapper
> +    for tool_pattern in "gcc-[0-9]*" "g++-[0-9]*" "cpp-[0-9]*" "ld.bfd" "ld.gold"; do
> +        for tool in $(find ${SDKCHROOT_DIR}/usr/bin -type f -name "*-linux-gnu*-${tool_pattern}"); do
> +            sudo mv "${tool}" "${tool}.bin"
> +            sudo ln -sf gcc-sysroot-wrapper.sh ${tool}
> +        done
> +    done
> +
>      # Copy mount_chroot.sh for convenience
>      sudo cp ${ISARROOT}/scripts/mount_chroot.sh ${SDKCHROOT_DIR}
>  
> diff --git a/meta/recipes-devtools/sdkchroot/files/gcc-sysroot-wrapper.sh b/meta/recipes-devtools/sdkchroot/files/gcc-sysroot-wrapper.sh
> new file mode 100755
> index 00000000..feead1a1
> --- /dev/null
> +++ b/meta/recipes-devtools/sdkchroot/files/gcc-sysroot-wrapper.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2020
> +#
> +# SPDX-License-Identifier: MIT
> +
> +GCC_SYSROOT=
> +
> +NEXT_TARGET=$0
> +until [ "${NEXT_TARGET##*/}" = "gcc-sysroot-wrapper.sh" ]; do
> +	TARGET=${NEXT_TARGET}
> +	NEXT_TARGET=$(dirname ${TARGET})/$(readlink ${TARGET})
> +done
> +
> +${TARGET}.bin --sysroot=${GCC_SYSROOT} "$@"
> diff --git a/meta/recipes-devtools/sdkchroot/files/relocate-sdk.sh b/meta/recipes-devtools/sdkchroot/files/relocate-sdk.sh
> index 1c9b02fa..0d1c6330 100755
> --- a/meta/recipes-devtools/sdkchroot/files/relocate-sdk.sh
> +++ b/meta/recipes-devtools/sdkchroot/files/relocate-sdk.sh
> @@ -38,4 +38,7 @@ for binary in $(find ${sdkroot}/usr/bin ${sdkroot}/usr/sbin ${sdkroot}/usr/lib/g
>  	fi
>  done
>  
> +sed -i 's|^GCC_SYSROOT=.*|GCC_SYSROOT="'"${new_sdkroot}"'"|' \
> +    ${sdkroot}/usr/bin/gcc-sysroot-wrapper.sh
> +
>  echo "done"
> diff --git a/meta/recipes-devtools/sdkchroot/sdkchroot.bb b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
> index dc765046..bf3f6fb4 100644
> --- a/meta/recipes-devtools/sdkchroot/sdkchroot.bb
> +++ b/meta/recipes-devtools/sdkchroot/sdkchroot.bb
> @@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
>  SRC_URI = " \
>      file://configscript.sh \
>      file://relocate-sdk.sh \
> +    file://gcc-sysroot-wrapper.sh \
>      file://README.sdk"
>  PV = "0.1"
>  
> @@ -54,6 +55,7 @@ sdkchroot_install_files() {
>      # Configure root filesystem
>      sudo install -m 644 ${WORKDIR}/README.sdk ${S}
>      sudo install -m 755 ${WORKDIR}/relocate-sdk.sh ${S}
> +    sudo install -m 755 ${WORKDIR}/gcc-sysroot-wrapper.sh ${S}/usr/bin
>      sudo install -m 755 ${WORKDIR}/configscript.sh ${S}
>      sudo chroot ${S} /configscript.sh  ${DISTRO_ARCH}
>  }
> 

Ping³ on the whole series. I carrying too many patches downstream for
too long.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2020-08-31 16:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-28 11:24 [PATCH v2 0/6] Evolve SDK to chroot-free usage Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 1/6] sdk: Add support for adding self-defined sdk packages Jan Kiszka
2020-06-08 10:22   ` Jan Kiszka
2020-06-12  9:34     ` Baurzhan Ismagulov
2020-06-12  9:54       ` Jan Kiszka
2020-06-12 10:05         ` Jan Kiszka
2020-06-12 10:30           ` Jan Kiszka
2020-06-22  8:09           ` Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 2/6] sdk: Make all links in the SDK chroot relative Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 3/6] sdk: Add script to relocate SDK Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 4/6] sdk: Do not ship the isar-apt repo Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 5/6] sdk: Inject sysroot path when calling relocated toolchain Jan Kiszka
2020-07-14 20:22   ` [PATCH v3 " Jan Kiszka
2020-08-31 16:32     ` Jan Kiszka [this message]
2020-09-21  9:27       ` Jan Kiszka
2020-09-21 10:05         ` Baurzhan Ismagulov
2020-09-21 11:47           ` Jan Kiszka
2020-03-28 11:24 ` [PATCH v2 6/6] sdk: Update README.sdk Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1b959e8-164a-592b-ff44-9d21139c3416@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=chao.zeng@siemens.com \
    --cc=ibr@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=kergoth@gmail.com \
    --cc=le.jin@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox