From 35e9dd484d404d984115c2976049c1cfa8ec2817 Mon Sep 17 00:00:00 2001 From: tigro Date: Sat, 18 Nov 2023 23:35:14 +0300 Subject: [PATCH] Fix build for RedHat 9.3 --- .../0001-Fix-build-on-RedHat-9.3-kernel.patch | 84 +++++++++++++++++++ SPECS/kmod-anbox.spec | 6 +- 2 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 SOURCES/0001-Fix-build-on-RedHat-9.3-kernel.patch diff --git a/SOURCES/0001-Fix-build-on-RedHat-9.3-kernel.patch b/SOURCES/0001-Fix-build-on-RedHat-9.3-kernel.patch new file mode 100644 index 0000000..ba3ba73 --- /dev/null +++ b/SOURCES/0001-Fix-build-on-RedHat-9.3-kernel.patch @@ -0,0 +1,84 @@ +From 4f64fe52b50af7f79a59eb89f8bfd4983dce5ea3 Mon Sep 17 00:00:00 2001 +From: tigro +Date: Sat, 18 Nov 2023 22:59:08 +0300 +Subject: [PATCH] Fix build on RedHat 9.3 kernel + +--- + ashmem/ashmem.c | 2 +- + binder/binder.c | 2 +- + binder/binder_alloc.c | 2 +- + binder/deps.c | 6 +++--- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/ashmem/ashmem.c b/ashmem/ashmem.c +index 9c38c9e..5589bfd 100644 +--- a/ashmem/ashmem.c ++++ b/ashmem/ashmem.c +@@ -874,7 +874,7 @@ static int __init ashmem_init(void) + return ret; + } + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + register_shrinker(&ashmem_shrinker, "android-ashmem"); + #else + register_shrinker(&ashmem_shrinker); +diff --git a/binder/binder.c b/binder/binder.c +index 99f47c3..45aa600 100644 +--- a/binder/binder.c ++++ b/binder/binder.c +@@ -2236,7 +2236,7 @@ static void binder_deferred_fd_close(int fd) + if (!twcb) + return; + init_task_work(&twcb->twork, binder_do_fd_close); +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + twcb->file = close_fd_get_file(fd); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) + close_fd_get_file(fd, &twcb->file); +diff --git a/binder/binder_alloc.c b/binder/binder_alloc.c +index 13b8b32..350edb5 100644 +--- a/binder/binder_alloc.c ++++ b/binder/binder_alloc.c +@@ -1084,7 +1084,7 @@ int binder_alloc_shrinker_init(void) + int ret = list_lru_init(&binder_alloc_lru); + + if (ret == 0) { +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + ret = register_shrinker(&binder_shrinker, "android-binder"); + #else + ret = register_shrinker(&binder_shrinker); +diff --git a/binder/deps.c b/binder/deps.c +index 232bded..95b896a 100644 +--- a/binder/deps.c ++++ b/binder/deps.c +@@ -70,14 +70,14 @@ static unsigned long kallsyms_lookup_name_wrapper(const char *name) + #endif + } + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + static struct file *(*close_fd_get_file_ptr)(unsigned int fd) + #else + static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res) + #endif + = NULL; + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + struct file *close_fd_get_file(unsigned int fd) + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) + int close_fd_get_file(unsigned int fd, struct file **res) +@@ -92,7 +92,7 @@ int __close_fd_get_file(unsigned int fd, struct file **res) + close_fd_get_file_ptr = kallsyms_lookup_name_wrapper("__close_fd_get_file"); + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)) + return close_fd_get_file_ptr(fd); + #else + return close_fd_get_file_ptr(fd, res); +-- +2.41.0 + diff --git a/SPECS/kmod-anbox.spec b/SPECS/kmod-anbox.spec index 9ba7f58..1388874 100644 --- a/SPECS/kmod-anbox.spec +++ b/SPECS/kmod-anbox.spec @@ -32,6 +32,8 @@ URL: https://github.com/choff/anbox-modules Source0: anbox-modules-bead1deb.tar.gz Source5: GPL-v2.0.txt +Patch0: 0001-Fix-build-on-RedHat-9.3-kernel.patch + # Fix for the SB-signing issue caused by a bug in /usr/lib/rpm/brp-strip # https://bugzilla.redhat.com/show_bug.cgi?id=1967291 @@ -65,7 +67,7 @@ It is built to depend upon the specific ABI provided by a range of releases of the same variant of the Linux kernel and not on any one specific build. %prep -%setup -q -n anbox-abead1debfae56e8d0307c642865ec23aaa854d3 +%autosetup -p1 -n anbox-abead1debfae56e8d0307c642865ec23aaa854d3 echo "override ashmem_linux * weak-updates/ashmem_linux" > kmod-%{kmod_name}.conf echo "override binder_linux * weak-updates/binder_linux" >> kmod-%{kmod_name}.conf @@ -190,7 +192,7 @@ exit 0 %changelog * Sat Nov 18 2023 Arkady L. Shane - 0.0.1-1.20230505git.bead1deb.1 -- Rebuilt for MSVSphere 9.3 +- Fix build for MSVSphere 9.3 * Wed Sep 06 2023 Arkady L. Shane - 0.0.1-1.20230505git.bead1deb - Rebuilt for MSVSphere 9.2