Skip to contentSkip to conversation

package/esp-hosted: fix build failure on Linux 6.8.12+

PATCH In review Giulio Benetti 2 participants 4 messages Jun 3, 2024 – Jun 4, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/esp-hosted: fix build failure on Linux 6.8.12+

Add local patch pending upstream to fix build failure due to old Linux Bluetooth API.

Fixes:
http://autobuild.buildroot.net/results/d64fa083ec27c3684d4186d2b1b05e041ad330f5/
http://autobuild.buildroot.net/results/5c4fac191970444e63109a762023c0e60f9693e2/

---
V1->V2:
* add missing Upstream tag in local patch

---
 ...x-Bluetooth-build-failure-on-Linux-6.patch | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch
package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +37 -0
new file mode 100644
index 0000000000..c701aaa82f
@@ -0,0 +1,37 @@
+From f8903bc2be7ae5ac9fb9bbeed8512e974c6e60ec Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Mon, 3 Jun 2024 21:53:38 +0200
+Subject: [PATCH] esp_hosted_ng: Fix Bluetooth build failure on Linux 6.8.11+
+
+After Linux commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84a4bb6548a29326564f0e659fb8064503ecc1c7
+BT_HS has been removed and consequently AMP controllers can't be created,
+so at this point only HCI_PRIMARY has been left as unique controller type
+to be created and this became implicit with no need to define if the
+controller if HCI_PRIMARY or HCI_AMP. So let's assign HCI_PRIMARY up to
+Linux 6.8.11 only preventing build failure.
+
+Upstream: https://github.com/espressif/esp-hosted/pull/400
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ esp_hosted_ng/host/esp_bt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/esp_hosted_ng/host/esp_bt.c b/esp_hosted_ng/host/esp_bt.c
+index 3b78c11698..4598ac0e0a 100644
+--- a/esp_hosted_ng/host/esp_bt.c
++++ b/esp_hosted_ng/host/esp_bt.c
+@@ -240,7 +240,9 @@ int esp_init_bt(struct esp_adapter *adapter)
+ 	hdev->set_bdaddr = esp_bt_set_bdaddr;
+ #endif
+ 
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6, 8, 11))
+ 	hdev->dev_type = HCI_PRIMARY;
++#endif
+ 
+ 	SET_HCIDEV_DEV(hdev, adapter->dev);
+ 
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Add local patch pending upstream to fix build failure due to old Linux Bluetooth API.

Fixes:
http://autobuild.buildroot.net/results/d64fa083ec27c3684d4186d2b1b05e041ad330f5/
http://autobuild.buildroot.net/results/5c4fac191970444e63109a762023c0e60f9693e2/

---

V1-> V2:

Quoted 33 lines

* add missing Upstream tag in local patch

---
 ...x-Bluetooth-build-failure-on-Linux-6.patch | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch
package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +21 -0
new file mode 100644
index 0000000000..c701aaa82f
@@ -0,0 +1,37 @@
+From f8903bc2be7ae5ac9fb9bbeed8512e974c6e60ec Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Mon, 3 Jun 2024 21:53:38 +0200
+Subject: [PATCH] esp_hosted_ng: Fix Bluetooth build failure on Linux 6.8.11+
+
+After Linux commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84a4bb6548a29326564f0e659fb8064503ecc1c7
+BT_HS has been removed and consequently AMP controllers can't be created,
+so at this point only HCI_PRIMARY has been left as unique controller type
+to be created and this became implicit with no need to define if the
+controller if HCI_PRIMARY or HCI_AMP. So let's assign HCI_PRIMARY up to
+Linux 6.8.11 only preventing build failure.
+
+Upstream: https://github.com/espressif/esp-hosted/pull/400
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ esp_hosted_ng/host/esp_bt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/esp_hosted_ng/host/esp_bt.c b/esp_hosted_ng/host/esp_bt.c

package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch line 31

Quoted 10 lines
package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +10 -0
+index 3b78c11698..4598ac0e0a 100644
+--- a/esp_hosted_ng/host/esp_bt.c
++++ b/esp_hosted_ng/host/esp_bt.c
+@@ -240,7 +240,9 @@ int esp_init_bt(struct esp_adapter *adapter)
+ 	hdev->set_bdaddr = esp_bt_set_bdaddr;
+ #endif
+ 
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6, 8, 11))
+ 	hdev->dev_type = HCI_PRIMARY;
++#endif

It would be more robust to make this conditionally on if HCI_PRIMARY is defined in case this ever gets backported to earlier stable kernels, but OK.

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi Peter,

Quoted 50 lines · Peter Korsgaard
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Add local patch pending upstream to fix build failure due to old Linux Bluetooth API.

Fixes:
http://autobuild.buildroot.net/results/d64fa083ec27c3684d4186d2b1b05e041ad330f5/
http://autobuild.buildroot.net/results/5c4fac191970444e63109a762023c0e60f9693e2/

---

V1-> V2:

Quoted 38 lines

* add missing Upstream tag in local patch

---
 ...x-Bluetooth-build-failure-on-Linux-6.patch | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch
package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +26 -0
new file mode 100644
index 0000000000..c701aaa82f
@@ -0,0 +1,37 @@
+From f8903bc2be7ae5ac9fb9bbeed8512e974c6e60ec Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Mon, 3 Jun 2024 21:53:38 +0200
+Subject: [PATCH] esp_hosted_ng: Fix Bluetooth build failure on Linux 6.8.11+
+
+After Linux commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84a4bb6548a29326564f0e659fb8064503ecc1c7
+BT_HS has been removed and consequently AMP controllers can't be created,
+so at this point only HCI_PRIMARY has been left as unique controller type
+to be created and this became implicit with no need to define if the
+controller if HCI_PRIMARY or HCI_AMP. So let's assign HCI_PRIMARY up to
+Linux 6.8.11 only preventing build failure.
+
+Upstream: https://github.com/espressif/esp-hosted/pull/400
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ esp_hosted_ng/host/esp_bt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/esp_hosted_ng/host/esp_bt.c b/esp_hosted_ng/host/esp_bt.c
+index 3b78c11698..4598ac0e0a 100644
+--- a/esp_hosted_ng/host/esp_bt.c
++++ b/esp_hosted_ng/host/esp_bt.c
+@@ -240,7 +240,9 @@ int esp_init_bt(struct esp_adapter *adapter)
+ 	hdev->set_bdaddr = esp_bt_set_bdaddr;
Quoted 8 lines

package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch line 31

Quoted 5 lines
package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +5 -0
+ #endif
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6, 8, 11))
+ 	hdev->dev_type = HCI_PRIMARY;
++#endif

It would be more robust to make this conditionally on if HCI_PRIMARY is defined in case this ever gets backported to earlier stable kernels,

This is a good idea and upstream still have to merge. I've checked and HCI_PRIMARY has been defined during Linux commit ca8bee5dde1f02c2dbe8c8453dce27f2dfafb21c as a rename of HCI_BREDR(Linux 4.8-rc1). So I should deal with HCI_BREDR too, something like:

#ifdef HCI_PRIMARY
	hdev->dev_type = HCI_PRIMARY;
#endif
#ifdef HCI_BREDR
	hdev->dev_type = HCI_BREDR;

#endif

or even better:
compat.h:
#ifdef HCI_BREDR
#define HCI_PRIMARY HCI_BREDR
#endif

.c:

#ifdef HCI_PRIMARY
	hdev->dev_type = HCI_PRIMARY;

#endif

Yes, this would cover earlier Linux versions and they are interested in very early versions as stated here:
https://github.com/espressif/esp-hosted/pull/358#issuecomment-2031117798

So I'm going to rework for upstream, so once merged I bump here in Buildroot and drop this local patch.

Signature · 6 lines
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Hi,

Quoted 7 lines
Quoted 6 lines

package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch line 31

Quoted 3 lines

++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6, 8, 11))

package/esp-hosted/0002-esp_hosted_ng-Fix-Bluetooth-build-failure-on-Linux-6.patch new file +2 -0
+ 	hdev->dev_type = HCI_PRIMARY;
++#endif

It would be more robust to make this conditionally on if HCI_PRIMARY is
defined in case this ever gets backported to earlier stable kernels,

Quoted 5 lines

This is a good idea and upstream still have to merge. I've checked and HCI_PRIMARY has been defined during Linux commit ca8bee5dde1f02c2dbe8c8453dce27f2dfafb21c as a rename of HCI_BREDR(Linux 4.8-rc1).
So I should deal with HCI_BREDR too, something like:

That could be an additional improvement if the rest of the code works with such old kernels, but not really related to 6.8.12+ support.

Quoted 2 lines

So I'm going to rework for upstream, so once merged I bump here in Buildroot and drop this local patch.

Great, thanks!

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot