From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 2/2] Makefile: add check of binaries architecture
Date: Sun, 12 Mar 2017 22:57:59 +0100 [thread overview]
Message-ID: <20170312225759.136e0f50@free-electrons.com> (raw)
In-Reply-To: <aa76136f-f6cb-0746-319c-c71f0812cc26@mind.be>
Hello,
On Sun, 12 Mar 2017 21:27:41 +0100, Arnout Vandecappelle wrote:
> > +ifneq ($(READELF_ARCH_NAME),)
>
> We set it for all arches, so this is never empty. Except when we forget to set
> it, but in that case we probably want this thing to be executed so we notice.
It was sometimes empty at the beginning of my tests, and then I decided
to provide the value for all architectures we support. So yes, this
test has been removed in my v3.
> It would be nice to do it immediately after package install, so it becomes a
> package error rather than some post-build error that is more difficult to
> localise. Of course, with Yann's suggestion it would still report which package
> was the culprit, but I don't think it would show up in the autobuild results
> under the right package.
>
> To avoid too much overhead rechecking files all the time, it could be done as
> part of step_pkg_size_end which iterates over the files installed in target for
> that particular package. It would make the code a little more complicated,
> though, and perhaps also slower.
I've implemented this in my v3. The code is not much more complicated
in fact.
> Top-level Makefile already exports TARGET_DIR, so no need to pass it as an
> argument. And it's not as if this script is meant to be ran outside of the build.
OK.
> This could also be grepped out of BR2_CONFIG, like mkusers does it.
Implemented.
> As observed by Wolfgang in the context of rpath sanitisation, file is pretty
> inefficient. We came to the conclusion that the most efficient is just checking
> the first 4 bytes (0x7f 0x45 0x4c 0x46). Since it is also needed for the rpath
> sanitisation, perhaps we should have a common script, or even compiled code, to
> do this check.
I'm not using just readelf, and if the sed expression extracting the
Machine value returns an empty string, assume it's not an ELF file.
It would be nice to get the return value of readelf, but being in a
subshell, before a pipe, it's not trivial (at least not trivial
compared to my limited bash-fu).
> Why not the simpler sed -n '/^ Machine: *\(.*\)/s//\1/p' instead of the extra
> grep?
Implemented, using Yann's suggestion.
Thanks for the useful suggestions!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
prev parent reply other threads:[~2017-03-12 21:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-12 17:49 [Buildroot] [PATCH v2 1/2] arch: add BR2_READELF_ARCH_NAME hidden config option Thomas Petazzoni
2017-03-12 17:49 ` [Buildroot] [PATCH v2 2/2] Makefile: add check of binaries architecture Thomas Petazzoni
2017-03-12 18:05 ` Yann E. MORIN
2017-03-12 18:21 ` Yann E. MORIN
2017-03-12 19:43 ` Arnout Vandecappelle
2017-03-12 20:11 ` Yann E. MORIN
2017-03-13 17:06 ` Arnout Vandecappelle
2017-03-13 18:05 ` Yann E. MORIN
2017-03-12 20:27 ` Arnout Vandecappelle
2017-03-12 20:42 ` Yann E. MORIN
2017-03-12 20:58 ` Wolfgang Grandegger
2017-03-12 21:34 ` Arnout Vandecappelle
2017-03-12 21:57 ` Thomas Petazzoni [this message]
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=20170312225759.136e0f50@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/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