From 47ae13ac512ce9ca02ec90f2e7307edae2e3226c Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 2 May 2022 22:44:10 -0400 Subject: [PATCH] Bundle An ARM Sysroot --- CMakeLists.txt | 2 +- dependencies/CMakeLists.txt | 4 + dependencies/armhf-sysroot/CMakeLists.txt | 104 ++++++++++ .../armhf-sysroot/apt/keys/bullseye.asc | 186 ++++++++++++++++++ dependencies/armhf-sysroot/apt/sources.list | 2 + launcher/src/bootstrap.c | 26 +-- launcher/src/patchelf.c | 21 ++ launcher/src/patchelf.h | 1 + libreborn/src/util/exec.c | 4 +- scripts/generate-appimage-builder-yaml.js | 21 +- 10 files changed, 346 insertions(+), 25 deletions(-) create mode 100644 dependencies/armhf-sysroot/CMakeLists.txt create mode 100644 dependencies/armhf-sysroot/apt/keys/bullseye.asc create mode 100644 dependencies/armhf-sysroot/apt/sources.list diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e7d8553b..14c06ec2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ endif() project(minecraft-pi-reborn) # Require ARM Compilation -if(USE_ARM32_TOOLCHAIN AND (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm") AND (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") AND (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "armv8l")) +if(USE_ARM32_TOOLCHAIN AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") message(FATAL_ERROR "ARM-Targeting Compiler Required") endif() diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 8d2df00a4..e8fabd865 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -20,3 +20,7 @@ endif() if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE) add_subdirectory(zenity) endif() +# Sysroot +if(BUILD_NATIVE_COMPONENTS AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + add_subdirectory(armhf-sysroot) +endif() diff --git a/dependencies/armhf-sysroot/CMakeLists.txt b/dependencies/armhf-sysroot/CMakeLists.txt new file mode 100644 index 000000000..25e1a512d --- /dev/null +++ b/dependencies/armhf-sysroot/CMakeLists.txt @@ -0,0 +1,104 @@ +project(armhf-sysroot) + +# Packages +set(APT_PACKAGES "libc6" "libstdc++6") + +# Trigger Reconfigure On APT Change +file(GLOB_RECURSE APT_FILES "apt/*") +foreach(APT_FILE IN LISTS APT_FILES) + set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS "${APT_FILE}" + ) +endforeach() + +# Copy To Binary Directory +set(APT_DIR "${CMAKE_CURRENT_BINARY_DIR}/apt") +file(REMOVE_RECURSE "${APT_DIR}") +file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/apt/." DESTINATION "${APT_DIR}") +# Make Directories +file(MAKE_DIRECTORY "${APT_DIR}/apt.conf.d") +file(MAKE_DIRECTORY "${APT_DIR}/preferences.d") +file(MAKE_DIRECTORY "${APT_DIR}/dpkg") +file(TOUCH "${APT_DIR}/dpkg/status") + +# Create APT Config +string(CONCAT APT_CONFIG + "Dir \"${APT_DIR}\";\n" + "Dir::State \"${APT_DIR}\";\n" + "Dir::Cache \"${APT_DIR}\";\n" + "Dir::Etc::Main \"${APT_DIR}/apt.conf\";\n" + "Dir::Etc::Parts \"${APT_DIR}/apt.conf.d\";\n" + "Dir::Etc::SourceList \"${APT_DIR}/sources.list\";\n" + "Dir::Etc::SourceListParts \"${APT_DIR}/sources.list.d\";\n" + "Dir::Etc::PreferencesParts \"${APT_DIR}/preferences.d\";\n" + "Dir::Etc::TrustedParts \"${APT_DIR}/keys\";\n" + "Dir::State::status \"${APT_DIR}/dpkg/status\";\n" + "Dir::Ignore-Files-Silently \"False\";\n" + "APT::Install-Recommends \"False\";\n" + "APT::Install-Suggests \"False\";\n" + "APT::Immediate-Configure \"False\";\n" + "APT::Architecture \"armhf\";\n" + "APT::Architectures { \"armhf\"; }\n" + "Acquire::Languages \"none\";\n" + "APT::Get::AllowUnauthenticated \"False\";\n" + "Acquire::AllowInsecureRepositories \"False\";\n" +) +file(WRITE "${APT_DIR}/apt.conf" "${APT_CONFIG}") + +# Environment +set(APT_ENV + "${CMAKE_COMMAND}" + -E env + DEBIAN_FRONTEND=noninteractive + "APT_CONFIG=${APT_DIR}/apt.conf" +) + +# Create Sysroot Directory +set(SYSROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/sysroot") +file(REMOVE_RECURSE "${SYSROOT_DIR}") +file(MAKE_DIRECTORY "${SYSROOT_DIR}") + +# Download +add_custom_command( + OUTPUT "${APT_DIR}/.update-stamp" + COMMAND ${APT_ENV} apt-get update + COMMAND touch ARGS "${APT_DIR}/.update-stamp" + VERBATIM +) +add_custom_command( + OUTPUT "${APT_DIR}/.download-stamp" + DEPENDS "${APT_DIR}/.update-stamp" + COMMAND ${APT_ENV} apt-get install -y --no-install-recommends --download-only ${APT_PACKAGES} + COMMAND touch ARGS "${APT_DIR}/.download-stamp" + VERBATIM +) +add_custom_command( + OUTPUT "${APT_DIR}/.extract-stamp" + DEPENDS "${APT_DIR}/.download-stamp" + COMMAND ${APT_ENV} find "${APT_DIR}/archives" -maxdepth 1 -type f -name "*.deb" -exec dpkg -x {} "${SYSROOT_DIR}" ";" + COMMAND touch ARGS "${APT_DIR}/.extract-stamp" + VERBATIM +) +add_custom_target(armhf-sysroot ALL DEPENDS "${APT_DIR}/.extract-stamp") + +# Install +install( + DIRECTORY "${SYSROOT_DIR}/" + DESTINATION "${MCPI_INSTALL_DIR}/sysroot" + USE_SOURCE_PERMISSIONS + REGEX "usr/lib/arm-linux-gnueabihf/gconv" EXCLUDE + REGEX "usr/lib/arm-linux-gnueabihf/audit" EXCLUDE + REGEX "usr/share/man" EXCLUDE + REGEX "usr/share/doc/.*/README\..*" EXCLUDE + REGEX "usr/share/doc/.*/changelog\..*" EXCLUDE + REGEX "usr/share/doc/.*/NEWS\..*" EXCLUDE + REGEX "usr/share/doc/.*/TODO\..*" EXCLUDE + REGEX "usr/share/lintian" EXCLUDE + REGEX "usr/share/gcc" EXCLUDE + REGEX "usr/share/gdb" EXCLUDE + REGEX "usr/share/locale" EXCLUDE + REGEX "usr/share/help" EXCLUDE + REGEX "etc" EXCLUDE +) diff --git a/dependencies/armhf-sysroot/apt/keys/bullseye.asc b/dependencies/armhf-sysroot/apt/keys/bullseye.asc new file mode 100644 index 000000000..d27de80ae --- /dev/null +++ b/dependencies/armhf-sysroot/apt/keys/bullseye.asc @@ -0,0 +1,186 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGAEHQwBEAC7MhpIQlLicwR8tmMH0yFkMIsqIbfudnBCuV043sSSSdUT/XjA +XKdsdOCpfb6Tfiau1uY9Yb8gWLM8JxmSuaIa1jKlYiRZ5G79D7NOVIcqBrqp3lzV +HShLEXs4421f0Y4bSMuDcY/cdmRt+S+qlJvqKLwAbyejyi1i1N39UfJtK/OdZfuP +Njz8VoWPgJff7CaIYYREo4QWzAnuq65gN6DP3q33vh5OcoZgMDR+toEKYyGqhjXI +YEJU9qYz/wpglyijbFoyS3jn0oCTHpS2NwKc01vBGVZpfR+DVSgDWWQHjlrSpb9E +7bAxn2RfUZnQ6Sh3qcoihOjyI0RZ9ZYH8uQlur1JSS2n3/RxtCaV6uRtXDB5GuXj +NfqNsprZVhYYhBcX4z/4oMVim5ABkXwGNQMezrESHGq3oiIeJaBI5Oso2g/D1MIS +2W5B6NzSTqB4CaGzZ+IY30vvkxhnIG7gr4y76FzcafdJKM1cH/XlFXjnSGQ6UmA0 +E6hpXnjsQWGPL7InpDYHFVl1dH2syHOqHUmEU8CcZayb6hVygnQHh7DlhsrtnrN8 +4qEkuXfitC4Aqaq7lMflGB+ymphxBM+CC4OfiyvW2FDuzQAIWPVRwmKuKxMCRnPm +Sd+UPkyD0jm6yb1F2Fl8Y5T4lYOJJ9OfOpUz38LEqdVx0BosBn68shCwPwARAQAB +iQJOBB8BCgA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3fRJB8NvALsYMp0MU7hx3wQWmX9q58mb4qXvypFn+IqTOuN1AVCqSVEDn+gc +dehCG8vkjOIKMANfKEqRrbQmY7CJtI4BxkJwtUCTVPaRDVdW3RTv4K8K8KAM+hVz +7rnFYTONiO51yPCCuVHSQ9ivZv5GohbyDO5nNTve1no6Fzl5l/CSpb5XCvOcGMvg +MWP22nlLGoSNG4g3TWlUabxrXmPEANG7D+qEhhuebeFC6OpX2i1JgYEpUgoTFtFC +96299K38JSWRK/x0FPigzxvUkxVt7rG3APIPJlYQhYRq2rmDA4zRQL/ZDtFF9+QH +IIvMDlYYZCLKlxoEjYlCusJLiwHiO5uiHDiLRA1vu1qeJVJ8o435g/gRLJALZojZ +1UKhwK2BVhqTmCWb +=svWP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/dependencies/armhf-sysroot/apt/sources.list b/dependencies/armhf-sysroot/apt/sources.list new file mode 100644 index 000000000..61d48c4b2 --- /dev/null +++ b/dependencies/armhf-sysroot/apt/sources.list @@ -0,0 +1,2 @@ +deb [arch=armhf] http://deb.debian.org/debian/ bullseye main +deb [arch=armhf] http://deb.debian.org/debian/ bullseye-updates main diff --git a/launcher/src/bootstrap.c b/launcher/src/bootstrap.c index 54bdb6ee8..ec2223dcf 100644 --- a/launcher/src/bootstrap.c +++ b/launcher/src/bootstrap.c @@ -185,15 +185,6 @@ void bootstrap(int argc, char *argv[]) { // Get Binary Directory char *binary_directory = get_binary_directory(); - // Handle AppImage - char *usr_prefix = NULL; -#ifdef MCPI_IS_APPIMAGE_BUILD - usr_prefix = getenv("APPDIR"); -#endif - if (usr_prefix == NULL) { - usr_prefix = ""; - } - // Resolve Binary Path & Set MCPI_DIRECTORY { // Log @@ -235,9 +226,16 @@ void bootstrap(int argc, char *argv[]) { // Find Linker char *linker = NULL; - // Preserve Existing Linker On ARM + // Select Linker #ifndef __arm__ - safe_asprintf(&linker, "%s/usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3", usr_prefix); + // Use ARM Sysroot Linker + safe_asprintf(&linker, "%s/sysroot/lib/ld-linux-armhf.so.3", binary_directory); +#else + // Use Current Linker + char *exe = realpath("/proc/self/exe", NULL); + ALLOC_CHECK(exe); + linker = patch_get_interpreter(exe); + free(exe); #endif // Patch @@ -266,8 +264,10 @@ void bootstrap(int argc, char *argv[]) { // Add Library Directory safe_asprintf(&new_ld_path, "%s/lib", binary_directory); - // Load ARM Libraries (Ensure Priority) - string_append(&new_ld_path, ":%s/usr/lib/arm-linux-gnueabihf:%s/usr/arm-linux-gnueabihf/lib", usr_prefix, usr_prefix); + // Add ARM Sysroot Libraries (Ensure Priority) (Ignroe On Actual ARM System) +#ifndef __arm__ + string_append(&new_ld_path, ":%s/sysroot/lib/arm-linux-gnueabihf:%s/sysroot/usr/lib/arm-linux-gnueabihf", binary_directory, binary_directory); +#endif // Add LD_LIBRARY_PATH { diff --git a/launcher/src/patchelf.c b/launcher/src/patchelf.c index d930a0920..e56c55a1c 100644 --- a/launcher/src/patchelf.c +++ b/launcher/src/patchelf.c @@ -112,3 +112,24 @@ void patch_mcpi_elf_dependencies(const char *linker) { ERR("Unable To Set File Permissions: %s: %s", exe, strerror(errno)); } } + +// Get Interpreter +char *patch_get_interpreter(const char *file) { + // Run + const char *const command[] = { + "patchelf", + "--print-interpreter", + file, + NULL + }; + char *output = run_command(command, NULL); + if (output != NULL) { + // Trim + int length = strlen(output); + if (output[length - 1] == '\n') { + output[length - 1] = '\0'; + } + } + // Return + return output; +} diff --git a/launcher/src/patchelf.h b/launcher/src/patchelf.h index b065391ee..469768189 100644 --- a/launcher/src/patchelf.h +++ b/launcher/src/patchelf.h @@ -5,6 +5,7 @@ extern "C" { #endif void patch_mcpi_elf_dependencies(const char *linker); +char *patch_get_interpreter(const char *file); #ifdef __cplusplus } diff --git a/libreborn/src/util/exec.c b/libreborn/src/util/exec.c index adb24260e..42f928b90 100644 --- a/libreborn/src/util/exec.c +++ b/libreborn/src/util/exec.c @@ -102,7 +102,9 @@ char *run_command(const char *const command[], int *return_code) { // Get Return Code int status; waitpid(ret, &status, 0); - *return_code = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE; + if (return_code != NULL) { + *return_code = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE; + } // Return return output; diff --git a/scripts/generate-appimage-builder-yaml.js b/scripts/generate-appimage-builder-yaml.js index 756a3ba73..7683ecedc 100755 --- a/scripts/generate-appimage-builder-yaml.js +++ b/scripts/generate-appimage-builder-yaml.js @@ -37,14 +37,8 @@ if (mode === 'client') { 'libopenal1' ); } -if (arch !== 'armhf') { - packages.push( - 'libc6-armhf-cross', - 'libstdc++6-armhf-cross' - ); - if (arch !== 'arm64') { - packages.push('qemu-user'); - } +if (arch !== 'armhf' && arch !== 'arm64') { + packages.push('qemu-user'); } // Package Exclusions @@ -101,6 +95,9 @@ const files = { 'usr/share/doc/*/NEWS.*', 'usr/share/doc/*/TODO.*', 'usr/include', + 'usr/share/lintian', + 'usr/share/gcc', + 'usr/share/gdb', 'usr/share/locale', 'usr/share/help', 'usr/bin/update-mime-database' @@ -131,8 +128,12 @@ const runtime = { // to use a (usually non-existent) system linker. `usr/lib/${name}/minecraft-pi`, `usr/lib/${name}/**/*.so`, - 'usr/arm-linux-gnueabihf/lib' - ] : undefined + `usr/lib/${name}/sysroot` + ] : [ + // MCPI's license prohibits distributing a modified + // minecraft-pi binary. + `usr/lib/${name}/minecraft-pi` + ] }; // AppDir