Skip to contentSkip to conversation

support/check-bin-arch: add support for excluding arbitrary locations

PATCH Superseded Yann E. MORIN 2 participants 8 messages Mar 7, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover support/check-bin-arch: add support for excluding arbitrary locations

Hello All!

Users have started reporting issues with this check, when they have local packages (mostly out-of-tree, proprietary) that install binary blobs (like co-processor firmwares) in arbitrary locations, like /opt, which we currently do not exclude from the check.

Regards,
Yann E. MORIN.

The following changes since commit 74295b02d4b380e5267357be0ae1281c7410cdc2

ipset: bump to version 6.36 (2018-03-06 15:44:18 +0100)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to ce786b49c9bbe6a3e2ebde9ca28b56de86e68b2e

support/check-bin-arch: exclude kernel modules for merged /usr (2018-03-07 21:17:11 +0100)

----------------------------------------------------------------
Yann E. MORIN (2):
spport/check-bin-arch: accept arbitrary ignore paths support/check-bin-arch: exclude kernel modules for merged /usr

 docs/manual/adding-packages-generic.txt |  7 ++++
 package/pkg-generic.mk                  |  1 +
 support/scripts/check-bin-arch          | 59 +++++++++++++++++++++------------
 3 files changed, 45 insertions(+), 22 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/2 spport/check-bin-arch: accept arbitrary ignore paths

Some packages (mostly, out-of-tree) may want to install binary blobs for another architecture, outside the locations we currently exclude, like in /opt or whatever...

Add support in check-bin-arch to accept any arbitrary location, that individual package can each request to excude from the check, when they are installed.

Cc Peter Korsgaard <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 docs/manual/adding-packages-generic.txt |  7 ++++
 package/pkg-generic.mk                  |  1 +
 support/scripts/check-bin-arch          | 58 ++++++++++++++++++++-------------
 3 files changed, 44 insertions(+), 22 deletions(-)
docs/manual/adding-packages-generic.txt +7 -0
index 63ea51bf89..1f5d92d2c9 100644
@@ -453,6 +453,13 @@ information is (assuming the package name is +libfoo+) :
   FLAT binary format is only 4k bytes. If the application consumes more stack,
   append the required number here.
 
+* +LIBFOO_BIN_ARCH_EXCLUDE+ is a space-separated list of path (relative
+  to the target directory) to ignore when checking that the package
+  installs correctly cross-compiled binaries. You seldom need to set this
+  variable, unless the package installs installs binary blobs in the
+  non-default locations: `/lib/firmware`, `/usr/lib/firmware`,
+  `/lib/modules`, and `/usr/share`.
+
 The recommended way to define these variables is to use the following
 syntax:
 
package/pkg-generic.mk +1 -0
index a2a12e7b56..9eddaeee57 100644
@@ -112,6 +112,7 @@ define check_bin_arch
 	$(if $(filter end-install-target,$(1)-$(2)),\
 		support/scripts/check-bin-arch -p $(3) \
 			-l $(BUILD_DIR)/packages-file-list.txt \
+			$(foreach i,$($(PKG)_BIN_ARCH_EXCLUDE),-i "$(i)") \
 			-r $(TARGET_READELF) \
 			-a $(BR2_READELF_ARCH_NAME))
 endef
support/scripts/check-bin-arch +36 -22

80 lines not on this page · raw message

Signature · 1 line
2.14.1
#4 lore raw

PATCH 2/2 support/check-bin-arch: exclude kernel modules for merged /usr

In reply to Yann E. MORIN

When using a merged /usr, the kernel module path is really /usr/lib/modules, as /lib is a symlink to usr/lib .

Cc Thomas Petazzoni <[email protected]>
---
 support/scripts/check-bin-arch | 1 +
 1 file changed, 1 insertion(+)
support/scripts/check-bin-arch +1 -0
index 922791ab89..258014b98f 100755
@@ -14,6 +14,7 @@ declare -a IGNORES=(
 	# and its modules may still be 64-bit. To keep the basic
 	# check-bin-arch logic simple, just skip this directory.
 	"/lib/modules"
+	"/usr/lib/modules"
 
 	# Skip files in /usr/share, several packages (qemu,
 	# pru-software-support) legitimately install ELF binaries that
Signature · 1 line
2.14.1
#2 lore raw

PATCH 1/2 spport/check-bin-arch: accept arbitrary ignore paths

In reply to Yann E. MORIN
Quoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Some packages (mostly, out-of-tree) may want to install binary blobs for another architecture, outside the locations we currently exclude, like in /opt or whatever...

Add support in check-bin-arch to accept any arbitrary location, that individual package can each request to excude from the check, when they are installed.

Cc Peter Korsgaard <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 docs/manual/adding-packages-generic.txt |  7 ++++
 package/pkg-generic.mk                  |  1 +
 support/scripts/check-bin-arch          | 58 ++++++++++++++++++++-------------
 3 files changed, 44 insertions(+), 22 deletions(-)
docs/manual/adding-packages-generic.txt +0 -0
index 63ea51bf89..1f5d92d2c9 100644

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 456

Quoted 4 lines
docs/manual/adding-packages-generic.txt +1 -0
@@ -453,6 +453,13 @@ information is (assuming the package name is +libfoo+) :
   FLAT binary format is only 4k bytes. If the application consumes more stack,
   append the required number here.
 
+* +LIBFOO_BIN_ARCH_EXCLUDE+ is a space-separated list of path (relative

s/path/paths/

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 459

Quoted 3 lines
docs/manual/adding-packages-generic.txt +3 -0
+  to the target directory) to ignore when checking that the package
+  installs correctly cross-compiled binaries. You seldom need to set this
+  variable, unless the package installs installs binary blobs in the

s/installs installs/installs/

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 461

Quoted 2 lines
docs/manual/adding-packages-generic.txt +2 -0
+  non-default locations: `/lib/firmware`, `/usr/lib/firmware`,
+  `/lib/modules`, and `/usr/share`.

This sounds a bit confusing to me, E.G. like these are non default locations.

Perhaps we should instead write:

variable, unless the package installs binary blobs outside the default locations, which are /lib/firmware, /usr/lib/firmware, /lib/modules and '/usr/share`, as these locations are automatically excluded.

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 463

Quoted 3 lines
docs/manual/adding-packages-generic.txt +1 -1
 if test -z "${package}" -o -z "${pkg_list}" -o -z "${readelf}" -o -z "${arch_name}" ; then
-	echo "Usage: $0 -p <pkg> -l <pkg-file-list> -r <readelf> -a <arch name>"
+	echo "Usage: $0 -p <pkg> -l <pkg-file-list> -r <readelf> -a <arch name> [-i PATTERN ...]"

We don't really document this as a pattern (even if it gets passed to ~= in the end), so perhaps it would be clearer to say [ -i PATH ]?

Otherwise it looks good to me, thanks!

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 2/2 support/check-bin-arch: exclude kernel modules for merged /usr

In reply to Yann E. MORIN
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

When using a merged /usr, the kernel module path is really /usr/lib/modules, as /lib is a symlink to usr/lib .

Cc Thomas Petazzoni <[email protected]>
Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/2 spport/check-bin-arch: accept arbitrary ignore paths

In reply to Peter Korsgaard

Peter, All,

On 2018-03-07 21:45 +0100, Peter Korsgaard spake thusly:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

[--SNIP--]

Quoted 6 lines
Quoted 1 line

+* +LIBFOO_BIN_ARCH_EXCLUDE+ is a space-separated list of path (relative

s/path/paths/

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 459

Quoted 3 lines
docs/manual/adding-packages-generic.txt +3 -0
+  to the target directory) to ignore when checking that the package
+  installs correctly cross-compiled binaries. You seldom need to set this
+  variable, unless the package installs installs binary blobs in the

s/installs installs/installs/

Typoes fixed.

Quoted 6 lines

docs/manual/adding-packages-generic.txt information is (assuming the package name is +libfoo+) : · line 461

Quoted 2 lines
docs/manual/adding-packages-generic.txt +2 -0
+  non-default locations: `/lib/firmware`, `/usr/lib/firmware`,
+  `/lib/modules`, and `/usr/share`.

This sounds a bit confusing to me, E.G. like these are non default locations.

Quoted 6 lines

Perhaps we should instead write:

variable, unless the package installs binary blobs outside the default locations, which are /lib/firmware, /usr/lib/firmware, /lib/modules and '/usr/share`, as these locations are automatically excluded.

Indeed, it was not clear (except maybe just in my twisted head). I've rephrased slightly differently from your suggestion, but if you don;t like it, we can go with yours instead.

Quoted 6 lines

support/scripts/check-bin-arch line 44

Quoted 3 lines

if test -z "${package}" -o -z "${pkg_list}" -o -z "${readelf}" -o -z "${arch_name}" ; then

support/scripts/check-bin-arch +1 -1
-	echo "Usage: $0 -p <pkg> -l <pkg-file-list> -r <readelf> -a <arch name>"
+	echo "Usage: $0 -p <pkg> -l <pkg-file-list> -r <readelf> -a <arch name> [-i PATTERN ...]"

We don't really document this as a pattern (even if it gets passed to ~= in the end), so perhaps it would be clearer to say [ -i PATH ]?

ACK.

Quoted 1 line

Otherwise it looks good to me, thanks!

Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 2/2 support/check-bin-arch: exclude kernel modules for merged /usr

In reply to Peter Korsgaard

Peter, All,

On 2018-03-07 21:45 +0100, Peter Korsgaard spake thusly:

Quoted 9 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

When using a merged /usr, the kernel module path is really /usr/lib/modules, as /lib is a symlink to usr/lib .

Cc Thomas Petazzoni <[email protected]>

But I forgot to update the manual with this new location! ;-)

Should I still cary your rev-tag in round 2?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 2/2 support/check-bin-arch: exclude kernel modules for merged /usr

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Peter, All,
On 2018-03-07 21:45 +0100, Peter Korsgaard spake thusly:

Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

When using a merged /usr, the kernel module path is really /usr/lib/modules, as /lib is a symlink to usr/lib .

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Cc Thomas Petazzoni <[email protected]>

But I forgot to update the manual with this new location! ;-)

Should I still cary your rev-tag in round 2?

Sure!

Signature · 1 line
Bye, Peter Korsgaard