Skip to content

Commit

Permalink
Fixed and added x86_64 build;
Browse files Browse the repository at this point in the history
Fixed problem with loop mount;
Updated bb-build script
  • Loading branch information
meefik committed Nov 9, 2019
1 parent 68e8b70 commit 0fb1e71
Show file tree
Hide file tree
Showing 251 changed files with 123 additions and 197 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
applicationId 'ru.meefik.busybox'
minSdkVersion 14
targetSdkVersion 29
versionCode 43
versionCode 44
versionName '1.31.1'
}
buildTypes {
Expand Down
Binary file added app/src/main/assets/arm/bin/busybox
Binary file not shown.
Binary file added app/src/main/assets/arm/bin/ssl_helper
Binary file not shown.
Binary file removed app/src/main/assets/arm/static/bin/busybox
Binary file not shown.
Binary file removed app/src/main/assets/arm/static/bin/ssl_helper
Binary file not shown.
Binary file added app/src/main/assets/arm64/bin/busybox
Binary file not shown.
Binary file added app/src/main/assets/arm64/bin/ssl_helper
Binary file not shown.
Binary file removed app/src/main/assets/arm64/static/bin/busybox
Binary file not shown.
Binary file added app/src/main/assets/x86/bin/busybox
Binary file not shown.
Binary file added app/src/main/assets/x86/bin/ssl_helper
Binary file not shown.
Binary file removed app/src/main/assets/x86/static/bin/busybox
Binary file not shown.
Binary file removed app/src/main/assets/x86/static/bin/ssl_helper
Binary file not shown.
Binary file added app/src/main/assets/x86_64/bin/busybox
Binary file not shown.
Binary file added app/src/main/assets/x86_64/bin/ssl_helper
Binary file not shown.
29 changes: 8 additions & 21 deletions app/src/main/java/ru/meefik/busybox/EnvUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,44 +206,31 @@ static boolean update(Context c) {
String mArch = PrefStore.getArch();
switch (mArch) {
case "arm":
if (!extractDir(c, "arm/static", "")) {
if (!extractDir(c, "arm", "")) {
return false;
}
break;
case "arm64":
if (!extractDir(c, "arm/static", "")) {
if (!extractDir(c, "arm", "")) {
return false;
}
if (!extractDir(c, "arm64/static", "")) {
if (!extractDir(c, "arm64", "")) {
return false;
}
break;
case "x86":
if (!extractDir(c, "x86/static", "")) {
if (!extractDir(c, "x86", "")) {
return false;
}
break;
case "x86_64":
if (!extractDir(c, "x86/static", "")) {
if (!extractDir(c, "x86", "")) {
return false;
}
if (!extractDir(c, "x86_64", "")) {
return false;
}
// if (!extractDir(c, "x86_64/static", "")) {
// return false;
// }
break;
// case "mips":
// if (!extractDir(c, "mips/static", "")) {
// return false;
// }
// break;
// case "mips64":
// if (!extractDir(c, "mips/static", "")) {
// return false;
// }
// if (!extractDir(c, "mips64/static", "")) {
// return false;
// }
// break;
}

// set executable app directory
Expand Down
154 changes: 0 additions & 154 deletions contrib/bb-build.sh

This file was deleted.

96 changes: 96 additions & 0 deletions contrib/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash
# BusyBox build tool
# (C) 2014-2019 Anton Skshidlevsky <[email protected]>, GPLv3
#
# Make custom patch:
# diff -urN ../busybox-${BB_VERSION}.orig/ . > ../patches/${BB_VERSION}/${PATCH_NAME}.patch

set -e

MARCH="$1"
INSTALL_DIR="$2"
BB_VERSION="1.31.1"
ANDROID_NATIVE_API_LEVEL="21"
NCPU="$(grep -ci processor /proc/cpuinfo)"
SOURCE_DIR="$(pwd)"
BUILD_DIR="${SOURCE_DIR}/build"
WOLFSSL_VERSION="3.13.0-stable"
DEFCONFIG="android_ndk_defconfig"
NDK="android-ndk-r15c"
NDK_DIR="${BUILD_DIR}/${NDK}"
SYSROOT="${NDK_DIR}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${MARCH}"
[[ -n "${INSTALL_DIR}" ]] || INSTALL_DIR="${BUILD_DIR}/dist"

case "$MARCH" in
arm)
TARGET_HOST="arm-linux-androideabi"
PATH="${NDK_DIR}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${PATH}"
;;
arm64)
TARGET_HOST="aarch64-linux-android"
PATH="${NDK_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin:${PATH}"
;;
x86)
TARGET_HOST="i686-linux-android"
PATH="${NDK_DIR}/toolchains/x86-4.9/prebuilt/linux-x86_64/bin:${PATH}"
;;
x86_64)
TARGET_HOST="x86_64-linux-android"
PATH="${NDK_DIR}/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin:${PATH}"
;;
*)
echo "Usage: $0 <arm|arm64|x86|x86_64> [INSTALL_DIR]"
exit 1
;;
esac

export LD_LIBRARY_PATH="${SYSROOT}/usr/lib:${SYSROOT}/usr/lib64"
export CFLAGS="-DANDROID -D__ANDROID__ -DSK_RELEASE -D__POSIX_VISIBLE=199209 -D__BSD_VISIBLE -fPIC -I${SYSROOT}/usr/include/${TARGET_HOST} -I${SYSROOT}/usr/include"
export LDFLAGS="-L${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib64 -static --sysroot=${SYSROOT}"

[[ -e "${BUILD_DIR}" ]] || mkdir -p "${BUILD_DIR}";
[[ -e "${INSTALL_DIR}/${MARCH}" ]] || mkdir -p "${INSTALL_DIR}/${MARCH}";

wget -c https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip -O "${BUILD_DIR}/${NDK}-linux-x86_64.zip"
wget -c http://busybox.net/downloads/busybox-${BB_VERSION}.tar.bz2 -O "${BUILD_DIR}/busybox-${BB_VERSION}.tar.bz2"
wget -c https://github.com/wolfSSL/wolfssl/archive/v${WOLFSSL_VERSION}.tar.gz -O "$BUILD_DIR/wolfssl-${WOLFSSL_VERSION}.tar.gz"

if [[ ! -e "${BUILD_DIR}/${NDK}" ]]
then
unzip "${BUILD_DIR}/${NDK}-linux-x86_64.zip" -d "${BUILD_DIR}"
fi

[[ ! -e "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}" ]] || rm -rf "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}"
tar xvzf "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}.tar.gz" -C "${BUILD_DIR}"

[[ ! -e "${BUILD_DIR}/busybox-${BB_VERSION}" ]] || rm -rf "${BUILD_DIR}/busybox-${BB_VERSION}"
tar jvxf "${BUILD_DIR}/busybox-${BB_VERSION}.tar.bz2" -C "${BUILD_DIR}"
cd "$BUILD_DIR/busybox-${BB_VERSION}"
for p in $(ls ${SOURCE_DIR}/patches/${BB_VERSION}/*.patch)
do
patch -b -p0 < ${p}
done

cd "$BUILD_DIR/busybox-${BB_VERSION}"
cp ${SOURCE_DIR}/patches/${BB_VERSION}/${DEFCONFIG} ./configs/${DEFCONFIG}
sed -i "s|^CONFIG_CROSS_COMPILER_PREFIX=.*|CONFIG_CROSS_COMPILER_PREFIX=\"${TARGET_HOST}-\"|" ./configs/${DEFCONFIG}
sed -i "s|^CONFIG_SYSROOT=.*|CONFIG_SYSROOT=\"${SYSROOT}\"|" ./configs/${DEFCONFIG}
sed -i "s|^CONFIG_EXTRA_CFLAGS=.*|CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\"|" ./configs/${DEFCONFIG}
sed -i "s|^CONFIG_EXTRA_LDFLAGS=.*|CONFIG_EXTRA_LDFLAGS=\"${LDFLAGS}\"|" ./configs/${DEFCONFIG}
sed -i "s|^EXTRAVERSION =.*|EXTRAVERSION = -meefik|" ./Makefile
make ${DEFCONFIG}

cd "$BUILD_DIR/busybox-${BB_VERSION}"
make -j${NCPU}
make CONFIG_PREFIX="${INSTALL_DIR}/${MARCH}" install

cd "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}"
./autogen.sh
./configure --enable-static --enable-singlethreaded --disable-shared --host=${TARGET_HOST}
make -j${NCPU}

CC="${TARGET_HOST}-gcc"
STRIP="${TARGET_HOST}-strip"
$CC $CFLAGS $LDFLAGS -Os -Wall -I"${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}" -c "${SOURCE_DIR}/ssl_helper.c" -o "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}/ssl_helper.o"
$CC $CFLAGS $LDFLAGS "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}/ssl_helper.o" "${BUILD_DIR}/wolfssl-${WOLFSSL_VERSION}/src/.libs/libwolfssl.a" -lm -o "${INSTALL_DIR}/${MARCH}/bin/ssl_helper"
$STRIP -s "${INSTALL_DIR}/${MARCH}/bin/ssl_helper"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
# CONFIG_USE_PORTABLE_CODE is not set
CONFIG_STACK_OPTIMIZATION_386=y
# CONFIG_STACK_OPTIMIZATION_386 is not set

#
# Installation Options ("make install" behavior)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions contrib/patches/1.31.1/loop.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- ../busybox-1.31.1.orig/include/libbb.h 2019-06-10 13:50:53.000000000 +0300
+++ ./include/libbb.h 2019-11-08 12:33:36.523396529 +0300
@@ -2175,10 +2175,10 @@
# define VC_4 "/dev/tty4"
# define VC_5 "/dev/tty5"
# define VC_FORMAT "/dev/tty%d"
-# define LOOP_FORMAT "/dev/loop%u"
-# define LOOP_NAMESIZE (sizeof("/dev/loop") + sizeof(int)*3 + 1)
-# define LOOP_NAME "/dev/loop"
-# define FB_0 "/dev/fb0"
+# define LOOP_FORMAT "/dev/block/loop%u"
+# define LOOP_NAMESIZE (sizeof("/dev/block/loop") + sizeof(int)*3 + 1)
+# define LOOP_NAME "/dev/block/loop"
+# define FB_0 "/dev/graphics/fb0"
#endif

// storage helpers for mk*fs utilities
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 0 additions & 20 deletions contrib/ssl_helper/README.md

This file was deleted.

0 comments on commit 0fb1e71

Please sign in to comment.