From 5316cb1c19cfbd5dbbfd3250fe1f4a6208a62239 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 22 Jun 2018 17:36:15 +0100 Subject: [PATCH] [amd64,arm64,armhf] android: Build modules to support Anbox (Closes: #901492) --- debian/changelog | 12 +++ debian/config/amd64/config | 5 ++ debian/config/arm64/config | 5 ++ debian/config/armhf/config | 5 ++ debian/config/config | 15 ++++ ...uilding-ashmem-and-binder-as-modules.patch | 73 +++++++++++++++++++ debian/patches/series | 1 + 7 files changed, 116 insertions(+) create mode 100644 debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch diff --git a/debian/changelog b/debian/changelog index 6b09ebcc2..865462a50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +linux (4.17.2-1~exp2) UNRELEASED; urgency=medium + + * [amd64,arm64,armhf] android: Build modules to support Anbox + (Closes: #901492) + - Enable building ashmem and binder as modules + - Enable ANDROID + - Enable ANDROID_BINDER_IPC, ASHMEM as modules + - Set ANDROID_BINDER_DEVICES="binder" + - Disable ANDROID_BINDER_IPC_32BIT + + -- Ben Hutchings Fri, 22 Jun 2018 17:34:37 +0100 + linux (4.17.2-1~exp1) experimental; urgency=medium * New upstream release: https://kernelnewbies.org/Linux_4.17 diff --git a/debian/config/amd64/config b/debian/config/amd64/config index 224c2d7d0..b1915bb73 100644 --- a/debian/config/amd64/config +++ b/debian/config/amd64/config @@ -81,6 +81,11 @@ CONFIG_SIGNED_PE_FILE_VERIFICATION=y ## CONFIG_ACPI_BGRT=y +## +## file: drivers/android/Kconfig +## +CONFIG_ANDROID=y + ## ## file: drivers/block/Kconfig ## diff --git a/debian/config/arm64/config b/debian/config/arm64/config index aa93aa8e3..adf3e60bd 100644 --- a/debian/config/arm64/config +++ b/debian/config/arm64/config @@ -73,6 +73,11 @@ CONFIG_ACPI_NUMA=y ## CONFIG_ACPI_NFIT=y +## +## file: drivers/android/Kconfig +## +CONFIG_ANDROID=y + ## ## file: drivers/ata/Kconfig ## diff --git a/debian/config/armhf/config b/debian/config/armhf/config index 599a57ba4..8c200a262 100644 --- a/debian/config/armhf/config +++ b/debian/config/armhf/config @@ -151,6 +151,11 @@ CONFIG_OMAP_SERIAL_WAKE=y CONFIG_OMAP_PM_NOOP=y ## end choice +## +## file: drivers/android/Kconfig +## +CONFIG_ANDROID=y + ## ## file: drivers/ata/Kconfig ## diff --git a/debian/config/config b/debian/config/config index ed905b8b9..063f5ef54 100644 --- a/debian/config/config +++ b/debian/config/config @@ -189,6 +189,11 @@ CONFIG_ACPI_NFIT=m ## file: drivers/android/Kconfig ## # CONFIG_ANDROID is not set +CONFIG_ANDROID_BINDER_IPC=m +#. This configuration should support Anbox +CONFIG_ANDROID_BINDER_DEVICES="binder" +# CONFIG_ANDROID_BINDER_IPC_32BIT is not set +# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set ## ## file: drivers/ata/Kconfig @@ -4462,6 +4467,16 @@ CONFIG_SSB_PCMCIAHOST=y ## CONFIG_STAGING=y +## +## file: drivers/staging/android/Kconfig +## +CONFIG_ASHMEM=m + +## +## file: drivers/staging/android/ion/Kconfig +## +# CONFIG_ION is not set + ## ## file: drivers/staging/board/Kconfig ## diff --git a/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch b/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch new file mode 100644 index 000000000..2f44ad105 --- /dev/null +++ b/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch @@ -0,0 +1,73 @@ +From: Ben Hutchings +Date: Fri, 22 Jun 2018 17:27:00 +0100 +Subject: android: Enable building ashmem and binder as modules +Bug-Debian: https://bugs.debian.org/901492 + +We want to enable use of the Android ashmem and binder drivers to +support Anbox, but they should not be built-in as that would waste +resources and increase security attack surface on systems that don't +need them. + +- Add a MODULE_LICENSE declaration to ashmem +- Change the Makefiles to build each driver as an object with the + "_linux" suffix (which is what Anbox expects) +- Change config symbol types to tristate + +--- +--- a/drivers/android/Kconfig ++++ b/drivers/android/Kconfig +@@ -9,7 +9,7 @@ config ANDROID + if 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,4 +1,5 @@ + ccflags-y += -I$(src) # needed for trace events + +-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_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o +--- a/drivers/staging/android/Kconfig ++++ b/drivers/staging/android/Kconfig +@@ -3,7 +3,7 @@ menu "Android" + if ANDROID + + config ASHMEM +- bool "Enable the Anonymous Shared Memory Subsystem" ++ tristate "Enable the Anonymous Shared Memory Subsystem" + default n + depends on SHMEM + ---help--- +--- a/drivers/staging/android/Makefile ++++ b/drivers/staging/android/Makefile +@@ -2,4 +2,5 @@ ccflags-y += -I$(src) # needed for tra + + obj-y += ion/ + +-obj-$(CONFIG_ASHMEM) += ashmem.o ++obj-$(CONFIG_ASHMEM) += ashmem_linux.o ++ashmem_linux-y += ashmem.o +--- a/drivers/staging/android/ashmem.c ++++ b/drivers/staging/android/ashmem.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include "ashmem.h" + + #define ASHMEM_NAME_PREFIX "dev/ashmem/" +@@ -895,3 +896,5 @@ out: + return ret; + } + device_initcall(ashmem_init); ++ ++MODULE_LICENSE("GPL v2"); diff --git a/debian/patches/series b/debian/patches/series index 98bd8898e..53c589716 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -12,6 +12,7 @@ debian/modpost-symbol-prefix.patch debian/tools-perf-version.patch debian/tools-perf-install.patch debian/wireless-add-debian-wireless-regdb-certificates.patch +debian/android-enable-building-ashmem-and-binder-as-modules.patch # Fixes/improvements to firmware loading features/all/drivers-media-dvb-usb-af9005-request_firmware.patch