All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant
@ 2020-04-26 22:33 Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex Romain Naour
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

Adding a host variant allow to replace host-python-pycrypto
by host-python-pycryptodomex for crda and optee-os packages.

From [1]:
"PyCryptodome is a fork of PyCrypto, which is not maintained any more
(the last release dates back to 2013 [2]). It exposes almost the same
API, but there are a few incompatibilities [3]."

[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
[2] https://pypi.org/project/pycrypto/#history
[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
---
For master and 2020.02.x.
---
 package/python-pycryptodomex/python-pycryptodomex.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/python-pycryptodomex/python-pycryptodomex.mk b/package/python-pycryptodomex/python-pycryptodomex.mk
index 7bc871678a..1459bb8fc3 100644
--- a/package/python-pycryptodomex/python-pycryptodomex.mk
+++ b/package/python-pycryptodomex/python-pycryptodomex.mk
@@ -15,3 +15,4 @@ PYTHON_PYCRYPTODOMEX_LICENSE = \
 PYTHON_PYCRYPTODOMEX_LICENSE_FILES = LICENSE.rst Doc/LEGAL/COPYRIGHT.pycrypto
 
 $(eval $(python-package))
+$(eval $(host-python-package))
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
@ 2020-04-26 22:33 ` Romain Naour
  2020-05-31 20:39   ` Peter Korsgaard
  2020-04-26 22:33 ` [Buildroot] [PATCH 3/6] boot/optee-os: " Romain Naour
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

From [1]:
"PyCryptodome is a fork of PyCrypto, which is not maintained any more
(the last release dates back to 2013 [2]). It exposes almost the same
API, but there are a few incompatibilities [3]."

[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
[2] https://pypi.org/project/pycrypto/#history
[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html

Update the patch 0001-crda-support-python-3-in-utils-key2pub.py.patch
since it add pycrypto.

From [4]
"CRDA is no longer needed as of kernel v4.15 since commit 007f6c5e6eb45
("cfg80211: support loading regulatory database as firmware file") added
support to use the kernel's firmware request API which looks for the
firmware on /lib/firmware. Because of this CRDA is legacy software for
older kernels. It will continue to be maintained."

[4] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/tree/README?id=9856751feaf7b102547cea678a5da6c94252d83d#n8

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
---
 ...support-python-3-in-utils-key2pub.py.patch | 32 ++++++++++++-------
 package/crda/crda.mk                          |  2 +-
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/package/crda/0001-crda-support-python-3-in-utils-key2pub.py.patch b/package/crda/0001-crda-support-python-3-in-utils-key2pub.py.patch
index fb46d58ed2..f2b9cca2d6 100644
--- a/package/crda/0001-crda-support-python-3-in-utils-key2pub.py.patch
+++ b/package/crda/0001-crda-support-python-3-in-utils-key2pub.py.patch
@@ -1,11 +1,11 @@
-From 4c346aa9e816bddfedc8ac99809fd1ed91bfc8ee Mon Sep 17 00:00:00 2001
+From 8228c484a1533ff904b276c342adcb6310abe272 Mon Sep 17 00:00:00 2001
 From: Taahir Ahmed <ahmed.taahir@gmail.com>
 Date: Wed, 30 Mar 2016 11:23:54 -0300
 Subject: [PATCH] crda: support python 3 in utils/key2pub.py
 
 utils/key2pub.py can now be run under either python 2.7 or python 3.x.
 This required some minor syntactical changes as well as switching from
-M2Crypto to pycrypto, since M2Crypto doesn't support python 3.x.
+M2Crypto to pycryptodomex, since M2Crypto doesn't support python 3.x.
 
 In addition, some errors in the generated source file keys-ssl.h are
 fixed:
@@ -17,12 +17,22 @@ fixed:
 
 [Gustavo: don't call /utils/key2pub.py since that doesn't compute]
 
+Use pycryptodomex insdead of pycrypto
+
+From [1]:
+"PyCryptodome is a fork of PyCrypto, which is not maintained any more
+(the last release dates back to 2013 [2]). It exposes almost the same
+API, but there are a few incompatibilities [3]."
+
+[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
+[2] https://pypi.org/project/pycrypto/#history
+[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
+
 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
 [Rebased against crda-4.14]
 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
----
-Status: submitted upstream by author but not (yet) accepted
-URL: http://www.spinics.net/lists/linux-wireless/msg138936.html
+[Romain: Use pycryptodomex]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
 ---
  Makefile         |   2 +-
  utils/key2pub.py | 146 ++++++++++++++++++++++++-----------------------
@@ -42,7 +52,7 @@ index a3ead30..8da38d0 100644
  $(LIBREG): regdb.h reglib.h reglib.c
  	$(NQ) '  CC  ' $@
 diff --git a/utils/key2pub.py b/utils/key2pub.py
-index 9bb04cd..9f92ebd 100755
+index 9bb04cd..8a0ba2a 100755
 --- a/utils/key2pub.py
 +++ b/utils/key2pub.py
 @@ -1,126 +1,128 @@
@@ -57,11 +67,11 @@ index 9bb04cd..9f92ebd 100755
 -       sys.stderr.write('Please install the "M2Crypto" Python module.\n')
 -       sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
 -       sys.exit(1)
-+    from Crypto.PublicKey import RSA
++    from Cryptodome.PublicKey import RSA
 +except ImportError as e:
-+    sys.stderr.write('ERROR: Failed to import the "Crypto.PublicKey" module: %s\n' % e.message)
-+    sys.stderr.write('Please install the "Crypto.PublicKey" Python module.\n')
-+    sys.stderr.write('On Debian GNU/Linux the package is called "python-crypto".\n')
++    sys.stderr.write('ERROR: Failed to import the "Cryptodome.PublicKey" module: %s\n' % e.message)
++    sys.stderr.write('Please install the "Cryptodome.PublicKey" Python module.\n')
++    sys.stderr.write('On Debian GNU/Linux the package is called "python-cryptodomex".\n')
 +    sys.exit(1)
 +
 +def bitwise_collect(value, radix_bits):
@@ -269,5 +279,5 @@ index 9bb04cd..9f92ebd 100755
  
  modes[mode][1](output, idx - 1)
 -- 
-2.18.0
+2.25.3
 
diff --git a/package/crda/crda.mk b/package/crda/crda.mk
index eb43a7d772..c5880797be 100644
--- a/package/crda/crda.mk
+++ b/package/crda/crda.mk
@@ -6,7 +6,7 @@
 
 CRDA_VERSION = 4.14
 CRDA_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot
-CRDA_DEPENDENCIES = host-pkgconf host-python-pycrypto libnl libgcrypt
+CRDA_DEPENDENCIES = host-pkgconf host-python-pycryptodomex libnl libgcrypt
 CRDA_LICENSE = ISC
 CRDA_LICENSE_FILES = LICENSE
 
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 3/6] boot/optee-os: replace pycrypto by pycryptodomex
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex Romain Naour
@ 2020-04-26 22:33 ` Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package Romain Naour
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

From [1] included in optee-os release 3.7.0:
"PyCryptodome is a fork of PyCrypto, which is not maintained any more
(the last release dates back to 2013 [2]). It exposes almost the same
API, but there are a few incompatibilities [3]."

pem_to_pub_c.py/sign.py scripts still use pycrypto that is replaced
by pycryptodomex. Add a patch to use pycryptodomex but don't use
upstream commit since it also switches from the algorithm
TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 to TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256
when replacing pycrypto to pycryptodomex [4].

[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
[2] https://pypi.org/project/pycrypto/#history
[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
[4] https://github.com/OP-TEE/optee_os/commit/ababd72d2fd76cb2ded8e202b49db28d6545f6eb

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/526035730

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
---
For master and 2020.02.x.
---
 ...o_pub_c.py-sign.py-use-pycryptodomex.patch | 64 +++++++++++++++++++
 boot/optee-os/optee-os.mk                     |  2 +-
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 boot/optee-os/0001-scripts-pem_to_pub_c.py-sign.py-use-pycryptodomex.patch

diff --git a/boot/optee-os/0001-scripts-pem_to_pub_c.py-sign.py-use-pycryptodomex.patch b/boot/optee-os/0001-scripts-pem_to_pub_c.py-sign.py-use-pycryptodomex.patch
new file mode 100644
index 0000000000..1ce960e0e3
--- /dev/null
+++ b/boot/optee-os/0001-scripts-pem_to_pub_c.py-sign.py-use-pycryptodomex.patch
@@ -0,0 +1,64 @@
+From 06e71feaeb08349abe56b50c3dfb08a8341cf55f Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 26 Apr 2020 21:55:55 +0200
+Subject: [PATCH] scripts/pem_to_pub_c.py/sign.py: use pycryptodomex
+
+These scripts still use pycrypto.
+
+From [1]:
+"PyCryptodome is a fork of PyCrypto, which is not maintained any more
+(the last release dates back to 2013 [2]). It exposes almost the same
+API, but there are a few incompatibilities [3]."
+
+Don't use upstream commit since it also switches from the algorithm
+TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 to TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256
+when replacing pycrypto to pycryptodomex [4].
+
+[1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
+[2] https://pypi.org/project/pycrypto/#history
+[3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
+[4] https://github.com/OP-TEE/optee_os/commit/ababd72d2fd76cb2ded8e202b49db28d6545f6eb
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ scripts/pem_to_pub_c.py | 4 ++--
+ scripts/sign.py         | 8 ++++----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/scripts/pem_to_pub_c.py b/scripts/pem_to_pub_c.py
+index 3a896a39..d3f0e500 100755
+--- a/scripts/pem_to_pub_c.py
++++ b/scripts/pem_to_pub_c.py
+@@ -21,8 +21,8 @@ def get_args():
+ 
+ def main():
+     import array
+-    from Crypto.PublicKey import RSA
+-    from Crypto.Util.number import long_to_bytes
++    from Cryptodome.PublicKey import RSA
++    from Cryptodome.Util.number import long_to_bytes
+ 
+     args = get_args()
+ 
+diff --git a/scripts/sign.py b/scripts/sign.py
+index 2939c591..80ce2e9f 100755
+--- a/scripts/sign.py
++++ b/scripts/sign.py
+@@ -121,10 +121,10 @@ def get_args(logger):
+ 
+ 
+ def main():
+-    from Crypto.Signature import PKCS1_v1_5
+-    from Crypto.Hash import SHA256
+-    from Crypto.PublicKey import RSA
+-    from Crypto.Util.number import ceil_div
++    from Cryptodome.Signature import PKCS1_v1_5
++    from Cryptodome.Hash import SHA256
++    from Cryptodome.PublicKey import RSA
++    from Cryptodome.Util.number import ceil_div
+     import base64
+     import logging
+     import os
+-- 
+2.25.3
+
diff --git a/boot/optee-os/optee-os.mk b/boot/optee-os/optee-os.mk
index acdb25b479..c6d1bbd48a 100644
--- a/boot/optee-os/optee-os.mk
+++ b/boot/optee-os/optee-os.mk
@@ -21,7 +21,7 @@ else
 OPTEE_OS_SITE = $(call github,OP-TEE,optee_os,$(OPTEE_OS_VERSION))
 endif
 
-OPTEE_OS_DEPENDENCIES = host-openssl host-python-pycrypto host-python-pyelftools
+OPTEE_OS_DEPENDENCIES = host-openssl host-python-pycryptodomex host-python-pyelftools
 
 # On 64bit targets, OP-TEE OS can be built in 32bit mode, or
 # can be built in 64bit mode and support 32bit and 64bit
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 3/6] boot/optee-os: " Romain Naour
@ 2020-04-26 22:33 ` Romain Naour
  2020-05-31 20:40   ` Peter Korsgaard
  2020-04-26 22:33 ` [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell Romain Naour
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

This package doesn't work with Python 3.8 since the code contains
time.clock() that was deprecated in Python 3.3 and removed in Python 3.8.

Instead of applying non upstream patches from Fedora [1], python-pycrypto
was replaced by python-pycryptodomex for crda and optee-os package.
Now we can remove safely this package.

[1] http://lists.busybox.net/pipermail/buildroot/2020-April/280683.html

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/498144209

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
---
 Config.in.legacy                              |  7 +++
 package/Config.in                             |  1 -
 .../0001-remove-incorrect-header-path.patch   | 21 --------
 package/python-pycrypto/Config.in             |  8 ---
 package/python-pycrypto/python-pycrypto.hash  |  7 ---
 package/python-pycrypto/python-pycrypto.mk    | 49 -------------------
 6 files changed, 7 insertions(+), 86 deletions(-)
 delete mode 100644 package/python-pycrypto/0001-remove-incorrect-header-path.patch
 delete mode 100644 package/python-pycrypto/Config.in
 delete mode 100644 package/python-pycrypto/python-pycrypto.hash
 delete mode 100644 package/python-pycrypto/python-pycrypto.mk

diff --git a/Config.in.legacy b/Config.in.legacy
index c92023310d..807cfe4bf3 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -146,6 +146,13 @@ endif
 
 comment "Legacy options removed in 2020.05"
 
+config BR2_PACKAGE_PYTHON_PYCRYPTO
+	bool "python-pycrypto package removed"
+	select BR2_LEGACY
+	help
+	  This package has been removed, use python-pycryptodomex
+	  instead.
+
 config BR2_PACKAGE_COLLECTD_LVM
 	bool "lvm support in collectd was removed"
 	select BR2_LEGACY
diff --git a/package/Config.in b/package/Config.in
index bf02870ea2..42684a630f 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1074,7 +1074,6 @@ menu "External python modules"
 	source "package/python-pycares/Config.in"
 	source "package/python-pycli/Config.in"
 	source "package/python-pycparser/Config.in"
-	source "package/python-pycrypto/Config.in"
 	source "package/python-pycryptodomex/Config.in"
 	source "package/python-pydal/Config.in"
 	source "package/python-pydantic/Config.in"
diff --git a/package/python-pycrypto/0001-remove-incorrect-header-path.patch b/package/python-pycrypto/0001-remove-incorrect-header-path.patch
deleted file mode 100644
index 9268d311d5..0000000000
--- a/package/python-pycrypto/0001-remove-incorrect-header-path.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Do not use /usr/include for headers
-
-Using /usr/include is wrong when doing cross-compilation, so get rid
-of it, and rely on the compiler to use the appropriate default paths
-for headers.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-Index: b/setup.py
-===================================================================
---- a/setup.py
-+++ b/setup.py
-@@ -370,7 +370,7 @@
-       'ext_modules': plat_ext + [
-             # _fastmath (uses GNU mp library)
-             Extension("Crypto.PublicKey._fastmath",
--                      include_dirs=['src/','/usr/include/'],
-+                      include_dirs=['src/'],
-                       libraries=['gmp'],
-                       sources=["src/_fastmath.c"]),
- 
diff --git a/package/python-pycrypto/Config.in b/package/python-pycrypto/Config.in
deleted file mode 100644
index e998ecf89c..0000000000
--- a/package/python-pycrypto/Config.in
+++ /dev/null
@@ -1,8 +0,0 @@
-config BR2_PACKAGE_PYTHON_PYCRYPTO
-	bool "python-pycrypto"
-	select BR2_PACKAGE_GMP
-	help
-	  PyCrypto is a collection of cryptographic algorithms and
-	  protocols, implemented for use from Python.
-
-	  http://www.pycrypto.org/
diff --git a/package/python-pycrypto/python-pycrypto.hash b/package/python-pycrypto/python-pycrypto.hash
deleted file mode 100644
index a16a446084..0000000000
--- a/package/python-pycrypto/python-pycrypto.hash
+++ /dev/null
@@ -1,7 +0,0 @@
-# Locally calculated after checking pgp signature
-sha256  f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c  pycrypto-2.6.1.tar.gz
-# Locally computed
-sha256  15925a98d05c6d086c30943e4eacdbd361bcf76daa109b6e6dfc9d0c4ad9ed64  COPYRIGHT
-sha256  10c41e1aaf84bd3546d1ff7ef89454817744fd2c18cdd80a137e802095448016  LEGAL/copy/LICENSE.libtom
-sha256  253a271c681cd4b3f9503659fe754ee305efe68ebb6e8733b7f436d73845a32c  LEGAL/copy/LICENSE.python-2.2
-sha256  96f9a25274a59843715a26986e4a2427c312a1d86b9207f26fcafcea47a417fe  LEGAL/copy/LICENSE.original
diff --git a/package/python-pycrypto/python-pycrypto.mk b/package/python-pycrypto/python-pycrypto.mk
deleted file mode 100644
index 927ba918ae..0000000000
--- a/package/python-pycrypto/python-pycrypto.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-################################################################################
-#
-# python-pycrypto
-#
-################################################################################
-
-PYTHON_PYCRYPTO_VERSION = 2.6.1
-PYTHON_PYCRYPTO_SOURCE = pycrypto-$(PYTHON_PYCRYPTO_VERSION).tar.gz
-PYTHON_PYCRYPTO_SITE = http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto
-PYTHON_PYCRYPTO_SETUP_TYPE = distutils
-
-PYTHON_PYCRYPTO_LICENSE = Public Domain, Python 2.2 License (HMAC.py, setup.py)
-PYTHON_PYCRYPTO_LICENSE_FILES = \
-	COPYRIGHT LEGAL/copy/LICENSE.libtom \
-	LEGAL/copy/LICENSE.python-2.2
-
-# The pycrypto package contains a LICENSE.orig file, but our patching
-# infrastrucure removes all .orig file, so we must rename that license
-# file prior to patching, so it is still available to the legal-info
-# infrastructure
-define PYTHON_PYCRYPTO_RENAME_LICENSE
-	mv $(@D)/LEGAL/copy/LICENSE.orig $(@D)/LEGAL/copy/LICENSE.original
-endef
-PYTHON_PYCRYPTO_POST_EXTRACT_HOOKS += PYTHON_PYCRYPTO_RENAME_LICENSE
-HOST_PYTHON_PYCRYPTO_POST_EXTRACT_HOOKS += PYTHON_PYCRYPTO_RENAME_LICENSE
-PYTHON_PYCRYPTO_LICENSE_FILES += LEGAL/copy/LICENSE.original
-
-PYTHON_PYCRYPTO_DEPENDENCIES = gmp
-HOST_PYTHON_PYCRYPTO_DEPENDENCIES = host-gmp
-
-# The configure step needs to be run outside of the setup.py since it isn't
-# run correctly for cross-compiling
-define PYTHON_PYCRYPTO_CONFIGURE_CMDS
-	(cd $(@D) && \
-	$(TARGET_CONFIGURE_OPTS) \
-	$(TARGET_CONFIGURE_ARGS) \
-	./configure \
-		--target=$(GNU_TARGET_NAME) \
-		--host=$(GNU_TARGET_NAME) \
-		--build=$(GNU_HOST_NAME) \
-		--prefix=/usr \
-		--exec-prefix=/usr \
-		--sysconfdir=/etc \
-		--program-prefix="" \
-	)
-endef
-
-$(eval $(python-package))
-$(eval $(host-python-package))
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
                   ` (2 preceding siblings ...)
  2020-04-26 22:33 ` [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package Romain Naour
@ 2020-04-26 22:33 ` Romain Naour
  2020-04-27 16:09   ` Romain Naour
  2020-04-26 22:33 ` [Buildroot] [PATCH 6/6] configs/qemu_arm_vexpress_tz_defconfig: build start-qemu.sh Romain Naour
  2020-05-31 20:39 ` [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Peter Korsgaard
  5 siblings, 1 reply; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

Usually the qemu command line start directly with "qemu-system-<arch> ...".
But the command line for qemu_arm_vexpress_tz_defconfig start by doing
"cd output/images && ../host/bin/qemu-system-arm". This is necessary
since boot binaries, except BL1, are primarily loaded via semi-hosting
so all binaries has to reside in the same directory as QEMU is started
from [1].

The start-qemu.sh script fail to start qemu since it use exec on the
"cd" command. To work around this issue, use "exec sh -c":
exec sh -c "${QEMU_CMD_LINE} \${EXTRA_ARGS}"

[1] https://github.com/ARM-software/arm-trusted-firmware/blob/4ebbea9592ab37fc62217d0ac62fa13a3e063527/docs/plat/qemu.rst

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
 board/qemu/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh
index 9a4d216274..bf3e4df0b9 100755
--- a/board/qemu/post-image.sh
+++ b/board/qemu/post-image.sh
@@ -49,7 +49,7 @@ cat <<-_EOF_ > "${START_QEMU_SCRIPT}"
 	fi
 
 	export PATH="${HOST_DIR}/bin:\${PATH}"
-	exec ${QEMU_CMD_LINE} \${EXTRA_ARGS}
+	exec sh -c "${QEMU_CMD_LINE} \${EXTRA_ARGS}"
 _EOF_
 
 chmod +x "${START_QEMU_SCRIPT}"
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 6/6] configs/qemu_arm_vexpress_tz_defconfig: build start-qemu.sh
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
                   ` (3 preceding siblings ...)
  2020-04-26 22:33 ` [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell Romain Naour
@ 2020-04-26 22:33 ` Romain Naour
  2020-05-31 20:39 ` [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Peter Korsgaard
  5 siblings, 0 replies; 11+ messages in thread
From: Romain Naour @ 2020-04-26 22:33 UTC (permalink / raw)
  To: buildroot

When tags was added by commit 011206b2bffd509b29365bc1eaa761414ee13726
to detect the qemu command line, the qemu_arm_vexpress_tz_defconfig
was ignored due to a build issue.

This build issue has been fixed by previous patches, so we can
enable the runtime testing by adding the tag in the readme.txt
and the post-image script in the defconfig.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
 board/qemu/arm-vexpress-tz/readme.txt  | 2 +-
 configs/qemu_arm_vexpress_tz_defconfig | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/qemu/arm-vexpress-tz/readme.txt b/board/qemu/arm-vexpress-tz/readme.txt
index b235ba5cd7..abce750291 100644
--- a/board/qemu/arm-vexpress-tz/readme.txt
+++ b/board/qemu/arm-vexpress-tz/readme.txt
@@ -18,7 +18,7 @@ secure and non-secure worlds.
 	-serial stdio \
 	-netdev user,id=vmnic -device virtio-net-device,netdev=vmnic \
 	-semihosting-config enable,target=native \
-	-bios bl1.bin
+	-bios bl1.bin # qemu_arm_vexpress_tz_defconfig
 
 The boot stage traces (if any) followed by the login prompt will appear
 in the terminal that started QEMU.
diff --git a/configs/qemu_arm_vexpress_tz_defconfig b/configs/qemu_arm_vexpress_tz_defconfig
index b4a6e72635..a829e1376b 100644
--- a/configs/qemu_arm_vexpress_tz_defconfig
+++ b/configs/qemu_arm_vexpress_tz_defconfig
@@ -47,6 +47,10 @@ BR2_PACKAGE_HOST_PYTHON3=y
 BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
 BR2_PACKAGE_PYTHON3=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # U-boot for booting the dear Linux kernel
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell
  2020-04-26 22:33 ` [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell Romain Naour
@ 2020-04-27 16:09   ` Romain Naour
  2020-04-27 16:23     ` Geoff Levand
  0 siblings, 1 reply; 11+ messages in thread
From: Romain Naour @ 2020-04-27 16:09 UTC (permalink / raw)
  To: buildroot

Hi Yann, All,

Le 27/04/2020 ? 00:33, Romain Naour a ?crit?:
> Usually the qemu command line start directly with "qemu-system-<arch> ...".
> But the command line for qemu_arm_vexpress_tz_defconfig start by doing
> "cd output/images && ../host/bin/qemu-system-arm". This is necessary
> since boot binaries, except BL1, are primarily loaded via semi-hosting
> so all binaries has to reside in the same directory as QEMU is started
> from [1].
> 
> The start-qemu.sh script fail to start qemu since it use exec on the
> "cd" command. To work around this issue, use "exec sh -c":
> exec sh -c "${QEMU_CMD_LINE} \${EXTRA_ARGS}"
> 
> [1] https://github.com/ARM-software/arm-trusted-firmware/blob/4ebbea9592ab37fc62217d0ac62fa13a3e063527/docs/plat/qemu.rst
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>  board/qemu/post-image.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh
> index 9a4d216274..bf3e4df0b9 100755
> --- a/board/qemu/post-image.sh
> +++ b/board/qemu/post-image.sh
> @@ -49,7 +49,7 @@ cat <<-_EOF_ > "${START_QEMU_SCRIPT}"
>  	fi
>  
>  	export PATH="${HOST_DIR}/bin:\${PATH}"
> -	exec ${QEMU_CMD_LINE} \${EXTRA_ARGS}
> +	exec sh -c "${QEMU_CMD_LINE} \${EXTRA_ARGS}"

This patch is not ok as is since we need to escape double quotes from
"${QEMU_CMD_LINE}

example:
-append \"rootwait root=/dev/sda console=ttySC1,115200 noiotrap\"

Best regards,
Romain

>  _EOF_
>  
>  chmod +x "${START_QEMU_SCRIPT}"
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell
  2020-04-27 16:09   ` Romain Naour
@ 2020-04-27 16:23     ` Geoff Levand
  0 siblings, 0 replies; 11+ messages in thread
From: Geoff Levand @ 2020-04-27 16:23 UTC (permalink / raw)
  To: buildroot

On 4/27/20 9:09 AM, Romain Naour wrote:
>>  	export PATH="${HOST_DIR}/bin:\${PATH}"
>> -	exec ${QEMU_CMD_LINE} \${EXTRA_ARGS}
>> +	exec sh -c "${QEMU_CMD_LINE} \${EXTRA_ARGS}"
> 
> This patch is not ok as is since we need to escape double quotes from
> "${QEMU_CMD_LINE}
> 
> example:
> -append \"rootwait root=/dev/sda console=ttySC1,115200 noiotrap\"

Maybe use something like:

  CMD="${QEMU_CMD_LINE} ${EXTRA_ARGS}"
  eval exec ${CMD}

-Geoff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant
  2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
                   ` (4 preceding siblings ...)
  2020-04-26 22:33 ` [Buildroot] [PATCH 6/6] configs/qemu_arm_vexpress_tz_defconfig: build start-qemu.sh Romain Naour
@ 2020-05-31 20:39 ` Peter Korsgaard
  5 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2020-05-31 20:39 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > Adding a host variant allow to replace host-python-pycrypto
 > by host-python-pycryptodomex for crda and optee-os packages.

 > From [1]:
 > "PyCryptodome is a fork of PyCrypto, which is not maintained any more
 > (the last release dates back to 2013 [2]). It exposes almost the same
 > API, but there are a few incompatibilities [3]."

 > [1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
 > [2] https://pypi.org/project/pycrypto/#history
 > [3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: James Hilliard <james.hilliard1@gmail.com>
 > ---
 > For master and 2020.02.x.

Committed to 2020.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex
  2020-04-26 22:33 ` [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex Romain Naour
@ 2020-05-31 20:39   ` Peter Korsgaard
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2020-05-31 20:39 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > From [1]:
 > "PyCryptodome is a fork of PyCrypto, which is not maintained any more
 > (the last release dates back to 2013 [2]). It exposes almost the same
 > API, but there are a few incompatibilities [3]."

 > [1] https://github.com/OP-TEE/optee_os/commit/90ad2450436fdd9fc0d28a3f92f3fbcfd89a38f0
 > [2] https://pypi.org/project/pycrypto/#history
 > [3] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html

 > Update the patch 0001-crda-support-python-3-in-utils-key2pub.py.patch
 > since it add pycrypto.

 > From [4]
 > "CRDA is no longer needed as of kernel v4.15 since commit 007f6c5e6eb45
 > ("cfg80211: support loading regulatory database as firmware file") added
 > support to use the kernel's firmware request API which looks for the
 > firmware on /lib/firmware. Because of this CRDA is legacy software for
 > older kernels. It will continue to be maintained."

 > [4] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/tree/README?id=9856751feaf7b102547cea678a5da6c94252d83d#n8

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: James Hilliard <james.hilliard1@gmail.com>

Committed to 2020.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package
  2020-04-26 22:33 ` [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package Romain Naour
@ 2020-05-31 20:40   ` Peter Korsgaard
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2020-05-31 20:40 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > This package doesn't work with Python 3.8 since the code contains
 > time.clock() that was deprecated in Python 3.3 and removed in Python 3.8.

 > Instead of applying non upstream patches from Fedora [1], python-pycrypto
 > was replaced by python-pycryptodomex for crda and optee-os package.
 > Now we can remove safely this package.

 > [1] http://lists.busybox.net/pipermail/buildroot/2020-April/280683.html

 > Fixes:
 > https://gitlab.com/buildroot.org/buildroot/-/jobs/498144209

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: James Hilliard <james.hilliard1@gmail.com>

Committed to 2020.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-05-31 20:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 22:33 [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Romain Naour
2020-04-26 22:33 ` [Buildroot] [PATCH 2/6] package/crda: replace pycrypto by pycryptodomex Romain Naour
2020-05-31 20:39   ` Peter Korsgaard
2020-04-26 22:33 ` [Buildroot] [PATCH 3/6] boot/optee-os: " Romain Naour
2020-04-26 22:33 ` [Buildroot] [PATCH 4/6] package/python-pycrypto: remove package Romain Naour
2020-05-31 20:40   ` Peter Korsgaard
2020-04-26 22:33 ` [Buildroot] [PATCH 5/6] board/qemu/post-image.sh: start from a shell Romain Naour
2020-04-27 16:09   ` Romain Naour
2020-04-27 16:23     ` Geoff Levand
2020-04-26 22:33 ` [Buildroot] [PATCH 6/6] configs/qemu_arm_vexpress_tz_defconfig: build start-qemu.sh Romain Naour
2020-05-31 20:39 ` [Buildroot] [PATCH 1/6] package/python-pycryptodomex: add host variant Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.