android下的dropbear编译
安卓默认的sshd应为路径权限的问题,无法正常工作,所以我们选用dropbear。
- 项目地址:https://github.com/ubiquiti/dropbear-android.git
- 配置ndk和交叉编译工具链:
diff --git a/build-dropbear-android.sh b/build-dropbear-android.sh
index 15042af..5be67ce 100755
--- a/build-dropbear-android.sh
+++ b/build-dropbear-android.sh
@@ -28,8 +28,9 @@ cd dropbear-$VERSION
echo "Generating required files..."
HOST=arm-linux-androideabi
-COMPILER=${TOOLCHAIN}/bin/arm-linux-androideabi-gcc
-STRIP=${TOOLCHAIN}/bin/arm-linux-androideabi-strip
+TOOLCHAIN=/xxx/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64
+COMPILER=${TOOLCHAIN}/bin/armv7a-linux-androideabi26-clang
+STRIP=${TOOLCHAIN}/bin/llvm-strip
SYSROOT=${TOOLCHAIN}/sysroot
export CC="$COMPILER --sysroot=$SYSROOT"
参考:
https://fh0.github.io/%E7%BC%96%E8%AF%91/2021/02/18/android-dropbear.html