about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-29 14:10:05 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-10-29 14:10:05 +0100
commit2aff4239ccb0b6a50fa3aa84a011b293f0b85822 (patch)
tree89596758ee661099382a7920980d170d8ba36600
parentd99d18759bf7d1e2e83b5c263f7f915ec8e7b7d0 (diff)
downloadbox64-2aff4239ccb0b6a50fa3aa84a011b293f0b85822.tar.gz
box64-2aff4239ccb0b6a50fa3aa84a011b293f0b85822.zip
[BOX32] Added an option to also add binfmt integration for box32 (for #1973)
-rw-r--r--CMakeLists.txt19
-rw-r--r--system/box32.conf.cmake2
2 files changed, 16 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e0fa712..3d1bb319 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@ option(SW64 "Set ON if targeting an SW64 based device" ${SW64})
 option(CI "Set to ON if running in CI" ${CI})
 option(WITH_MOLD "Set to ON to use with mold" ${WITH_MOLD})
 option(BOX32 "Set to ON to add Linux 32bits support (experimental, do not use)" ${BO64})
+option(BOX32_BINFMT "Also setup binfmt integration for box32" ${BO64_BINFMT})
 
 if(TERMUX)
     set(TERMUX_PATH "/data/data/com.termux/files")
@@ -1144,11 +1145,19 @@ if(NOT _x86 AND NOT _x86_64)
   if(NOT NO_CONF_INSTALL)
     configure_file(system/box64.conf.cmake system/box64.conf)
 	  if(NOT TERMUX)
-    		install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION /etc/binfmt.d/)
-    		install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION /etc/)
-	  else()
-		install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION ${TERMUX_PATH}/usr/etc/binfmt.d/)
-		install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION ${TERMUX_PATH}/usr/etc/)
+        install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION /etc/binfmt.d/)
+        install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION /etc/)
+        if(BOX32_BINFMT)
+            configure_file(system/box32.conf.cmake system/box32.conf)
+            install(FILES ${CMAKE_BINARY_DIR}/system/box32.conf DESTINATION /etc/binfmt.d/)
+        endif()
+      else()
+        install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION ${TERMUX_PATH}/usr/etc/binfmt.d/)
+        install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION ${TERMUX_PATH}/usr/etc/)
+        if(BOX32_BINFMT)
+            configure_file(system/box32.conf.cmake system/box32.conf)
+            install(FILES ${CMAKE_BINARY_DIR}/system/box32.conf DESTINATION ${TERMUX_PATH}/usr/etc/binfmt.d/)
+        endif()
 	  endif()
 
   endif()
diff --git a/system/box32.conf.cmake b/system/box32.conf.cmake
new file mode 100644
index 00000000..0e872132
--- /dev/null
+++ b/system/box32.conf.cmake
@@ -0,0 +1,2 @@
+# /etc/binfmt.d/box32.conf
+:box32:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:${CMAKE_INSTALL_PREFIX}/bin/${BOX64}: