From 1699a1724226f055595a8d752d1e3867f04d276a Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sat, 4 Mar 2023 14:15:34 -0500 Subject: [PATCH] Revert "Drop x86 from dev." This reverts commit 860d44743d7a672bf2fb0dc49ed000cf0107f369. --- Makefile | 1 + config/arch.i686 | 24 +++++++++++++ config/functions | 3 ++ config/options | 2 +- config/show_config | 4 +-- packages/compat/lib32/package.mk | 35 ++++++++++++------- .../games/emulators/box86/profile.d/98-box86 | 2 +- packages/virtual/x86/package.mk | 26 ++++++++++++++ .../PC/devices/handheld/linux/linux.i686.conf | 1 + projects/PC/devices/handheld/options | 13 +++++++ scripts/build_compat | 2 +- scripts/build_distro | 28 ++++++++------- 12 files changed, 112 insertions(+), 29 deletions(-) create mode 100644 config/arch.i686 create mode 100644 packages/virtual/x86/package.mk create mode 120000 projects/PC/devices/handheld/linux/linux.i686.conf diff --git a/Makefile b/Makefile index e4b1af610..5018477c4 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ world: x86_64 x86_64: handheld RK3588 RK3566 handheld: + PROJECT=PC DEVICE=handheld ARCH=i686 ./scripts/build_distro PROJECT=PC DEVICE=handheld ARCH=x86_64 ./scripts/build_distro RK3588: diff --git a/config/arch.i686 b/config/arch.i686 new file mode 100644 index 000000000..fae2624f8 --- /dev/null +++ b/config/arch.i686 @@ -0,0 +1,24 @@ +# determines TARGET_CPU, if not forced by user + if [ -z "${TARGET_CPU}" ]; then + TARGET_CPU=i686 + fi + + # 64bit userland + if [ -z "${TARGET_FEATURES}" ]; then + TARGET_FEATURES="32bit" + else + TARGET_FEATURES+=" 32bit" + fi + +# determine architecture's family + TARGET_SUBARCH=i686 + + TARGET_GCC_ARCH="${TARGET_SUBARCH/-/}" + TARGET_KERNEL_ARCH=x86 + +# setup ARCH specific *FLAGS + TARGET_CFLAGS="-march=${TARGET_CPU}" + TARGET_LDFLAGS="-march=${TARGET_CPU}" + +# build with SIMD support ( yes / no ) + TARGET_FEATURES+=" mmx sse sse2" diff --git a/config/functions b/config/functions index bb7b5b337..01943d70a 100644 --- a/config/functions +++ b/config/functions @@ -494,6 +494,9 @@ setup_toolchain() { "x86_64") RUST_HOST="x86_64-unknown-linux-gnu" ;; + "i686") + RUST_HOST="i686-unknown-linux-gnu" + ;; esac export CARGO_TARGET_DIR="${PKG_BUILD}/.${RUST_HOST}/target" diff --git a/config/options b/config/options index 3262e26d9..b52813b06 100644 --- a/config/options +++ b/config/options @@ -56,7 +56,7 @@ KERNEL_NAME="${KERNEL_NAME:-KERNEL}" LINUX_DEPENDS="${PROJECT_DIR}/${PROJECT}/linux ${PROJECT_DIR}/${PROJECT}/patches/linux ${PROJECT_DIR}/${PROJECT}/packages/linux ${ROOT}/packages/linux" [ -n "${DEVICE}" ] && LINUX_DEPENDS+=" ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/linux" -[ "${TARGET_ARCH}" = "x86_64" ] && LINUX_DEPENDS+=" ${ROOT}/packages/linux-firmware/intel-ucode ${ROOT}/packages/linux-firmware/kernel-firmware" +[[ "${TARGET_ARCH}" =~ i*86|x86_64 ]] && LINUX_DEPENDS+=" ${ROOT}/packages/linux-firmware/intel-ucode ${ROOT}/packages/linux-firmware/kernel-firmware" # Need to point to your actual cc # If you have ccache installed, take care that LOCAL_CC does not point to it diff --git a/config/show_config b/config/show_config index 40f08dbc7..59f5339d4 100644 --- a/config/show_config +++ b/config/show_config @@ -4,7 +4,7 @@ show_config() { dashes="===========================" config_message="${config_message}\n ${dashes}${dashes}${dashes}" - config_message="${config_message}\n Configuration for ${DISTRO}NAME ($([ "$OFFICIAL" = "yes" ] && echo "official" || echo "community"))" + config_message="${config_message}\n Configuration for ${DISTRONAME}" config_message="${config_message}\n ${dashes}${dashes}${dashes}" # Build options @@ -131,7 +131,7 @@ show_config() { config_message="${config_message}\n" config_message="${config_message}\n ${dashes}${dashes}${dashes}" - config_message="${config_message}\n End Configuration for ${DISTRO}NAME" + config_message="${config_message}\n End Configuration for ${DISTRONAME}" config_message="${config_message}\n ${dashes}${dashes}${dashes}" config_message="${config_message}\n\n\n" diff --git a/packages/compat/lib32/package.mk b/packages/compat/lib32/package.mk index 168eee276..e44357b46 100644 --- a/packages/compat/lib32/package.mk +++ b/packages/compat/lib32/package.mk @@ -3,7 +3,7 @@ PKG_NAME="lib32" PKG_VERSION="$(date +%Y%m%d)" -PKG_ARCH="aarch64" +PKG_ARCH="aarch64 x86_64" PKG_LICENSE="GPLv2" PKG_DEPENDS_TARGET="toolchain retroarch SDL2 libsndfile libmodplug" PKG_SHORTDESC="ARM 32bit bundle for aarch64" @@ -11,25 +11,36 @@ PKG_PRIORITY="optional" PKG_TOOLCHAIN="manual" makeinstall_target() { + + case ${TARGET_ARCH} in + aarch64) + LIBARCH="arm" + LDSO="ld-linux-armhf.so.3" + ;; + x86_64) + LIBARCH="x86" + LDSO="ld-linux.so.2" + ;; + esac + cd ${PKG_BUILD} - LIBROOT="${ROOT}/build.${DISTRO}-${DEVICE}.arm/image/system/" - if [ "${ARCH}" = "aarch64" ]; then - mkdir -p ${INSTALL}/usr/lib32 - rsync -al ${LIBROOT}/usr/lib/* ${INSTALL}/usr/lib32 >/dev/null 2>&1 - chmod -f +x ${INSTALL}/usr/lib32/* || : - fi + LIBROOT="${ROOT}/build.${DISTRO}-${DEVICE}.${LIBARCH}/image/system/" + mkdir -p ${INSTALL}/usr/lib32 + rsync -al ${LIBROOT}/usr/lib/* ${INSTALL}/usr/lib32 >/dev/null 2>&1 + chmod -f 0755 ${INSTALL}/usr/lib32/* || : mkdir -p ${INSTALL}/usr/lib - ln -s /usr/lib32/ld-linux-armhf.so.3 ${INSTALL}/usr/lib/ld-linux-armhf.so.3 + ln -s /usr/lib32/${LDSO} ${INSTALL}/usr/lib/${LDSO} mkdir -p "${INSTALL}/etc/ld.so.conf.d" - echo "/usr/lib32" > "${INSTALL}/etc/ld.so.conf.d/arm-lib32.conf" - echo "/usr/lib32/pulseaudio" >"${INSTALL}/etc/ld.so.conf.d/arm-lib32-pulseaudio.conf" + echo "/usr/lib32" > "${INSTALL}/etc/ld.so.conf.d/${LIBARCH}-lib32.conf" + echo "/usr/lib32/pulseaudio" >"${INSTALL}/etc/ld.so.conf.d/${LIBARCH}-lib32-pulseaudio.conf" + if [ -d "${LIBROOT}/usr/lib/dri" ] then - echo "/usr/lib32/dri" >"${INSTALL}/etc/ld.so.conf.d/arm-lib32-dri.conf" + echo "/usr/lib32/dri" >"${INSTALL}/etc/ld.so.conf.d/${LIBARCH}-lib32-dri.conf" fi if [ -d "${LIBROOT}/usr/lib/gl4es" ] then - echo "/usr/lib/gl4es" >"${INSTALL}/etc/ld.so.conf.d/arm-lib32-gl4es.conf" + echo "/usr/lib/gl4es" >"${INSTALL}/etc/ld.so.conf.d/${LIBARCH}-lib32-gl4es.conf" fi } diff --git a/packages/games/emulators/box86/profile.d/98-box86 b/packages/games/emulators/box86/profile.d/98-box86 index 8a97fbb29..032388402 100644 --- a/packages/games/emulators/box86/profile.d/98-box86 +++ b/packages/games/emulators/box86/profile.d/98-box86 @@ -4,4 +4,4 @@ export BOX86_PREFER_EMULATED=1 export BOX86_LD_LIBRARY_PATH="/usr/share/box86/lib" export BOX86_BASH="/usr/bin/bash-x86" -alias box86='LD_LIBRARY_PATH=/usr/lib32:${LD_LIBRARY_PATH} box86' +alias box86='LD_LIBRARY_PATH=/usr/lib32:/usr/lib32/gles /usr/bin/box86' diff --git a/packages/virtual/x86/package.mk b/packages/virtual/x86/package.mk new file mode 100644 index 000000000..898f579df --- /dev/null +++ b/packages/virtual/x86/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (C) 2022 - Fewtarius + +PKG_NAME="x86" +PKG_LICENSE="Apache-2.0" +PKG_SITE="www.jelos.org" +PKG_DEPENDS_TARGET="toolchain squashfs-tools:host dosfstools:host fakeroot:host kmod:host mtools:host populatefs:host libc gcc linux linux-drivers linux-firmware libusb unzip socat p7zip file SDL2 SDL2_gfx SDL2_image SDL2_mixer SDL_sound SDL2_net SDL2_ttf retroarch flycast" +PKG_SECTION="virtual" +PKG_LONGDESC="Root package used to build and create 32-bit userland" + +if [ ! "${OPENGL}" = "no" ]; then + PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd glew" +fi + +if [ "${OPENGLES_SUPPORT}" = yes ]; then + PKG_DEPENDS_TARGET+=" ${OPENGLES}" +fi + +if [ "${VULKAN_SUPPORT}" = "yes" ] +then + PKG_DEPENDS_TARGET+=" vulkan-loader vulkan-headers" +fi + +if [ "${DISPLAYSERVER}" = "wl" ]; then + PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER}" +fi diff --git a/projects/PC/devices/handheld/linux/linux.i686.conf b/projects/PC/devices/handheld/linux/linux.i686.conf new file mode 120000 index 000000000..cfe5f551c --- /dev/null +++ b/projects/PC/devices/handheld/linux/linux.i686.conf @@ -0,0 +1 @@ +linux.x86_64.conf \ No newline at end of file diff --git a/projects/PC/devices/handheld/options b/projects/PC/devices/handheld/options index bc8f9af90..f381dfb04 100644 --- a/projects/PC/devices/handheld/options +++ b/projects/PC/devices/handheld/options @@ -1,3 +1,16 @@ + case ${TARGET_ARCH} in + x86_64) + # (AMD CPUs) k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 + # athlon-fx amdfam10 barcelona + # (Intel CPUs) atom core2 nocona + # + TARGET_CPU="x86-64" + ;; + i686) + TARGET_CPU="i686" + ;; + esac + # kernel command line EXTRA_CMDLINE="quiet console=tty0 ssh consoleblank=0 systemd.show_status=0 loglevel=0 panic=20 intel_pstate=disable" diff --git a/scripts/build_compat b/scripts/build_compat index e30e75522..d80219d3f 100755 --- a/scripts/build_compat +++ b/scripts/build_compat @@ -116,7 +116,7 @@ for directory in etc dev proc run sys tmp usr var flash storage; do mkdir -p ${INSTALL}/${directory} done -MTADDONBUILD=no start_multithread_build arm32 || die "Parallel build failure - see log for details. Time of failure: $(date)" +MTADDONBUILD=no start_multithread_build ${1} || die "Parallel build failure - see log for details. Time of failure: $(date)" echo "Successful build! Building compatibility root..." >&2 exit 0 diff --git a/scripts/build_distro b/scripts/build_distro index af0d6bdae..0936d0b7c 100755 --- a/scripts/build_distro +++ b/scripts/build_distro @@ -86,18 +86,22 @@ rm -f ./release/${DISTRO}-${DEVICE}.${ARCH}-* # Remove the image root as it should be regenerated for every build. rm -rf ./build.${DISTRO}-${DEVICE}.${ARCH}/image -if [ "${ARCH}" == "arm" ] -then - if [ "${BASE_ONLY}" == true ] - then - echo "Skipping 32bit." - exit 0 - fi - scripts/build_compat - scripts/install arm32 -else - make image -fi +case ${ARCH} in + arm) + [ "${BASE_ONLY}" == "true" ] && exit 0 +echo ARM + scripts/build_compat arm32 + scripts/install arm32 + ;; + i686) + [ "${BASE_ONLY}" == "true" ] && exit 0 +echo i686 + scripts/build_compat x86 + scripts/install x86 + ;; + *) + make image +esac if [ ! $? == 0 ] then