[packages/kernel] - enable and build android binder as module

baggins baggins at pld-linux.org
Thu Dec 29 14:16:35 CET 2022


commit be80c15233288728f09c58336c1e1152969b25ff
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Thu Dec 29 14:12:06 2022 +0100

    - enable and build android binder as module
    
    This driver is needed by Android emulators Anbox and Waydroid and we
    don't want the driver built-in

 android-enable-building-binder-as-module.patch | 106 +++++++++++++++++++++++++
 kernel-multiarch.config                        |   5 +-
 kernel.spec                                    |   2 +
 3 files changed, 112 insertions(+), 1 deletion(-)
---
diff --git a/kernel.spec b/kernel.spec
index cad149ff..7a4deee3 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -152,6 +152,7 @@ Source55:	kernel-imq.config
 Source58:	kernel-inittmpfs.config
 
 Patch1:		make-4.4.patch
+Patch2:		android-enable-building-binder-as-module.patch
 # http://dev.gentoo.org/~spock/projects/fbcondecor/archive/fbcondecor-0.9.4-2.6.25-rc6.patch
 Patch3:		kernel-fbcondecor.patch
 Patch6:		linux-wistron-nx.patch
@@ -611,6 +612,7 @@ cd linux-%{basever}
 
 %if %{without vanilla}
 %patch1 -p1
+%patch2 -p1
 
 %if %{with fbcondecor}
 %patch3 -p1
diff --git a/android-enable-building-binder-as-module.patch b/android-enable-building-binder-as-module.patch
new file mode 100644
index 00000000..82161c61
--- /dev/null
+++ b/android-enable-building-binder-as-module.patch
@@ -0,0 +1,106 @@
+--- a/drivers/android/Kconfig
++++ b/drivers/android/Kconfig
+@@ -2,7 +2,7 @@
+ menu "Android"
+ 
+ config ANDROID_BINDER_IPC
+-	bool "Android Binder IPC Driver"
++	tristate "Android Binder IPC Driver"
+ 	depends on MMU
+ 	default n
+ 	help
+--- a/drivers/android/Makefile
++++ b/drivers/android/Makefile
+@@ -1,6 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0-only
+ ccflags-y += -I$(src)			# needed for trace events
+ 
+-obj-$(CONFIG_ANDROID_BINDERFS)		+= binderfs.o
+-obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder.o binder_alloc.o
+-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
++obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder_linux.o
++binder_linux-y := binder.o binder_alloc.o
++binder_linux-$(CONFIG_ANDROID_BINDERFS)	+= binderfs.o
++binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
+--- a/drivers/android/binder_alloc.c
++++ b/drivers/android/binder_alloc.c
+@@ -38,7 +38,7 @@ enum {
+ };
+ static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
+ 
+-module_param_named(debug_mask, binder_alloc_debug_mask,
++module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
+ 		   uint, 0644);
+ 
+ #define binder_alloc_debug(mask, x...) \
+--- a/fs/file.c
++++ b/fs/file.c
+@@ -813,6 +813,7 @@ struct file *close_fd_get_file(unsigned
+ 
+ 	return file;
+ }
++EXPORT_SYMBOL_GPL(close_fd_get_file);
+ 
+ void do_close_on_exec(struct files_struct *files)
+ {
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -7052,6 +7052,7 @@ static bool is_nice_reduction(const stru
+ 
+ 	return (nice_rlim <= task_rlimit(p, RLIMIT_NICE));
+ }
++EXPORT_SYMBOL_GPL(can_nice);
+ 
+ /*
+  * can_nice - check if a task can reduce its nice value
+--- a/kernel/task_work.c
++++ b/kernel/task_work.c
+@@ -73,6 +73,7 @@ int task_work_add(struct task_struct *ta
+ 
+ 	return 0;
+ }
++EXPORT_SYMBOL_GPL(task_work_add);
+ 
+ /**
+  * task_work_cancel_match - cancel a pending work added by task_work_add()
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -1757,6 +1757,7 @@ void zap_page_range(struct vm_area_struc
+ 	mmu_notifier_invalidate_range_end(&range);
+ 	tlb_finish_mmu(&tlb);
+ }
++EXPORT_SYMBOL_GPL(zap_page_range);
+ 
+ /**
+  * zap_page_range_single - remove user pages in a given range
+--- a/security/security.c
++++ b/security/security.c
+@@ -752,24 +752,28 @@ int security_binder_set_context_mgr(cons
+ {
+ 	return call_int_hook(binder_set_context_mgr, 0, mgr);
+ }
++EXPORT_SYMBOL_GPL(security_binder_set_context_mgr);
+ 
+ int security_binder_transaction(const struct cred *from,
+ 				const struct cred *to)
+ {
+ 	return call_int_hook(binder_transaction, 0, from, to);
+ }
++EXPORT_SYMBOL_GPL(security_binder_transaction);
+ 
+ int security_binder_transfer_binder(const struct cred *from,
+ 				    const struct cred *to)
+ {
+ 	return call_int_hook(binder_transfer_binder, 0, from, to);
+ }
++EXPORT_SYMBOL_GPL(security_binder_transfer_binder);
+ 
+ int security_binder_transfer_file(const struct cred *from,
+ 				  const struct cred *to, struct file *file)
+ {
+ 	return call_int_hook(binder_transfer_file, 0, from, to, file);
+ }
++EXPORT_SYMBOL_GPL(security_binder_transfer_file);
+ 
+ int security_ptrace_access_check(struct task_struct *child, unsigned int mode)
+ {
diff --git a/kernel-multiarch.config b/kernel-multiarch.config
index d9f3bcd6..a2eda7ee 100644
--- a/kernel-multiarch.config
+++ b/kernel-multiarch.config
@@ -454,7 +454,10 @@ TPS68470_PMIC_OPREGION=y
 #-
 #- *** FILE: drivers/android/Kconfig ***
 #-
-ANDROID_BINDER_IPC all=n
+ANDROID_BINDER_IPC all=m
+ANDROID_BINDERFS all=y
+ANDROID_BINDER_DEVICES all="binder,hwbinder,vndbinder"
+ANDROID_BINDER_IPC_SELFTEST all=n
 
 #-
 #- *** FILE: drivers/ata/Kconfig ***
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/be80c15233288728f09c58336c1e1152969b25ff



More information about the pld-cvs-commit mailing list