Skip to contentSkip to conversation

Fix two android-tools build issues

PATCH In review Thomas Petazzoni via buildroot 3 participants 9 messages Dec 4, 2024 – Dec 6, 2024

lore
Share & tools
lore
#0 lore raw

cover Fix two android-tools build issues

Hello,

The android-tools has been causing failures in the autobuilders pretty much every day for the past few months, so it was about time to fix those issues.

This patch series fixes the two most prominent issues:

- An issue related to u64 definition on powerpc64/mips64, which has been occurring in the autobuilders since at least Feb 2021. This patch should be backported to 2024.02.x.

- An issue related to GCC 14.x. Since the support of GCC 14.x is not in 2024.02.x, this second fix is not strictly needed in 2024.02.x, but also shouldn't be harmful.

A preparation patch converting the existing patch stack to be applicable with "git am" is proposed, as it was needed to preserve my sanity while working on the patch series.

Thomas Petazzoni (3):
package/android-tools: convert all patches to Git-formatted patches package/android-tools: fix build issue on mips64 and powerpc64 package/android-tools: fix b64_pton() issue with GCC >= 14.x

 .checkpackageignore                           |  9 +-
 ...-Fix-makefiles-for-out-of-tree-build.patch |  7 +-
 ...0002-Fix-adbd-for-non-Ubuntu-systems.patch |  9 +-
 ...0003-Adjust-base64-function-handling.patch | 96 +++++++++++++++++++
 .../0003-Fix-build-issue-with-uclibc.patch    | 36 -------
 .../0004-Fix-build-issue-with-musl.patch      | 25 +++--
 ...efiles-use-pkgconf-to-get-libs-deps.patch} | 47 +++++----
 ...006-Fix-build-on-big-endian-systems.patch} | 20 +++-
 ...clude-cdefs.h-wherever-it-is-needed.patch} | 18 ++--
 ...smacros.h-to-compile-with-glibc-2.28.patch | 42 --------
 ...minor-major-build-failure-due-to-gli.patch | 59 ++++++++++++
 ...les-for-out-of-tree-ext4_utils-build.patch |  4 +-
 ...atch-for-openssl-1.1.0-compatibility.patch |  4 +-
 ...stboot.c-reorder-functions-to-avoid-.patch |  4 +-
 ...parse_read.c-add-missing-output_file.patch |  4 +-
 ...s-make_ext4fs_main.c-disable-Android.patch |  4 +-
 ...014-core-adbd-adb.c-open-code-capset.patch |  4 +-
 ...b.c-include-correct-header-for-prctl.patch |  4 +-
 ...s-make_ext4fs.c-define-__SANE_USERSP.patch | 68 +++++++++++++
 19 files changed, 320 insertions(+), 144 deletions(-)
 create mode 100644 package/android-tools/0003-Adjust-base64-function-handling.patch
 delete mode 100644 package/android-tools/0003-Fix-build-issue-with-uclibc.patch
 rename package/android-tools/{0005-Use-pkgconf-to-get-libs-deps.patch => 0005-makefiles-use-pkgconf-to-get-libs-deps.patch} (57%)
 rename package/android-tools/{0006-fix-big-endian-build.patch => 0006-Fix-build-on-big-endian-systems.patch} (75%)
 rename package/android-tools/{0007-include-cdefs-h-when-needed.patch => 0007-Include-cdefs.h-wherever-it-is-needed.patch} (71%)
 delete mode 100644 package/android-tools/0008-Include-sysmacros.h-to-compile-with-glibc-2.28.patch
 create mode 100644 package/android-tools/0008-usb_linux.c-fix-minor-major-build-failure-due-to-gli.patch
 create mode 100644 package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch
Signature · 6 lines
2.47.0

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

PATCH 1/3 package/android-tools: convert all patches to Git-formatted patches

This will make it easier to modify the patch series moving forward. No functional changes.

On one patch, we added the SoB from Giulio, which was missing. Giulio was the original contributor of the patch, and nobody touched it since it was introduced.

---
 .checkpackageignore                           |  8 +--
 ...-Fix-makefiles-for-out-of-tree-build.patch |  7 ++-
 ...0002-Fix-adbd-for-non-Ubuntu-systems.patch |  9 ++-
 .../0003-Fix-build-issue-with-uclibc.patch    |  8 ++-
 .../0004-Fix-build-issue-with-musl.patch      | 25 ++++----
 ...efiles-use-pkgconf-to-get-libs-deps.patch} | 47 +++++++++------
 ...006-Fix-build-on-big-endian-systems.patch} | 20 +++++--
 ...clude-cdefs.h-wherever-it-is-needed.patch} | 18 ++++--
 ...smacros.h-to-compile-with-glibc-2.28.patch | 42 -------------
 ...minor-major-build-failure-due-to-gli.patch | 59 +++++++++++++++++++
 ...les-for-out-of-tree-ext4_utils-build.patch |  4 +-
 ...atch-for-openssl-1.1.0-compatibility.patch |  4 +-
 ...stboot.c-reorder-functions-to-avoid-.patch |  4 +-
 ...parse_read.c-add-missing-output_file.patch |  4 +-
 ...s-make_ext4fs_main.c-disable-Android.patch |  4 +-
 ...014-core-adbd-adb.c-open-code-capset.patch |  4 +-
 ...b.c-include-correct-header-for-prctl.patch |  4 +-
 17 files changed, 162 insertions(+), 109 deletions(-)
 rename package/android-tools/{0005-Use-pkgconf-to-get-libs-deps.patch => 0005-makefiles-use-pkgconf-to-get-libs-deps.patch} (57%)
 rename package/android-tools/{0006-fix-big-endian-build.patch => 0006-Fix-build-on-big-endian-systems.patch} (75%)
 rename package/android-tools/{0007-include-cdefs-h-when-needed.patch => 0007-Include-cdefs.h-wherever-it-is-needed.patch} (71%)
 delete mode 100644 package/android-tools/0008-Include-sysmacros.h-to-compile-with-glibc-2.28.patch
 create mode 100644 package/android-tools/0008-usb_linux.c-fix-minor-major-build-failure-due-to-gli.patch
.checkpackageignore +4 -4
index b793026881..11e410b4ea 100644
@@ -273,10 +273,10 @@ package/android-tools/0001-Fix-makefiles-for-out-of-tree-build.patch lib_patch.U
 package/android-tools/0002-Fix-adbd-for-non-Ubuntu-systems.patch lib_patch.Upstream
 package/android-tools/0003-Fix-build-issue-with-uclibc.patch lib_patch.Upstream
 package/android-tools/0004-Fix-build-issue-with-musl.patch lib_patch.Upstream
-package/android-tools/0005-Use-pkgconf-to-get-libs-deps.patch lib_patch.Upstream
-package/android-tools/0006-fix-big-endian-build.patch lib_patch.Upstream
-package/android-tools/0007-include-cdefs-h-when-needed.patch lib_patch.Upstream
-package/android-tools/0008-Include-sysmacros.h-to-compile-with-glibc-2.28.patch lib_patch.Sob lib_patch.Upstream
+package/android-tools/0005-makefiles-use-pkgconf-to-get-libs-deps.patch lib_patch.Upstream
+package/android-tools/0006-Fix-build-on-big-endian-systems.patch lib_patch.Upstream
+package/android-tools/0007-Include-cdefs.h-wherever-it-is-needed.patch lib_patch.Upstream
+package/android-tools/0008-usb_linux.c-fix-minor-major-build-failure-due-to-gli.patch lib_patch.Upstream
 package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch lib_patch.Upstream
 package/android-tools/0010-adb-added-patch-for-openssl-1.1.0-compatibility.patch lib_patch.Upstream
 package/aoetools/0001-Change-shell-script-interpreter-from-bin-bash-to-bin.patch lib_patch.Upstream
package/android-tools/0001-Fix-makefiles-for-out-of-tree-build.patch +5 -2
index af0723620f..ad047657a1 100644
@@ -1,4 +1,7 @@
-[PATCH] Fix makefiles for out-of-tree build
+From 1fe49c34aa3e32e801af5c56293ec71ff6e7e2bc Mon Sep 17 00:00:00 2001
+From: Gary Bisson <[email protected]>
+Date: Sun, 1 Dec 2024 15:43:17 +0100
+Subject: [PATCH] Fix makefiles for out-of-tree build
 
 Signed-off-by: Gary Bisson <[email protected]>
 ---
@@ -158,5 +161,5 @@ index 9e8b751..94a069b 100644
  LIBS+= -lz -lselinux
  
 -- 
-2.5.1
+2.47.0
 
package/android-tools/0002-Fix-adbd-for-non-Ubuntu-systems.patch +6 -3
index 35f6c8a3be..7f39e6662b 100644
@@ -1,4 +1,7 @@
-[PATCH] Fix adbd for non-Ubuntu systems
+From d433d5c340f3b36de58ea8550fd140dbdaea13b4 Mon Sep 17 00:00:00 2001
+From: Gary Bisson <[email protected]>
+Date: Sun, 1 Dec 2024 15:43:33 +0100
+Subject: [PATCH] Fix adbd for non-Ubuntu systems
 
 Remove glib/dbus dependencies and partially restore services.c to be
 closer to the original source code in order to run on systems without
@@ -7,7 +10,7 @@ sudo.
 Signed-off-by: Gary Bisson <[email protected]>
 ---
  core/adbd/adb.c          |   1 -
- core/adbd/services.c     | 160 ++++-------------------------------------------
+ core/adbd/services.c     | 160 +++------------------------------------
  debian/makefiles/adbd.mk |   4 +-
  3 files changed, 14 insertions(+), 151 deletions(-)
 
@@ -260,5 +263,5 @@ index 49dab8c..22c1816 100644
  OBJS= $(patsubst %, %.o, $(basename $(SRCS)))
  
 -- 
-2.5.1
+2.47.0
 
package/android-tools/0003-Fix-build-issue-with-uclibc.patch +6 -2
index 95517c307b..a951271873 100644
@@ -1,7 +1,11 @@
-[PATCH] Fix build issue with uclibc
+From 082ee80d3524fa3474644c09b441d7f7947675cc Mon Sep 17 00:00:00 2001
+From: Gary Bisson <[email protected]>
+Date: Sun, 1 Dec 2024 15:43:56 +0100
+Subject: [PATCH] Fix build issue with uclibc
 
 Signed-off-by: Gary Bisson <[email protected]>
 ---
+ core/adb/adb_auth_client.c  | 2 +-
  core/adbd/adb_auth_client.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
@@ -32,5 +36,5 @@ index 0b4913e..068d837 100644
              D("%s: Invalid base64 data ret=%d\n", file, ret);
              free(key);
 -- 
-2.6.1
+2.47.0
 
package/android-tools/0004-Fix-build-issue-with-musl.patch +11 -14
index 964eb87a6d..affd75b259 100644
@@ -1,4 +1,7 @@
-[PATCH] Fix build issue with musl
+From d14ca3e3362448590adaebacb76d4d8046f9b556 Mon Sep 17 00:00:00 2001
+From: Gary Bisson <[email protected]>
+Date: Sun, 1 Dec 2024 15:44:16 +0100
+Subject: [PATCH] Fix build issue with musl
 
 arpa/nameser.h doesn't use the same macro name to avoid several
 inclusions.
@@ -8,19 +11,12 @@ TEMP_FAILURE_RETRY macro.
 
 Signed-off-by: Gary Bisson <[email protected]>
 ---
- core/adbd/arpa_nameser.h              | 12 +++++++++---
- core/adbd/base64.c                    |  1 -
- core/adbd/framebuffer_service.c       |  1 +
- core/adbd/qemu_pipe.h                 |  1 -
- core/include/cutils/android_reboot.h  |  8 ++++++--
- core/include/cutils/bitops.h          | 10 ++++++----
- core/include/cutils/partition_utils.h |  8 ++++++--
- extras/ext4_utils/sha1.c              |  3 ---
- extras/ext4_utils/sha1.h              | 13 ++++++-------
- 9 files changed, 34 insertions(+), 23 deletions(-)
+ core/adbd/arpa_nameser.h        | 3 +++
+ core/adbd/framebuffer_service.c | 1 +
+ 2 files changed, 4 insertions(+)
 
 diff --git a/core/adbd/arpa_nameser.h b/core/adbd/arpa_nameser.h
-index 438dc04..b2a28d6 100644
+index 438dc04..f3d2fee 100644
 --- a/core/adbd/arpa_nameser.h
 +++ b/core/adbd/arpa_nameser.h
 @@ -52,6 +52,8 @@
@@ -32,7 +28,7 @@ index 438dc04..b2a28d6 100644
  
  #define BIND_4_COMPAT
  
-@@ -574,4 +579,5 @@ __END_DECLS
+@@ -574,4 +576,5 @@ __END_DECLS
  #define  XLOG(...)   do {} while (0)
  #endif
  
@@ -51,4 +47,5 @@ index 20c08d2..48e0241 100644
  #include <sys/ioctl.h>
  #include <sys/mman.h>
 -- 
-2.6.1
+2.47.0
+
package/android-tools/0005-makefiles-use-pkgconf-to-get-libs-deps.patch renamed from package/android-tools/0005-Use-pkgconf-to-get-libs-deps.patch +30 -17

60 lines not on this page · raw message

package/android-tools/0006-Fix-build-on-big-endian-systems.patch renamed from package/android-tools/0006-fix-big-endian-build.patch +15 -5
similarity index 75%
rename from package/android-tools/0006-fix-big-endian-build.patch
rename to package/android-tools/0006-Fix-build-on-big-endian-systems.patch
index c35fdcb8c4..d7fcb1cf0f 100644
@@ -1,4 +1,7 @@
-Fix build on big endian systems
+From 8f7e9458dbfca969d3edc9cf409b3439e98f4c5a Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Sun, 1 Dec 2024 15:45:26 +0100
+Subject: [PATCH] Fix build on big endian systems
 
 The usb_linux_client.c file defines cpu_to_le16/32 by using the C
 library htole16/32 function calls. However, cpu_to_le16/32 are used
@@ -14,9 +17,13 @@ To solve this, we simply open-code cpu_to_le16/32 in a way that allows
 them to be used when initializing structures.
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ core/adb/usb_linux_client.c  | 11 +++++++++--
+ core/adbd/usb_linux_client.c | 11 +++++++++--
+ 2 files changed, 18 insertions(+), 4 deletions(-)
 
-Index: b/core/adb/usb_linux_client.c
-===================================================================
+diff --git a/core/adb/usb_linux_client.c b/core/adb/usb_linux_client.c
+index fb1dad0..a981e96 100644
 --- a/core/adb/usb_linux_client.c
 +++ b/core/adb/usb_linux_client.c
 @@ -34,8 +34,15 @@
@@ -37,8 +44,8 @@ Index: b/core/adb/usb_linux_client.c
  
  struct usb_handle
  {
-Index: b/core/adbd/usb_linux_client.c
-===================================================================
+diff --git a/core/adbd/usb_linux_client.c b/core/adbd/usb_linux_client.c
+index 33875a8..0e4d200 100644
 --- a/core/adbd/usb_linux_client.c
 +++ b/core/adbd/usb_linux_client.c
 @@ -34,8 +34,15 @@
@@ -59,3 +66,6 @@ Index: b/core/adbd/usb_linux_client.c
  
  struct usb_handle
  {
+-- 
+2.47.0
+
package/android-tools/0007-Include-cdefs.h-wherever-it-is-needed.patch renamed from package/android-tools/0007-include-cdefs-h-when-needed.patch +12 -6
similarity index 71%
rename from package/android-tools/0007-include-cdefs-h-when-needed.patch
rename to package/android-tools/0007-Include-cdefs.h-wherever-it-is-needed.patch
index da4ee13a17..d4e483c6d7 100644
@@ -1,4 +1,7 @@
-Include cdefs.h wherever it is needed
+From d3f0157bf2ac1afc9a810ccbe188110df724129d Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 1 Dec 2024 15:46:15 +0100
+Subject: [PATCH] Include cdefs.h wherever it is needed
 
 cdefs.h is included from within a lot of glibc headers, so it almost
 invariably and automagically gets pulled in with glibc.
@@ -11,12 +14,12 @@ So we must include it when we are going to use macros it provides.
 
 Signed-off-by: "Yann E. MORIN" <[email protected]>
 ---
- core/adbd/services.c                  |  1 +
- core/libcutils/android_reboot.c       |  1 +
- 2 files changed, 2 insertions(+), 0 deletion(-)
+ core/adbd/services.c            | 1 +
+ core/libcutils/android_reboot.c | 1 +
+ 2 files changed, 2 insertions(+)
 
 diff --git a/core/adbd/services.c b/core/adbd/services.c
-index 20c08d2..48e0241 100644
+index 5adcefe..6de1951 100644
 --- a/core/adbd/services.c
 +++ b/core/adbd/services.c
 @@ -20,6 +20,7 @@
@@ -28,7 +31,7 @@ index 20c08d2..48e0241 100644
  #include "sysdeps.h"
  
 diff --git a/core/libcutils/android_reboot.c b/core/libcutils/android_reboot.c
-index 20c08d2..48e0241 100644
+index 79c05f8..9386006 100644
 --- a/core/libcutils/android_reboot.c
 +++ b/core/libcutils/android_reboot.c
 @@ -23,6 +23,7 @@
@@ -39,3 +42,6 @@ index 20c08d2..48e0241 100644
  
  #include <cutils/android_reboot.h>
  
+-- 
+2.47.0
+
package/android-tools/0008-Include-sysmacros.h-to-compile-with-glibc-2.28.patch deleted +0 -42

42 lines not on this page · raw message

package/android-tools/0008-usb_linux.c-fix-minor-major-build-failure-due-to-gli.patch new file +59 -0

59 lines not on this page · raw message

package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch +2 -2
index 80ea1ec1fe..94216102cf 100644
@@ -1,4 +1,4 @@
-From d24abbec201975a5eb7f8589614cfb424b8c80b6 Mon Sep 17 00:00:00 2001
+From 3c4319da20fab4e48ec02e28f5b013b4a33b5fe4 Mon Sep 17 00:00:00 2001
 From: Alex Kaplan <[email protected]>
 Date: Sat, 10 Nov 2018 19:50:51 -0800
 Subject: [PATCH] Fix makefiles for out-of-tree ext4_utils build
@@ -44,5 +44,5 @@ index cb64916..c5904bf 100644
  LIBS+= -lz -lselinux
  
 -- 
-2.7.4
+2.47.0
 
package/android-tools/0010-adb-added-patch-for-openssl-1.1.0-compatibility.patch +2 -2
index 2de338368f..96ca5b737a 100644
@@ -1,4 +1,4 @@
-From bb3da0e32be4f2260940edf3ee0f88103dfd0dcc Mon Sep 17 00:00:00 2001
+From 79bf5cdee607241434e0d1c5b72e724eb1d20102 Mon Sep 17 00:00:00 2001
 From: Eneas U de Queiroz <[email protected]>
 Date: Tue, 5 Feb 2019 01:12:19 +0200
 Subject: [PATCH] adb: added patch for openssl 1.1.0 compatibility
@@ -43,5 +43,5 @@ index 9039d42..debd2ef 100644
  out:
      BN_free(n0inv);
 -- 
-2.14.1
+2.47.0
 
package/android-tools/0011-core-fastboot-fastboot.c-reorder-functions-to-avoid-.patch +2 -2
index b5592e6992..17a7619bf0 100644
@@ -1,4 +1,4 @@
-From 9724d78fda4eb023f83d2fd30e665b436d7a7f97 Mon Sep 17 00:00:00 2001
+From 6919b6619a9c744d2220f7af6e211c50662ba94b Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 14 Jul 2024 11:41:10 +0200
 Subject: [PATCH] core/fastboot/fastboot.c: reorder functions to avoid implicit
@@ -50,5 +50,5 @@ index 3de6d7d..9b2c86f 100644
  {
      if (match_fastboot_with_serial(info, NULL) == 0) {
 -- 
-2.45.2
+2.47.0
 
package/android-tools/0012-core-libsparse-sparse_read.c-add-missing-output_file.patch +2 -2
index 9a6a77eceb..9e35a4782d 100644
@@ -1,4 +1,4 @@
-From 2812c2005cfa4bfc5741651c8310e36f28c0327e Mon Sep 17 00:00:00 2001
+From 72b9e79c81a237f1839afb4fdee680eafdd180d9 Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 14 Jul 2024 11:41:56 +0200
 Subject: [PATCH] core/libsparse/sparse_read.c: add missing output_file.h
@@ -33,5 +33,5 @@ index 704bcfa..0a8f838 100644
  #if defined(__APPLE__) && defined(__MACH__)
  #define lseek64 lseek
 -- 
-2.45.2
+2.47.0
 
package/android-tools/0013-extras-ext4_utils-make_ext4fs_main.c-disable-Android.patch +2 -2
index c11e88bf07..b6902982f7 100644
@@ -1,4 +1,4 @@
-From 83f9bed233b86dd2bbf603611b13b673caeccb69 Mon Sep 17 00:00:00 2001
+From 01e86db8460d873aec15d658bfc717b026c0545f Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 14 Jul 2024 11:46:51 +0200
 Subject: [PATCH] extras/ext4_utils/make_ext4fs_main.c: disable
@@ -50,5 +50,5 @@ index 17d3735..cb58011 100644
  	if (!sehnd && mountpoint) {
  		sehnd = selinux_android_file_context_handle();
 -- 
-2.45.2
+2.47.0
 
package/android-tools/0014-core-adbd-adb.c-open-code-capset.patch +2 -2
index 1496b8bca4..36a9208c60 100644
@@ -1,4 +1,4 @@
-From 2b5060146b0890f7f1a63ef891af1358b8cdf9bc Mon Sep 17 00:00:00 2001
+From 850fd3f4a0384ebe492a466a9b1149060619aacb Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 14 Jul 2024 12:57:22 +0200
 Subject: [PATCH] core/adbd/adb.c: open code capset()
@@ -48,5 +48,5 @@ index 7fe6445..98b1de1 100644
          D("Local port disabled\n");
      } else {
 -- 
-2.45.2
+2.47.0
 
package/android-tools/0015-core-adbd-adb.c-include-correct-header-for-prctl.patch +2 -2
index cfbefecb26..0a35dbcc74 100644
@@ -1,4 +1,4 @@
-From c14070011e070d8674cf3578708cbae433090a47 Mon Sep 17 00:00:00 2001
+From 8f351150de38641c8ce2e9b7f9a5cba29ccd8f7e Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 14 Jul 2024 13:00:02 +0200
 Subject: [PATCH] core/adbd/adb.c: include correct header for prctl()
@@ -30,5 +30,5 @@ index 98b1de1..10f420b 100644
  #else
  #include "usb_vendors.h"
 -- 
-2.45.2
+2.47.0
 
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/3] package/android-tools: convert all patches to Git-formatted patches

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

This will make it easier to modify the patch series moving forward. No functional changes.

On one patch, we added the SoB from Giulio, which was missing. Giulio was the original contributor of the patch, and nobody touched it since it was introduced.

Committed to 2024.02.x and 2024.08.x, thanks.

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

PATCH 3/3 package/android-tools: fix b64_pton() issue with GCC >= 14.x

In reply to Thomas Petazzoni via buildroot

The android-tools code base uses the __b64_pton() function, which isn't provided by all C libraries. So the Debian patch debian/patches/add_adbd.patch adds an implementation of b64_pton(), but doesn't actually use it, nor defines a prototype for it. Our existing patch 0003-Fix-build-issue-with-uclibc.patch switches the code to use the b64_pton() function... but still without providing a prototype, causing the following build failures with GCC >= 14.x:

adb_auth_client.c:75:15: error: implicit declaration of function 'b64_pton'

To fix this, we rework 0003-Fix-build-issue-with-uclibc.patch into a patch that:

(1) Renames b64_pton() to adb_b64_pton() to make sure it won't clash with implementations provided by some C libraries, and adjusts the call sites accordingly.

(2) Adds a prototype definition of adb_b64_pton() in places where this function is used.

Fixes:

http://autobuild.buildroot.net/results/b25b25337c7ad89c33f8bd20b646850bd993ec53ae9/

Even though GCC 14.x support was merged in Buildroot in May 2024, this particular b64_pton() only started appearing on July 15 2024, with the first occurence being:

http://autobuild.buildroot.net/results/1cbe87bbe3c56f28444b3aaba1ba1d05f947d36e/

Indeed, it's not before July 15 2024 that we merged commit d201f2f5cd0d1e0389430cda78adead37977a6cd ("package/android-tools: add patches to fix build with GCC 14.x"), which fixed other GCC 14.x issues, which were hiding this b64_pton() problem.

---
 .checkpackageignore                           |  1 -
 ...0003-Adjust-base64-function-handling.patch | 96 +++++++++++++++++++
 .../0003-Fix-build-issue-with-uclibc.patch    | 40 --------
 3 files changed, 96 insertions(+), 41 deletions(-)
 create mode 100644 package/android-tools/0003-Adjust-base64-function-handling.patch
 delete mode 100644 package/android-tools/0003-Fix-build-issue-with-uclibc.patch
.checkpackageignore +0 -1
index 11e410b4ea..0dcca5ebc7 100644
@@ -271,7 +271,6 @@ package/am33x-cm3/0004-Makefile-add-fno-builtin.patch lib_patch.Upstream
 package/am33x-cm3/S93-am335x-pm-firmware-load lib_sysv.Variables
 package/android-tools/0001-Fix-makefiles-for-out-of-tree-build.patch lib_patch.Upstream
 package/android-tools/0002-Fix-adbd-for-non-Ubuntu-systems.patch lib_patch.Upstream
-package/android-tools/0003-Fix-build-issue-with-uclibc.patch lib_patch.Upstream
 package/android-tools/0004-Fix-build-issue-with-musl.patch lib_patch.Upstream
 package/android-tools/0005-makefiles-use-pkgconf-to-get-libs-deps.patch lib_patch.Upstream
 package/android-tools/0006-Fix-build-on-big-endian-systems.patch lib_patch.Upstream
package/android-tools/0003-Adjust-base64-function-handling.patch new file +96 -0

96 lines not on this page · raw message

package/android-tools/0003-Fix-build-issue-with-uclibc.patch deleted +0 -40
deleted file mode 100644
index a951271873..0000000000
@@ -1,40 +0,0 @@
-From 082ee80d3524fa3474644c09b441d7f7947675cc Mon Sep 17 00:00:00 2001
-From: Gary Bisson <[email protected]>
-Date: Sun, 1 Dec 2024 15:43:56 +0100
-Subject: [PATCH] Fix build issue with uclibc
-
-Signed-off-by: Gary Bisson <[email protected]>
----
- core/adb/adb_auth_client.c  | 2 +-
- core/adbd/adb_auth_client.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/core/adb/adb_auth_client.c b/core/adb/adb_auth_client.c
-index 0b4913e..068d837 100644
---- a/core/adb/adb_auth_client.c
-+++ b/core/adb/adb_auth_client.c
-@@ -72,7 +72,7 @@ static void read_keys(const char *file, struct listnode *list)
-         if (sep)
-             *sep = '\0';
- 
--        ret = __b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
-+        ret = b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
-         if (ret != sizeof(key->key)) {
-             D("%s: Invalid base64 data ret=%d\n", file, ret);
-             free(key);
-diff --git a/core/adbd/adb_auth_client.c b/core/adbd/adb_auth_client.c
-index 0b4913e..068d837 100644
---- a/core/adbd/adb_auth_client.c
-+++ b/core/adbd/adb_auth_client.c
-@@ -72,7 +72,7 @@ static void read_keys(const char *file, struct listnode *list)
-         if (sep)
-             *sep = '\0';
- 
--        ret = __b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
-+        ret = b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
-         if (ret != sizeof(key->key)) {
-             D("%s: Invalid base64 data ret=%d\n", file, ret);
-             free(key);
--- 
-2.47.0
-
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 3/3] package/android-tools: fix b64_pton() issue with GCC >= 14.x

Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The android-tools code base uses the __b64_pton() function, which isn't provided by all C libraries. So the Debian patch debian/patches/add_adbd.patch adds an implementation of b64_pton(), but doesn't actually use it, nor defines a prototype for it. Our existing patch 0003-Fix-build-issue-with-uclibc.patch switches the code to use the b64_pton() function... but still without providing a prototype, causing the following build failures with GCC >= 14.x:

adb_auth_client.c:75:15: error: implicit declaration of function 'b64_pton'

To fix this, we rework 0003-Fix-build-issue-with-uclibc.patch into a patch that:

(1) Renames b64_pton() to adb_b64_pton() to make sure it won't clash with implementations provided by some C libraries, and adjusts the call sites accordingly.

(2) Adds a prototype definition of adb_b64_pton() in places where this function is used.

Fixes:

http://autobuild.buildroot.net/results/b25b25337c7ad89c33f8bd20b646850bd993ec53ae9/

Even though GCC 14.x support was merged in Buildroot in May 2024, this particular b64_pton() only started appearing on July 15 2024, with the first occurence being:

Quoted 8 lines

http://autobuild.buildroot.net/results/1cbe87bbe3c56f28444b3aaba1ba1d05f947d36e/

Indeed, it's not before July 15 2024 that we merged commit d201f2f5cd0d1e0389430cda78adead37977a6cd ("package/android-tools: add patches to fix build with GCC 14.x"), which fixed other GCC 14.x issues, which were hiding this b64_pton() problem.

Committed to 2024.02.x and 2024.08.x, thanks.

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

PATCH 2/3 package/android-tools: fix build issue on mips64 and powerpc64

In reply to Thomas Petazzoni via buildroot

The kernel headers on mips64 and powerpc64 were historically "broken", defining u64 as an "unsigned long" instead of "unsigned long long". This has been fixed in the upstream Linux kernel by introducing the __SANE_USERSPACE_TYPES__ definition.

Our commit a2e178d6b45dfc5b8d1d50fcbbfc0bec5ebf1ae2 ("android-tools:
disable on some architecture with old kernel headers") already disabled building fastboot on powerpc64 and mips64 systems that have too old kernel headers. However, it turns out that even with the new kernel headers, there are build issues because __SANE_USERSPACE_TYPES__ isn't defined everywhere it should be in the android-tools code base. The Debian patche debian/patches/ppc64el-ftbfs.patch adds some definitions, but it's missing one file, and in another the definition comes too late.

This commit adds an extra patch that fixes this up, and makes fastboot build properly on mips64 and powerpc64.

Fixes:

http://autobuild.buildroot.net/results/8528ff876e695f79bdfe64f5330d9d51eeef66cb/ (powerpc64)
http://autobuild.buildroot.net/results/36ac6af73b618c28d1636093da333f7ebd9d6cfe/ (mips64)

This issue has been occurring as far as Feb 2021, with the first occurence apparently being:

http://autobuild.buildroot.net/results/d9521b4bfeafb1140c21745dbfe28d476a9b71ec/

---
 ...s-make_ext4fs.c-define-__SANE_USERSP.patch | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch
package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch new file +68 -0
new file mode 100644
index 0000000000..5f3650cc77
@@ -0,0 +1,68 @@
+From 5db9529436f13b8c073a0310da3a1107f84645da Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Wed, 4 Dec 2024 20:51:22 +0100
+Subject: [PATCH] extras/ext4_utils/make_ext4fs.c: define
+ __SANE_USERSPACE_TYPES__
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The Debian patch ppc64el-ftbfs.patch is already defining
+__SANE_USERSPACE_TYPES__ in a few files to solve a conflict between
+kernel header definitions and local definition of some types, on
+powerpc64 and mips64.
+
+However, the Debian patch lacks an update to ext4_utils.c, and has the
+definition too late in make_ext4fs.c. This commit therefore fixes
+those two remaining issues, fixing:
+
+error: conflicting types for ‘u64’; have ‘long unsigned int’
+
+Upstream: N/A, we're too far from upstream
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ extras/ext4_utils/ext4_utils.c  | 5 ++++-
+ extras/ext4_utils/make_ext4fs.c | 4 ++++
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/extras/ext4_utils/ext4_utils.c b/extras/ext4_utils/ext4_utils.c
+index e95f5cc..9f6836f 100644
+--- a/extras/ext4_utils/ext4_utils.c
++++ b/extras/ext4_utils/ext4_utils.c
+@@ -14,6 +14,10 @@
+  * limitations under the License.
+  */
+ 
++#if defined(__linux__)
++#define __SANE_USERSPACE_TYPES__
++#endif
++
+ #include "ext4_utils.h"
+ #include "uuid.h"
+ #include "allocate.h"
+@@ -36,7 +40,6 @@
+ #endif
+ 
+ #if defined(__linux__)
+-#define __SANE_USERSPACE_TYPES__
+ #include <linux/fs.h>
+ #elif defined(__APPLE__) && defined(__MACH__)
+ #include <sys/disk.h>
+diff --git a/extras/ext4_utils/make_ext4fs.c b/extras/ext4_utils/make_ext4fs.c
+index 3124aed..332a213 100644
+--- a/extras/ext4_utils/make_ext4fs.c
++++ b/extras/ext4_utils/make_ext4fs.c
+@@ -14,6 +14,10 @@
+  * limitations under the License.
+  */
+ 
++#if defined(__linux__)
++#define __SANE_USERSPACE_TYPES__
++#endif
++
+ #include "make_ext4fs.h"
+ #include "ext4_utils.h"
+ #include "allocate.h"
+-- 
+2.47.0
+
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH 2/3] package/android-tools: fix build issue on mips64 and powerpc64

Quoted 25 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

The kernel headers on mips64 and powerpc64 were historically "broken", defining u64 as an "unsigned long" instead of "unsigned long long". This has been fixed in the upstream Linux kernel by introducing the __SANE_USERSPACE_TYPES__ definition.

Our commit a2e178d6b45dfc5b8d1d50fcbbfc0bec5ebf1ae2 ("android-tools:
disable on some architecture with old kernel headers") already disabled building fastboot on powerpc64 and mips64 systems that have too old kernel headers. However, it turns out that even with the new kernel headers, there are build issues because __SANE_USERSPACE_TYPES__ isn't defined everywhere it should be in the android-tools code base. The Debian patche debian/patches/ppc64el-ftbfs.patch adds some definitions, but it's missing one file, and in another the definition comes too late.

This commit adds an extra patch that fixes this up, and makes fastboot build properly on mips64 and powerpc64.

Fixes:

http://autobuild.buildroot.net/results/8528ff876e695f79bdfe64f5330d9d51eeef66cb/ (powerpc64)
http://autobuild.buildroot.net/results/36ac6af73b618c28d1636093da333f7ebd9d6cfe/ (mips64)

Quoted 6 lines

This issue has been occurring as far as Feb 2021, with the first occurence apparently being:

http://autobuild.buildroot.net/results/d9521b4bfeafb1140c21745dbfe28d476a9b71ec/

Committed to 2024.02.x and 2024.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 16 lines · Thomas Petazzoni via buildroot

Hello,

The android-tools has been causing failures in the autobuilders pretty much every day for the past few months, so it was about time to fix those issues.

This patch series fixes the two most prominent issues:

- An issue related to u64 definition on powerpc64/mips64, which has been occurring in the autobuilders since at least Feb 2021. This patch should be backported to 2024.02.x.

- An issue related to GCC 14.x. Since the support of GCC 14.x is not in 2024.02.x, this second fix is not strictly needed in 2024.02.x, but also shouldn't be harmful.

Quoted 8 lines

A preparation patch converting the existing patch stack to be applicable with "git am" is proposed, as it was needed to preserve my sanity while working on the patch series.

Thomas Petazzoni (3):
package/android-tools: convert all patches to Git-formatted patches package/android-tools: fix build issue on mips64 and powerpc64 package/android-tools: fix b64_pton() issue with GCC >= 14.x

Series applied to master,thanks. Though I don't like the "we're too far from
upstream" part too much :-)

Regards,
Arnout

Quoted 21 lines
  .checkpackageignore                           |  9 +-
  ...-Fix-makefiles-for-out-of-tree-build.patch |  7 +-
  ...0002-Fix-adbd-for-non-Ubuntu-systems.patch |  9 +-
  ...0003-Adjust-base64-function-handling.patch | 96 +++++++++++++++++++
  .../0003-Fix-build-issue-with-uclibc.patch    | 36 -------
  .../0004-Fix-build-issue-with-musl.patch      | 25 +++--
  ...efiles-use-pkgconf-to-get-libs-deps.patch} | 47 +++++----
  ...006-Fix-build-on-big-endian-systems.patch} | 20 +++-
  ...clude-cdefs.h-wherever-it-is-needed.patch} | 18 ++--
  ...smacros.h-to-compile-with-glibc-2.28.patch | 42 --------
  ...minor-major-build-failure-due-to-gli.patch | 59 ++++++++++++
  ...les-for-out-of-tree-ext4_utils-build.patch |  4 +-
  ...atch-for-openssl-1.1.0-compatibility.patch |  4 +-
  ...stboot.c-reorder-functions-to-avoid-.patch |  4 +-
  ...parse_read.c-add-missing-output_file.patch |  4 +-
  ...s-make_ext4fs_main.c-disable-Android.patch |  4 +-
  ...014-core-adbd-adb.c-open-code-capset.patch |  4 +-
  ...b.c-include-correct-header-for-prctl.patch |  4 +-
  ...s-make_ext4fs.c-define-__SANE_USERSP.patch | 68 +++++++++++++
  19 files changed, 320 insertions(+), 144 deletions(-)
Quoted 9 lines

create mode 100644 package/android-tools/0003-Adjust-base64-function-handling.patch
delete mode 100644 package/android-tools/0003-Fix-build-issue-with-uclibc.patch
rename package/android-tools/{0005-Use-pkgconf-to-get-libs-deps.patch => 0005-makefiles-use-pkgconf-to-get-libs-deps.patch} (57%) rename package/android-tools/{0006-fix-big-endian-build.patch => 0006-Fix-build-on-big-endian-systems.patch} (75%) rename package/android-tools/{0007-include-cdefs-h-when-needed.patch => 0007-Include-cdefs.h-wherever-it-is-needed.patch} (71%) delete mode 100644 package/android-tools/0008-Include-sysmacros.h-to-compile-with-glibc-2.28.patch
create mode 100644 package/android-tools/0008-usb_linux.c-fix-minor-major-build-failure-due-to-gli.patch create mode 100644 package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
Quoted 2 lines · On Wed, 4 Dec 2024 22:48:11 +0100 Arnout Vandecappelle <[email protected]> wrote:

Series applied to master,thanks. Though I don't like the "we're too far from
upstream" part too much :-)

Me neither of course... but that android-tools stuff is really really far from upstream. I recently discovered
https://github.com/nmeum/android-tools/ which seems to be an attempt at having a "common" place for a CMake build system for those android-tools.

They also have lots of patches, though:
https://github.com/nmeum/android-tools/tree/master/patches

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot