[2/2] linux-custom: Add support for arm64 compat vDSO

Message ID 1152ee8621ae69c6422890214dd3fbc3866cb05f.1730114004.git.jan.kiszka@siemens.com
State Accepted, archived
Headers show
Series linux-custom: Enable compat vDSO support for arm64, clean up rules | expand

Commit Message

Jan Kiszka Oct. 28, 2024, 11:13 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

To build the 32-bit vDSO for arm64 kernels, we need to set
CROSS_COMPILE_COMPAT during the build as well. Do that if
ISAR_ENABLE_COMPAT_ARCH is enabled.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/recipes-kernel/linux/files/debian/isar/build.tmpl  | 1 +
 meta/recipes-kernel/linux/files/debian/isar/common.tmpl | 7 ++++++-
 meta/recipes-kernel/linux/linux-custom.inc              | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
index bafc5ca4..b4c105c1 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
@@ -43,6 +43,7 @@  print_settings() {
 # ---------------
 # ARCH=${ARCH}
 # CROSS_COMPILE=${CROSS_COMPILE}
+# CROSS_COMPILE_COMPAT=${CROSS_COMPILE_COMPAT}
 # KBUILD_BUILD_TIMESTAMP=${KBUILD_BUILD_TIMESTAMP}
 EOF
 }
diff --git a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
index 5ba11289..f9cc2f02 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl
@@ -21,6 +21,11 @@  then
     CROSS_COMPILE=$(dpkg-architecture -f -A ${DISTRO_ARCH} -q DEB_TARGET_GNU_TYPE)-
 fi
 
+# Required from building a compat vDSO on arm64
+if [ "${ISAR_ENABLE_COMPAT_ARCH}" = "1" ] && [ "${DISTRO_ARCH}" = "arm64" ]; then
+    CROSS_COMPILE_COMPAT=$(dpkg-architecture -f -A ${COMPAT_DISTRO_ARCH} -q DEB_TARGET_GNU_TYPE)-
+fi
+
 # Constants
 KCONF=.config
 
@@ -51,7 +56,7 @@  main() {
     done
 
     # variables to be exported
-    export ARCH CROSS_COMPILE
+    export ARCH CROSS_COMPILE CROSS_COMPILE_COMPAT
 
     # are we cross-compiling?
     BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 0f23d6f0..f6486096 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -87,6 +87,8 @@  TEMPLATE_VARS += "                \
     DISTRIBUTOR                   \
     KERNEL_EXTRA_BUILDARGS        \
     HEADERS_INSTALL_EXTRA         \
+    ISAR_ENABLE_COMPAT_ARCH       \
+    COMPAT_DISTRO_ARCH            \
 "
 
 inherit dpkg