Skip to contentSkip to conversation

Add static/embedded wireless regulatory data

PATCH Superseded Krzysztof Kozlowski 2 participants 7 messages Jul 5, 2018

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add static/embedded wireless regulatory data

Hi,

Changes since v3:
1. Re-order patches, start with version bump.
2. Add patch 2/3 for new kernel (since v4.15 embedding regulatory data has changed).

Changes since v2:
1. Rebase on sumo.
2. Fix task order - run do_kernel_add_regdb task after do_configure.

Changes since v1:
1. Remove debugging echo.

Best regards,
Krzysztof

Krzysztof Kozlowski (3):
wireless-regdb: Bump version to latest upstream 2018.05.31
wireless-regdb: Add wireless-regdb-static package with static
regulatory data
kernel_wireless_regdb: Add class for embedding regulatory data into
older kernel

 .../classes/kernel_wireless_regdb.bbclass          | 11 ++++++
 .../wireless-regdb/wireless-regdb_2016.06.10.bb    | 20 ----------
 .../wireless-regdb/wireless-regdb_2018.05.31.bb    | 44 ++++++++++++++++++++++
 3 files changed, 55 insertions(+), 20 deletions(-)
 create mode 100644 meta-networking/classes/kernel_wireless_regdb.bbclass
 delete mode 100644 meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2016.06.10.bb
 create mode 100644 meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb
Signature · 1 line
2.14.1
#1 lore raw

PATCH v4 1/3 wireless-regdb: Bump version to latest upstream 2018.05.31

Bump the wireless-regdb recipe to use newest wireless regulatory database.

---
 .../{wireless-regdb_2016.06.10.bb => wireless-regdb_2018.05.31.bb}    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta-networking/recipes-connectivity/wireless-regdb/{wireless-regdb_2016.06.10.bb => wireless-regdb_2018.05.31.bb} (82%)
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb renamed from meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2016.06.10.bb +2 -2
similarity index 82%
rename from meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2016.06.10.bb
rename to meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb
index 64e9401e7a3c..8bb866ff1281 100644
@@ -5,8 +5,8 @@ LICENSE = "ISC"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
 
 SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
-SRC_URI[md5sum] = "d282cce92b6e692e8673e2bd97adf33b"
-SRC_URI[sha256sum] = "cfedf1c3521b3c8f32602f25ed796e96e687c3441a00e7c050fedf7fd4f1b8b7"
+SRC_URI[md5sum] = "0cbbdc21186c76cf58aba01b03f3dc5b"
+SRC_URI[sha256sum] = "e1dfbc3b97771373077f430c3c05082fae883145b37db5b2cfd12c56676fbe7b"
 
 inherit bin_package
 
Signature · 1 line
2.14.1
#2 lore raw

PATCH v4 2/3 wireless-regdb: Add wireless-regdb-static package with static regulatory data

In reply to Krzysztof Kozlowski

Small embedded systems might:
1. Want to get rid of daemons as much as possible (therefore be built without CRDA),
2. Not receive user-space incremental updates but an entire system upgrade (with kernel).

Linux kernel since v4.15 allows loading static regulatory data from /lib/firmware/regulatory.db.

Add additional package to wireless-regdb recipe which provides such static data.

---
 .../wireless-regdb/wireless-regdb_2018.05.31.bb            | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +14 -0
index 8bb866ff1281..d40756ff2bbf 100644
@@ -15,6 +15,20 @@ do_install() {
     install -d -m0755 ${D}${sysconfdir}/wireless-regdb/pubkeys
     install -m 0644 regulatory.bin ${D}${libdir}/crda/regulatory.bin
     install -m 0644 sforshee.key.pub.pem ${D}${sysconfdir}/wireless-regdb/pubkeys/sforshee.key.pub.pem
+
+    install -d -m0755 ${D}${nonarch_base_libdir}/firmware/
+    install -m 0644 regulatory.db ${D}${nonarch_base_libdir}/firmware/regulatory.db
+    install -m 0644 regulatory.db.p7s ${D}${nonarch_base_libdir}/firmware/regulatory.db.p7s
 }
 
+# Install static regulatory DB in /lib/firmware for kernel to load.
+# This requires Linux kernel >= v4.15.
+PACKAGES =+ "${PN}-static"
+RCONFLICTS_${PN} = "${PN}-static"
+
+FILES_${PN}-static = " \
+    ${nonarch_base_libdir}/firmware/regulatory.db \
+    ${nonarch_base_libdir}/firmware/regulatory.db.p7s \
+"
+
 RSUGGESTS_${PN} = "crda"
Signature · 1 line
2.14.1
#3 lore raw

Re: [meta-networking][PATCH v4 2/3] wireless-regdb: Add wireless-regdb-static package with static regulatory data

Quoted 22 lines · Krzysztof Kozlowski

Small embedded systems might:
1. Want to get rid of daemons as much as possible (therefore be built without CRDA),
2. Not receive user-space incremental updates but an entire system upgrade (with kernel).

Linux kernel since v4.15 allows loading static regulatory data from /lib/firmware/regulatory.db.

Add additional package to wireless-regdb recipe which provides such static data.

---
 .../wireless-regdb/wireless-regdb_2018.05.31.bb            | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +0 -0
index 8bb866ff1281..d40756ff2bbf 100644

meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb do_install() { · line 19

Quoted 5 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +2 -0
@@ -15,6 +15,20 @@ do_install() {
     install -d -m0755 ${D}${sysconfdir}/wireless-regdb/pubkeys
     install -m 0644 regulatory.bin ${D}${libdir}/crda/regulatory.bin
     install -m 0644 sforshee.key.pub.pem ${D}${sysconfdir}/wireless-regdb/pubkeys/sforshee.key.pub.pem
+
+    install -d -m0755 ${D}${nonarch_base_libdir}/firmware/

This is not needed if you add -D to both the lines below.

Quoted 6 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +3 -0
+    install -m 0644 regulatory.db ${D}${nonarch_base_libdir}/firmware/regulatory.db
+    install -m 0644 regulatory.db.p7s ${D}${nonarch_base_libdir}/firmware/regulatory.db.p7s
 }
 
+# Install static regulatory DB in /lib/firmware for kernel to load.

meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb do_install() { · line 34

Quoted 10 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +9 -0
+# This requires Linux kernel >= v4.15.
+PACKAGES =+ "${PN}-static"
+RCONFLICTS_${PN} = "${PN}-static"
+
+FILES_${PN}-static = " \
+    ${nonarch_base_libdir}/firmware/regulatory.db \
+    ${nonarch_base_libdir}/firmware/regulatory.db.p7s \
+"
+
 RSUGGESTS_${PN} = "crda"

Do we still need the rsuggest for crda ?

#4 lore raw

PATCH v4 3/3 kernel_wireless_regdb: Add class for embedding regulatory data into older kernel

In reply to Krzysztof Kozlowski

Linux kernels before v4.15, allowed to be compiled with static regulatory dabatase if it was put under net/wireless/db.txt.

Add kernel_wireless_regdb class which allows in such cases to embed the wireless regulatory database directly in the Linux kernel during build process.

Usage:
1. The class should be inherited by kernel recipe (e.g. in linux-yocto_%.bbappend).
2. For Linux kernels up to v4.14, build kernel with CONFIG_EXPERT and CONFIG_CFG80211_INTERNAL_REGDB.

---
 meta-networking/classes/kernel_wireless_regdb.bbclass         | 11 +++++++++++
 .../wireless-regdb/wireless-regdb_2018.05.31.bb               | 10 ++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 meta-networking/classes/kernel_wireless_regdb.bbclass
meta-networking/classes/kernel_wireless_regdb.bbclass new file +11 -0
new file mode 100644
index 000000000000..a1eb4c532667
@@ -0,0 +1,11 @@
+# Copies the regulatory plaintext database to kernel sources before compiling.
+# Linux kernel must be compiled with CONFIG_CFG80211_INTERNAL_REGDB to use it.
+
+DEPENDS += "wireless-regdb-native"
+
+SRCTREECOVEREDTASKS += "do_kernel_add_regdb"
+do_kernel_add_regdb() {
+    cp ${STAGING_LIBDIR_NATIVE}/crda/db.txt ${S}/net/wireless/db.txt
+}
+do_kernel_add_regdb[dirs] = "${S}"
+addtask kernel_add_regdb before do_build after do_configure
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +10 -0
index d40756ff2bbf..0b7930718761 100644
@@ -23,6 +23,7 @@ do_install() {
 
 # Install static regulatory DB in /lib/firmware for kernel to load.
 # This requires Linux kernel >= v4.15.
+# For kernel <= v4.14, inherit the kernel_wireless_regdb.bbclass in kernel's recipe.
 PACKAGES =+ "${PN}-static"
 RCONFLICTS_${PN} = "${PN}-static"
 
@@ -31,4 +32,13 @@ FILES_${PN}-static = " \
     ${nonarch_base_libdir}/firmware/regulatory.db.p7s \
 "
 
+# Native users might want to use the source of regulatory DB.
+# This is for example used by Linux kernel <= v4.14 and kernel_wireless_regdb.bbclass.
+do_install_append_class-native() {
+    install -d -m 0755 ${D}${libdir}/crda
+    install -m 0644 db.txt ${D}${libdir}/crda/db.txt
+}
+
 RSUGGESTS_${PN} = "crda"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.14.1
#5 lore raw

Re: [meta-networking][PATCH v4 3/3] kernel_wireless_regdb: Add class for embedding regulatory data into older kernel

Quoted 7 lines · Krzysztof Kozlowski

Linux kernels before v4.15, allowed to be compiled with static regulatory dabatase if it was put under net/wireless/db.txt.

Add kernel_wireless_regdb class which allows in such cases to embed the wireless regulatory database directly in the Linux kernel during build process.

Quoted 5 lines

Usage:
1. The class should be inherited by kernel recipe (e.g. in linux-yocto_%.bbappend).
2. For Linux kernels up to v4.14, build kernel with CONFIG_EXPERT and CONFIG_CFG80211_INTERNAL_REGDB.

I think it will be good to add this in comments in bbclass as well.

Quoted 38 lines
---
 meta-networking/classes/kernel_wireless_regdb.bbclass         | 11 +++++++++++
 .../wireless-regdb/wireless-regdb_2018.05.31.bb               | 10 ++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 meta-networking/classes/kernel_wireless_regdb.bbclass
meta-networking/classes/kernel_wireless_regdb.bbclass new file +11 -0
new file mode 100644
index 000000000000..a1eb4c532667
@@ -0,0 +1,11 @@
+# Copies the regulatory plaintext database to kernel sources before compiling.
+# Linux kernel must be compiled with CONFIG_CFG80211_INTERNAL_REGDB to use it.
+
+DEPENDS += "wireless-regdb-native"
+
+SRCTREECOVEREDTASKS += "do_kernel_add_regdb"
+do_kernel_add_regdb() {
+    cp ${STAGING_LIBDIR_NATIVE}/crda/db.txt ${S}/net/wireless/db.txt
+}
+do_kernel_add_regdb[dirs] = "${S}"
+addtask kernel_add_regdb before do_build after do_configure
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +1 -0
index d40756ff2bbf..0b7930718761 100644
@@ -23,6 +23,7 @@ do_install() {
 
 # Install static regulatory DB in /lib/firmware for kernel to load.
 # This requires Linux kernel >= v4.15.
+# For kernel <= v4.14, inherit the kernel_wireless_regdb.bbclass in kernel's recipe.
 PACKAGES =+ "${PN}-static"
 RCONFLICTS_${PN} = "${PN}-static"
 

meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb FILES_${PN}-static = " \ · line 38

Quoted 7 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +4 -0
@@ -31,4 +32,13 @@ FILES_${PN}-static = " \
     ${nonarch_base_libdir}/firmware/regulatory.db.p7s \
 "
 
+# Native users might want to use the source of regulatory DB.
+# This is for example used by Linux kernel <= v4.14 and kernel_wireless_regdb.bbclass.
+do_install_append_class-native() {
+    install -d -m 0755 ${D}${libdir}/crda

add -D to below cmd and you can avoid this line.

Quoted 7 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +5 -0
+    install -m 0644 db.txt ${D}${libdir}/crda/db.txt
+}
+
 RSUGGESTS_${PN} = "crda"
+
+BBCLASSEXTEND = "native"
#6 lore raw

Re: [meta-networking][PATCH v4 3/3] kernel_wireless_regdb: Add class for embedding regulatory data into older kernel

Quoted 8 lines · Khem Raj
Quoted 7 lines · Krzysztof Kozlowski

Linux kernels before v4.15, allowed to be compiled with static regulatory dabatase if it was put under net/wireless/db.txt.

Add kernel_wireless_regdb class which allows in such cases to embed the wireless regulatory database directly in the Linux kernel during build process.

Quoted 7 lines
Quoted 5 lines

Usage:
1. The class should be inherited by kernel recipe (e.g. in linux-yocto_%.bbappend).
2. For Linux kernels up to v4.14, build kernel with CONFIG_EXPERT and CONFIG_CFG80211_INTERNAL_REGDB.

I think it will be good to add this in comments in bbclass as well.

Sure.

Quoted 42 lines
Quoted 42 lines
---
 meta-networking/classes/kernel_wireless_regdb.bbclass         | 11 +++++++++++
 .../wireless-regdb/wireless-regdb_2018.05.31.bb               | 10 ++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 meta-networking/classes/kernel_wireless_regdb.bbclass
meta-networking/classes/kernel_wireless_regdb.bbclass new file +11 -0
new file mode 100644
index 000000000000..a1eb4c532667
@@ -0,0 +1,11 @@
+# Copies the regulatory plaintext database to kernel sources before compiling.
+# Linux kernel must be compiled with CONFIG_CFG80211_INTERNAL_REGDB to use it.
+
+DEPENDS += "wireless-regdb-native"
+
+SRCTREECOVEREDTASKS += "do_kernel_add_regdb"
+do_kernel_add_regdb() {
+    cp ${STAGING_LIBDIR_NATIVE}/crda/db.txt ${S}/net/wireless/db.txt
+}
+do_kernel_add_regdb[dirs] = "${S}"
+addtask kernel_add_regdb before do_build after do_configure
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +1 -0
index d40756ff2bbf..0b7930718761 100644
@@ -23,6 +23,7 @@ do_install() {
 
 # Install static regulatory DB in /lib/firmware for kernel to load.
 # This requires Linux kernel >= v4.15.
+# For kernel <= v4.14, inherit the kernel_wireless_regdb.bbclass in kernel's recipe.
 PACKAGES =+ "${PN}-static"
 RCONFLICTS_${PN} = "${PN}-static"
 
@@ -31,4 +32,13 @@ FILES_${PN}-static = " \
     ${nonarch_base_libdir}/firmware/regulatory.db.p7s \
 "
 
Quoted 6 lines

meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb FILES_${PN}-static = " \ · line 38

Quoted 4 lines
meta-networking/recipes-connectivity/wireless-regdb/wireless-regdb_2018.05.31.bb +4 -0
+# Native users might want to use the source of regulatory DB.
+# This is for example used by Linux kernel <= v4.14 and kernel_wireless_regdb.bbclass.
+do_install_append_class-native() {
+    install -d -m 0755 ${D}${libdir}/crda

add -D to below cmd and you can avoid this line.

Thanks for review, I'll fix them in v5.

Best regards,
Krzysztof