wireless-regdb: allow to recompile
PATCH v3 1/1 wireless-regdb: allow to recompile
changes since v2:
* fix test for empty config
changes since v1:
* more info in commit messages
* started python3-m2crypto from previously removed python-m2crypto
* no magic with local files, but explicit control to buildroot for the signing key to use
* add the public key for signing to linux kernel
Kind regards
Kurt
PATCH 1/6 Revert "python-m2crypto: remove"
This reverts commit 484c04878e5e76cdc0cc33c7646f98ab41698a7e. python-m2crypto becomes needed for recompiling wireless-regdb.
--- package/python-m2crypto/python-m2crypto.hash | 3 ++ package/python-m2crypto/python-m2crypto.mk | 31 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 package/python-m2crypto/python-m2crypto.hash create mode 100644 package/python-m2crypto/python-m2crypto.mk
package/python-m2crypto/python-m2crypto.hash new file +3 -0
@@ -0,0 +1,3 @@ +# md5 from https://pypi.python.org/pypi/M2Crypto/, sha256 locally computed +md5 8e87235942c76d1ba9f999ee33764fdb M2Crypto-0.24.0.tar.gz +sha256 80a56441a1d2c0cf27e725be7554c92598b938fc8767ee2c71fdbc2fdc055ee8 M2Crypto-0.24.0.tar.gz
package/python-m2crypto/python-m2crypto.mk new file +31 -0
@@ -0,0 +1,31 @@ +################################################################################ +# +# python-m2crypto +# +################################################################################ + +PYTHON_M2CRYPTO_VERSION = 0.24.0 +PYTHON_M2CRYPTO_SITE = http://pypi.python.org/packages/source/M/M2Crypto +PYTHON_M2CRYPTO_SOURCE = M2Crypto-$(PYTHON_M2CRYPTO_VERSION).tar.gz +PYTHON_M2CRYPTO_SETUP_TYPE = setuptools +HOST_PYTHON_M2CRYPTO_DEPENDENCIES = host-openssl host-swig + +PYTHON_M2CRYPTO_LICENSE = MIT +PYTHON_M2CRYPTO_LICENSE_FILES = LICENCE + +# We need to use python2 because m2crypto is not python3 compliant. +HOST_PYTHON_M2CRYPTO_NEEDS_HOST_PYTHON = python2 + +# The --openssl option that allows to specify a custom path to OpenSSL +# can only be used with the non-default build_ext setup.py command, +# and calling this command directly fails. To work around this, simply +# hardcode the path to OpenSSL in setup.py. +# Bug reported at https://gitlab.com/m2crypto/m2crypto/issues/89 +define HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH + $(SED) "s%self.openssl = '/usr'%self.openssl = '$(HOST_DIR)/usr'%" \ + $(@D)/setup.py +endef + +HOST_PYTHON_M2CRYPTO_POST_PATCH_HOOKS += HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH + +$(eval $(host-python-package))
Signature · 1 line
2.25.0
PATCH 2/6 python-m2crypto: bump version
In reply to Kurt Van Dijck--- package/python-m2crypto/python-m2crypto.hash | 5 ++--- package/python-m2crypto/python-m2crypto.mk | 16 +++------------- 2 files changed, 5 insertions(+), 16 deletions(-)
package/python-m2crypto/python-m2crypto.hash +2 -3
@@ -1,3 +1,2 @@ -# md5 from https://pypi.python.org/pypi/M2Crypto/, sha256 locally computed -md5 8e87235942c76d1ba9f999ee33764fdb M2Crypto-0.24.0.tar.gz -sha256 80a56441a1d2c0cf27e725be7554c92598b938fc8767ee2c71fdbc2fdc055ee8 M2Crypto-0.24.0.tar.gz +# sha256 locally computed +sha256 4c6ad45ffb88670c590233683074f2440d96aaccb05b831371869fc387cbd127 M2Crypto-0.35.2.tar.gz
package/python-m2crypto/python-m2crypto.mk +3 -13
@@ -4,8 +4,8 @@ # ################################################################################ -PYTHON_M2CRYPTO_VERSION = 0.24.0 -PYTHON_M2CRYPTO_SITE = http://pypi.python.org/packages/source/M/M2Crypto +PYTHON_M2CRYPTO_VERSION = 0.35.2 +PYTHON_M2CRYPTO_SITE = https://files.pythonhosted.org/packages/74/18/3beedd4ac48b52d1a4d12f2a8c5cf0ae342ce974859fba838cbbc1580249 PYTHON_M2CRYPTO_SOURCE = M2Crypto-$(PYTHON_M2CRYPTO_VERSION).tar.gz PYTHON_M2CRYPTO_SETUP_TYPE = setuptools HOST_PYTHON_M2CRYPTO_DEPENDENCIES = host-openssl host-swig
@@ -13,19 +13,9 @@ HOST_PYTHON_M2CRYPTO_DEPENDENCIES = host-openssl host-swig PYTHON_M2CRYPTO_LICENSE = MIT PYTHON_M2CRYPTO_LICENSE_FILES = LICENCE -# We need to use python2 because m2crypto is not python3 compliant. HOST_PYTHON_M2CRYPTO_NEEDS_HOST_PYTHON = python2 -# The --openssl option that allows to specify a custom path to OpenSSL -# can only be used with the non-default build_ext setup.py command, -# and calling this command directly fails. To work around this, simply -# hardcode the path to OpenSSL in setup.py. -# Bug reported at https://gitlab.com/m2crypto/m2crypto/issues/89 -define HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH - $(SED) "s%self.openssl = '/usr'%self.openssl = '$(HOST_DIR)/usr'%" \ - $(@D)/setup.py -endef -HOST_PYTHON_M2CRYPTO_POST_PATCH_HOOKS += HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH +HOST_PYTHON_M2CRYPTO_BUILD_OPTS = --openssl $(HOST_DIR) $(eval $(host-python-package))
Signature · 1 line
2.25.0
PATCH 3/6 python3-m2crypto: move from python-m2crypto
In reply to Kurt Van Dijckwireless-regdb does not compile using python2.
---
package/python-m2crypto/python-m2crypto.mk | 21 -------------------
.../python3-m2crypto.hash} | 0
package/python3-m2crypto/python3-m2crypto.mk | 21 +++++++++++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
delete mode 100644 package/python-m2crypto/python-m2crypto.mk
rename package/{python-m2crypto/python-m2crypto.hash => python3-m2crypto/python3-m2crypto.hash} (100%)
create mode 100644 package/python3-m2crypto/python3-m2crypto.mkpackage/python-m2crypto/python-m2crypto.mk deleted +0 -21
@@ -1,21 +0,0 @@ -################################################################################ -# -# python-m2crypto -# -################################################################################ - -PYTHON_M2CRYPTO_VERSION = 0.35.2 -PYTHON_M2CRYPTO_SITE = https://files.pythonhosted.org/packages/74/18/3beedd4ac48b52d1a4d12f2a8c5cf0ae342ce974859fba838cbbc1580249 -PYTHON_M2CRYPTO_SOURCE = M2Crypto-$(PYTHON_M2CRYPTO_VERSION).tar.gz -PYTHON_M2CRYPTO_SETUP_TYPE = setuptools -HOST_PYTHON_M2CRYPTO_DEPENDENCIES = host-openssl host-swig - -PYTHON_M2CRYPTO_LICENSE = MIT -PYTHON_M2CRYPTO_LICENSE_FILES = LICENCE - -HOST_PYTHON_M2CRYPTO_NEEDS_HOST_PYTHON = python2 - - -HOST_PYTHON_M2CRYPTO_BUILD_OPTS = --openssl $(HOST_DIR) - -$(eval $(host-python-package))
package/python3-m2crypto/python3-m2crypto.hash renamed from package/python-m2crypto/python-m2crypto.hash +0 -0
package/python3-m2crypto/python3-m2crypto.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# python3-m2crypto +# +################################################################################ + +PYTHON3_M2CRYPTO_VERSION = 0.35.2 +PYTHON3_M2CRYPTO_SITE = https://files.pythonhosted.org/packages/74/18/3beedd4ac48b52d1a4d12f2a8c5cf0ae342ce974859fba838cbbc1580249 +PYTHON3_M2CRYPTO_SOURCE = M2Crypto-$(PYTHON3_M2CRYPTO_VERSION).tar.gz +PYTHON3_M2CRYPTO_SETUP_TYPE = setuptools +HOST_PYTHON3_M2CRYPTO_DEPENDENCIES = host-openssl host-swig + +PYTHON3_M2CRYPTO_LICENSE = MIT +PYTHON3_M2CRYPTO_LICENSE_FILES = LICENCE + +HOST_PYTHON3_M2CRYPTO_NEEDS_HOST_PYTHON = python3 + + +HOST_PYTHON3_M2CRYPTO_BUILD_OPTS = --openssl $(HOST_DIR) + +$(eval $(host-python-package))
Signature · 1 line
2.25.0
PATCH 4/6 wireless-regdb: add option to rebuild
In reply to Kurt Van DijckIn some countries, different regulations apply for indoor and outdoor use. The precompiled binary of wireless-regdb is for indoor use only. If your product is for outdoor use, or for other deviations, you may need to rebuild the patched or modified wireless-regdb.
Building is done explicitely using python3
--- package/wireless-regdb/Config.in | 15 +++++++++++++++ package/wireless-regdb/wireless-regdb.mk | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+)
package/wireless-regdb/Config.in +15 -0
@@ -12,3 +12,18 @@ config BR2_PACKAGE_WIRELESS_REGDB application is needed. https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb + +if BR2_PACKAGE_WIRELESS_REGDB + +config BR2_WIRELESS_REGDB_REBUILD + bool "rebuild wireless-regdb" + help + Say no to use the pre-built wireless regdb. + + Say yes if you need to deploy a modified wireless-regdb. + Deviations to the precompiled upstream wireless-regdb may be required + e.g. if you plan to deploy your product outdoor in countries where + outdoor and indoor regulations differ. + Make sure to deploy your wireless-regdb public key if you use crda + or compile them into the kernel. +endif
package/wireless-regdb/wireless-regdb.mk +18 -0
@@ -10,12 +10,30 @@ WIRELESS_REGDB_SITE = $(BR2_KERNEL_MIRROR)/software/network/wireless-regdb WIRELESS_REGDB_LICENSE = ISC WIRELESS_REGDB_LICENSE_FILES = LICENSE + +ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) + +define WIRELESS_REGDB_PATCH_PYTHON3 + sed -i -e '1 s/python$$/python3/' $(@D)/*.py +endef + +WIRELESS_REGDB_POST_PATCH_HOOKS += WIRELESS_REGDB_PATCH_PYTHON3 + +WIRELESS_REGDB_DEPENDENCIES += host-python3-m2crypto +define WIRELESS_REGDB_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + REGDB_AUTHOR=buildroot +endef +endif + ifeq ($(BR2_PACKAGE_CRDA),y) define WIRELESS_REGDB_INSTALL_CRDA_TARGET_CMDS $(INSTALL) -m 644 -D -T $(@D)/regulatory.bin \ $(TARGET_DIR)/usr/lib/crda/regulatory.bin $(INSTALL) -m 644 -D -T $(@D)/sforshee.key.pub.pem \ $(TARGET_DIR)/etc/wireless-regdb/pubkeys/sforshee.key.pub.pem + $(INSTALL) -m 644 -D -T ~/.wireless-regdb-buildroot.key.pub.pem \ + $(TARGET_DIR)/etc/wireless-regdb/pubkeys/buildroot.key.pub.pem endef endif
Signature · 1 line
2.25.0
PATCH 4/6 wireless-regdb: add option to rebuild
Hello Kurt,
Thanks for this new iteration. See some comments below.
Quoted 12 lines · On Thu, 2 Jul 2020 12:36:16 +0200 Kurt Van Dijck…
package/wireless-regdb/Config.in +4
-0@@ -12,3 +12,18 @@ config BR2_PACKAGE_WIRELESS_REGDB application is needed. https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb + +if BR2_PACKAGE_WIRELESS_REGDB + +config BR2_WIRELESS_REGDB_REBUILD
package/wireless-regdb/Config.in config BR2_PACKAGE_WIRELESS_REGDB · line 28
Quoted 10 lines
package/wireless-regdb/Config.in +10
-0+ bool "rebuild wireless-regdb" + help + Say no to use the pre-built wireless regdb. + + Say yes if you need to deploy a modified wireless-regdb. + Deviations to the precompiled upstream wireless-regdb may be required + e.g. if you plan to deploy your product outdoor in countries where + outdoor and indoor regulations differ. + Make sure to deploy your wireless-regdb public key if you use crda + or compile them into the kernel.
Some of those lines are too long. Run "make check-package", it will report some issues.
package/wireless-regdb/Config.in config BR2_PACKAGE_WIRELESS_REGDB
Quoted 4 lines
package/wireless-regdb/Config.in +4
-0+ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) + +define WIRELESS_REGDB_PATCH_PYTHON3 + sed -i -e '1 s/python$$/python3/' $(@D)/*.py
Use $(SED) instead of sed -i -e.
Quoted 5 lines
package/wireless-regdb/Config.in +5
-0+WIRELESS_REGDB_DEPENDENCIES += host-python3-m2crypto +define WIRELESS_REGDB_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + REGDB_AUTHOR=buildroot +endef
package/wireless-regdb/Config.in
Quoted 10 lines
package/wireless-regdb/Config.in +4
-0+endif + ifeq ($(BR2_PACKAGE_CRDA),y) define WIRELESS_REGDB_INSTALL_CRDA_TARGET_CMDS $(INSTALL) -m 644 -D -T $(@D)/regulatory.bin \ $(TARGET_DIR)/usr/lib/crda/regulatory.bin $(INSTALL) -m 644 -D -T $(@D)/sforshee.key.pub.pem \ $(TARGET_DIR)/etc/wireless-regdb/pubkeys/sforshee.key.pub.pem + $(INSTALL) -m 644 -D -T ~/.wireless-regdb-buildroot.key.pub.pem \ + $(TARGET_DIR)/etc/wireless-regdb/pubkeys/buildroot.key.pub.pem
This line fails:
/usr/bin/install: cannot stat '/home/thomas/.wireless-regdb-buildroot.key.pub.pem': No such file or directory
Indeed, when I read the wireless-regdb Makefile, I don't see how a file named like this can be produced. In fact, I believe it is not great for the wireless-regdb Makefile to generate files into the user's $HOME directory. Is this public/private key pair typically re-generated at each Buildroot build ? If that is the case, then it should be stored in $(HOST_DIR)/ somewhere.
If this public/private key pair should remain the same for a given system, across Buildroot rebuilds of the same configuration, then the public/private key pair should be generated separately by the user, and passed as argument.
I think your PATCH 5/6 should be squashed into PATCH 4/6, because generating those keys into $HOME really isn't good.
I have a couple of other questions/concerns. These don't need to be solved, it's more out of curiosity.
- You've changed python-m2crypto to use python3, and the wireless-regdb scripts to also use python3. But crda, which is kind of the companion package to wireless-regdb is using python-pycryptodomex, which is by default installed for host-python2. So it means that one has to build both host-python2 and host-python3 :-/
- I'm not really clear on the interaction between wireless-regdb and crda. It's quite weird that crda selects wireless-regdb, but wireless-regdb has some conditional on whether crda is enabled.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 5/6 wireless-regdb: add explicit signing key config
In reply to Kurt Van DijckThis commit allows to set an explicit file with signing key to use.
--- package/wireless-regdb/Config.in | 18 ++++++++++++++++++ package/wireless-regdb/wireless-regdb.mk | 24 +++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-)
package/wireless-regdb/Config.in +18 -0
@@ -26,4 +26,22 @@ config BR2_WIRELESS_REGDB_REBUILD outdoor and indoor regulations differ. Make sure to deploy your wireless-regdb public key if you use crda or compile them into the kernel. + +if BR2_WIRELESS_REGDB_REBUILD + +config BR2_WIRELESS_REGDB_COMMONNAME + string "CommonName for x509 cert" + default "buildroot" + +config BR2_WIRELESS_REGDB_PRIVKEY + string "private key for signing wireless-regdb" + default "~/.buildroot" + help + Path to file containing private key to sign wireless-regdb. + The key should be in .pem format. + + If the file does not exist, a new key will be generated + +endif + endif
package/wireless-regdb/wireless-regdb.mk +21 -3
@@ -13,16 +13,34 @@ WIRELESS_REGDB_LICENSE_FILES = LICENSE ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) +WIRELESS_REGDB_PRIVKEY = $(call qstrip,$(BR2_WIRELESS_REGDB_PRIVKEY)) +WIRELESS_REGDB_PRIVKEYNAME = $(patsubst .%,%,$(notdir $(WIRELESS_REGDB_PRIVKEY))) +# make sure PRIVKEYNAME is set +ifeq ($(WIRELESS_REGDB_PRIVKEYNAME),) +WIRELESS_REGDB_PRIVKEY=~/.buildroot +endif + +ifeq ($(call qstrip,$(BR2_WIRELESS_REGDB_COMMONNAME)),) +BR2_WIRELESS_REGDB_COMMONNAME = "buildroot" +endif + define WIRELESS_REGDB_PATCH_PYTHON3 sed -i -e '1 s/python$$/python3/' $(@D)/*.py + sed -i -e 's/= sforshee$$/= $(call qstrip,$(BR2_WIRELESS_REGDB_COMMONNAME))/' $(@D)/gen-pubcert.sh endef WIRELESS_REGDB_POST_PATCH_HOOKS += WIRELESS_REGDB_PATCH_PYTHON3 WIRELESS_REGDB_DEPENDENCIES += host-python3-m2crypto + define WIRELESS_REGDB_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ - REGDB_AUTHOR=buildroot + REGDB_PRIVKEY=$(WIRELESS_REGDB_PRIVKEY) \ + REGDB_PUBKEY=$(WIRELESS_REGDB_PRIVKEYNAME).pub \ + REGDB_PUBCERT=$(WIRELESS_REGDB_PRIVKEYNAME).x509.pem + openssl x509 -in $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509.pem \ + -outform DER \ + -out $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509 endef endif
@@ -32,8 +50,8 @@ define WIRELESS_REGDB_INSTALL_CRDA_TARGET_CMDS $(TARGET_DIR)/usr/lib/crda/regulatory.bin $(INSTALL) -m 644 -D -T $(@D)/sforshee.key.pub.pem \ $(TARGET_DIR)/etc/wireless-regdb/pubkeys/sforshee.key.pub.pem - $(INSTALL) -m 644 -D -T ~/.wireless-regdb-buildroot.key.pub.pem \ - $(TARGET_DIR)/etc/wireless-regdb/pubkeys/buildroot.key.pub.pem + $(INSTALL) -m 644 -D -T $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).pub \ + $(TARGET_DIR)/etc/wireless-regdb/pubkeys/$(WIRELESS_REGDB_PRIVKEYNAME).pub endef endif
Signature · 1 line
2.25.0
PATCH 5/6 wireless-regdb: add explicit signing key config
Hello Kurt,
Quoted 4 lines · On Thu, 2 Jul 2020 12:36:17 +0200 Kurt Van Dijck…
package/wireless-regdb/Config.in +4
-0+if BR2_WIRELESS_REGDB_REBUILD + +config BR2_WIRELESS_REGDB_COMMONNAME + string "CommonName for x509 cert"
package/wireless-regdb/Config.in config BR2_WIRELESS_REGDB_REBUILD · line 43
Quoted 10 lines
package/wireless-regdb/Config.in +10
-0+ default "buildroot" + +config BR2_WIRELESS_REGDB_PRIVKEY + string "private key for signing wireless-regdb" + default "~/.buildroot" + help + Path to file containing private key to sign wireless-regdb. + The key should be in .pem format. + + If the file does not exist, a new key will be generated
Ah, OK, so that's where you handle the thing. If the user wants to keep the same private/public key pair across Buildroot rebuilds, he should place into the folder pointed to by BR2_WIRELESS_REGDB_PRIVKEY ?
Can I suggest that instead we make this option empty by default, and in this case, a key is generated in $(HOST_DIR) ?
Anyway, the default value of ~/.buildroot is a bit weird. ~/.buildroot looks like a directory more than a file that contains a key.
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 17
Quoted 10 lines
package/wireless-regdb/wireless-regdb.mk +2
-0@@ -13,16 +13,34 @@ WIRELESS_REGDB_LICENSE_FILES = LICENSE ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) +WIRELESS_REGDB_PRIVKEY = $(call qstrip,$(BR2_WIRELESS_REGDB_PRIVKEY)) +WIRELESS_REGDB_PRIVKEYNAME = $(patsubst .%,%,$(notdir $(WIRELESS_REGDB_PRIVKEY)))
I'm not sure what this PRIVKEYNAME is.
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 18
Quoted 1 line
package/wireless-regdb/wireless-regdb.mk +1
-0+# make sure PRIVKEYNAME is set
This is not making sure WIRELESS_REGDB_PRIVKEYNAME is set: it is setting WIRELESS_REGDB_PRIVKEY.
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 25
Quoted 7 lines
package/wireless-regdb/wireless-regdb.mk +7
-0+ifeq ($(WIRELESS_REGDB_PRIVKEYNAME),) +WIRELESS_REGDB_PRIVKEY=~/.buildroot +endif + +ifeq ($(call qstrip,$(BR2_WIRELESS_REGDB_COMMONNAME)),) +BR2_WIRELESS_REGDB_COMMONNAME = "buildroot" +endif
We normally handle this like that:
WIRELESS_REGDB_COMMONNAME = $(call qstrip,$(BR2_WIRELESS_REGDB_COMMONNAME))
ifeq ($(WIRELESS_REGDB_COMMONNAME),)
$(error "ERROR: BR2_WIRELESS_REGDB_COMMONNAME is empty") endif
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 35
Quoted 9 lines
package/wireless-regdb/wireless-regdb.mk +2
-0define WIRELESS_REGDB_PATCH_PYTHON3 sed -i -e '1 s/python$$/python3/' $(@D)/*.py + sed -i -e 's/= sforshee$$/= $(call qstrip,$(BR2_WIRELESS_REGDB_COMMONNAME))/' $(@D)/gen-pubcert.sh endef WIRELESS_REGDB_POST_PATCH_HOOKS += WIRELESS_REGDB_PATCH_PYTHON3 WIRELESS_REGDB_DEPENDENCIES += host-python3-m2crypto +
This is kind of a spurious change, not really related to this commit.
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 40
Quoted 6 lines
package/wireless-regdb/wireless-regdb.mk +3
-1define WIRELESS_REGDB_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ - REGDB_AUTHOR=buildroot + REGDB_PRIVKEY=$(WIRELESS_REGDB_PRIVKEY) \ + REGDB_PUBKEY=$(WIRELESS_REGDB_PRIVKEYNAME).pub \ + REGDB_PUBCERT=$(WIRELESS_REGDB_PRIVKEYNAME).x509.pem
I don't quite understand how the private key file name relates to the public key and public key certificates file names. Could you clarify ?
package/wireless-regdb/wireless-regdb.mk WIRELESS_REGDB_LICENSE_FILES = LICENSE · line 41
Quoted 1 line
package/wireless-regdb/wireless-regdb.mk +1
-0+ openssl x509 -in $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509.pem \
Use $(HOST_DIR)/bin/openssl here.
Quoted 6 lines
package/wireless-regdb/wireless-regdb.mk +2
-0+ -outform DER \ + -out $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509 endef endif
package/wireless-regdb/wireless-regdb.mk define WIRELESS_REGDB_INSTALL_CRDA_TARGET_CMDS · line 57
Quoted 10 lines
package/wireless-regdb/wireless-regdb.mk +2
-2@@ -32,8 +50,8 @@ define WIRELESS_REGDB_INSTALL_CRDA_TARGET_CMDS $(TARGET_DIR)/usr/lib/crda/regulatory.bin $(INSTALL) -m 644 -D -T $(@D)/sforshee.key.pub.pem \ $(TARGET_DIR)/etc/wireless-regdb/pubkeys/sforshee.key.pub.pem - $(INSTALL) -m 644 -D -T ~/.wireless-regdb-buildroot.key.pub.pem \ - $(TARGET_DIR)/etc/wireless-regdb/pubkeys/buildroot.key.pub.pem + $(INSTALL) -m 644 -D -T $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).pub \ + $(TARGET_DIR)/etc/wireless-regdb/pubkeys/$(WIRELESS_REGDB_PRIVKEYNAME).pub endef endif
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 6/6 wireless-regdb: add signing key to linux kernel
In reply to Kurt Van DijckWhen rebuilding wireless-regdb, linux kernel needs the signing public key to validate the database.
--- linux/linux.mk | 4 ++++ package/wireless-regdb/wireless-regdb.mk | 14 ++++++++++++++ 2 files changed, 18 insertions(+)
linux/linux.mk +4 -0
@@ -367,6 +367,10 @@ define LINUX_KCONFIG_FIXUP_CMDS $(PACKAGES_LINUX_CONFIG_FIXUPS) endef +ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) +LINUX_DEPENDENCIES += wireless-regdb +endif + ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y) # Starting with 4.17, the generated dtc parser code is no longer # shipped with the kernel sources, so we need flex and bison. For
package/wireless-regdb/wireless-regdb.mk +14 -0
@@ -42,6 +42,20 @@ define WIRELESS_REGDB_BUILD_CMDS -outform DER \ -out $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509 endef + +# Sarting with 4.15, the kernel can hold public keys for validating +# regulatory.db file. +# make sure wireless-regdb is rebuilt before linux +# and fixup kernel to include the signing key + +define WIRELESS_REGDB_LINUX_FIXUP + $(call KCONFIG_ENABLE_OPT,CONFIG_CFG80211_CERTIFICATION_ONUS) + $(call KCONFIG_ENABLE_OPT,CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS) + $(call KCONFIG_SET_OPT,CONFIG_CFG80211_EXTRA_REGDB_KEYDIR,"$(WIRELESS_REGDB_DIR)") +endef + +PACKAGES_LINUX_CONFIG_FIXUPS += $(call WIRELESS_REGDB_LINUX_FIXUP) + endif ifeq ($(BR2_PACKAGE_CRDA),y)
Signature · 1 line
2.25.0
PATCH 6/6 wireless-regdb: add signing key to linux kernel
Hello,
Quoted 29 lines · On Thu, 2 Jul 2020 12:36:18 +0200 Kurt Van Dijck…
When rebuilding wireless-regdb, linux kernel needs the signing public key to validate the database.
Signed-off-by Kurt Van Dijck <[email protected]>--- linux/linux.mk | 4 ++++ package/wireless-regdb/wireless-regdb.mk | 14 ++++++++++++++ 2 files changed, 18 insertions(+)linux/linux.mk +4
-0@@ -367,6 +367,10 @@ define LINUX_KCONFIG_FIXUP_CMDS $(PACKAGES_LINUX_CONFIG_FIXUPS) endef +ifeq ($(BR2_WIRELESS_REGDB_REBUILD),y) +LINUX_DEPENDENCIES += wireless-regdb +endif + ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y) # Starting with 4.17, the generated dtc parser code is no longer # shipped with the kernel sources, so we need flex and bison. Forpackage/wireless-regdb/wireless-regdb.mk +0
-0
package/wireless-regdb/wireless-regdb.mk define WIRELESS_REGDB_BUILD_CMDS · line 46
Quoted 5 lines
package/wireless-regdb/wireless-regdb.mk +2
-0@@ -42,6 +42,20 @@ define WIRELESS_REGDB_BUILD_CMDS -outform DER \ -out $(@D)/$(WIRELESS_REGDB_PRIVKEYNAME).x509 endef + +# Sarting with 4.15, the kernel can hold public keys for validating
Typoe: Starting
package/wireless-regdb/wireless-regdb.mk define WIRELESS_REGDB_BUILD_CMDS · line 49
Quoted 3 lines
package/wireless-regdb/wireless-regdb.mk +3
-0+# regulatory.db file. +# make sure wireless-regdb is rebuilt before linux +# and fixup kernel to include the signing key
I think those last two lines are not very useful. Especially the "make sure wireless-regdb is rebuilt before linux", since this issue is not handled here.
package/wireless-regdb/wireless-regdb.mk define WIRELESS_REGDB_BUILD_CMDS · line 54
Quoted 5 lines
package/wireless-regdb/wireless-regdb.mk +5
-0+ +define WIRELESS_REGDB_LINUX_FIXUP + $(call KCONFIG_ENABLE_OPT,CONFIG_CFG80211_CERTIFICATION_ONUS) + $(call KCONFIG_ENABLE_OPT,CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS) + $(call KCONFIG_SET_OPT,CONFIG_CFG80211_EXTRA_REGDB_KEYDIR,"$(WIRELESS_REGDB_DIR)")
It's not really great to point to $(WIRELESS_REGDB_DIR) here. Can we instead install the keys somewhere in $(HOST_DIR)/share/wireless-regdb/ for example, and point to that ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v3 1/1 wireless-regdb: allow to recompile
In reply to Kurt Van Dijckping?
I addressed the V1 comments, and I'm quite satisfied with the result. Are there more comments/remarks/questions?
Kind regards,
Kurt
Quoted 12 lines · Kurt Van Dijck
changes since v2:
* fix test for empty configchanges since v1:
* more info in commit messages
* started python3-m2crypto from previously removed python-m2crypto
* no magic with local files, but explicit control to buildroot for the signing key to use
* add the public key for signing to linux kernelKind regards
Kurt