From b8e9a352d2d733332f9be4ee971a840c1b9cef29 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 4 Dec 2024 21:48:01 +0100 Subject: [PATCH] package/android-tools: fix build issue on mips64 and powerpc64 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/ Signed-off-by: Thomas Petazzoni Signed-off-by: Arnout Vandecappelle (cherry picked from commit ee65a2119aba93692970ae83e083974ef865c15b) Signed-off-by: Peter Korsgaard --- ...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 diff --git a/package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch b/package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch new file mode 100644 index 0000000000..5f3650cc77 --- /dev/null +++ b/package/android-tools/0016-extras-ext4_utils-make_ext4fs.c-define-__SANE_USERSP.patch @@ -0,0 +1,68 @@ +From 5db9529436f13b8c073a0310da3a1107f84645da Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +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 +--- + 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 + #elif defined(__APPLE__) && defined(__MACH__) + #include +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 +