[elbe-devel] [PATCH v2] build_sdk toolchain-shar-extract.sk.mako: only try to reloc ELF executables
Torben Hohn
torben.hohn at linutronix.de
Wed Apr 24 15:38:58 CEST 2019
On Wed, Apr 24, 2019 at 03:18:29PM +0200, Manuel Traut wrote:
> On 15:14 Wed 24 Apr , Torben Hohn wrote:
> > scripts are marked executable, but are not suposed to be relocated using
> > patchelf. Trying to get patchelf to relocate a script yields an error,
> > and stops the rlocation process.
> >
> > Use file to check whether the executables are actually elf files.
> >
> > Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
>
> What if 'file' is not installed? IMHO it's e.g. not there on a minimal Debian
> installation.
>
> Shouldn't we add something like we have for patchelf?
yeah.
>
> --8<--
> PATCHELF=\`which patchelf 2>/dev/null\`
>
> if [ x\$PATCHELF = "x" ]; then
> echo "SDK could not be relocated. No patchelf found."
> echo "use 'sudo apt install patchelf' on Debian"
> exit 1
> fi
> --8<--
>
> > ---
> > elbepack/makofiles/toolchain-shar-extract.sh.mako | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> > index 96810aad..40e2dc86 100644
> > --- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
> > +++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> > @@ -280,7 +280,10 @@ if [ "$dl_path" = "" ] ; then
> > exit 1
> > fi
> > executable_files=$($SUDO_EXEC find $native_sysroot -type f \
> > - \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
> > + \( -perm -0100 -o -perm -0010 -o -perm -0001 \) \
> > + -exec sh -c "file {} | grep -Pi ': elf (32|64)-bit' > /dev/null" \; \
> > + -printf "'%h/%f' ")
> > +
> > if [ "x$executable_files" = "x" ]; then
> > echo "SDK relocate failed, could not get executalbe files"
> > exit 1
> > --
> > 2.11.0
> >
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190424/270ee782/attachment.sig>
More information about the elbe-devel
mailing list