[BOX32] Added an option to also add binfmt integration for box32 (for #1973)

This commit is contained in:
ptitSeb 2024-10-29 14:10:05 +01:00
parent d99d18759b
commit 2aff4239cc
2 changed files with 16 additions and 5 deletions

View File

@ -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(CI "Set to ON if running in CI" ${CI})
option(WITH_MOLD "Set to ON to use with mold" ${WITH_MOLD}) 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 "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) if(TERMUX)
set(TERMUX_PATH "/data/data/com.termux/files") set(TERMUX_PATH "/data/data/com.termux/files")
@ -1146,9 +1147,17 @@ if(NOT _x86 AND NOT _x86_64)
if(NOT TERMUX) if(NOT TERMUX)
install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION /etc/binfmt.d/) install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION /etc/binfmt.d/)
install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION /etc/) 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() else()
install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION ${TERMUX_PATH}/usr/etc/binfmt.d/) 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_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()
endif() endif()

2
system/box32.conf.cmake Normal file
View File

@ -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}: