arm - 所有的 ARM 都是平等的吗?
问题描述
我有一个来自旧硬件的工具链(来自 Moxa 的 W315),当我file
在它的库文件上运行时,我得到了这个:
[bf@localhost arm-linux-gnueabi]$ file /usr/local/arm-linux/lib/libssl.so.0.9.8
/usr/local/arm-linux/lib/libssl.so.0.9.8: ELF 32-bit LSB shared object, ARM, version 1 (ARM), dynamically linked, not stripped
如您所见,这个 OpenSSL 库已经很老了,不支持(至少)我需要的 TLSv1.2。因此,我试图找到该库的较新版本的 ARM 二进制文件。我从 Debian 找到了 1.0.0,但签名略有不同:
[bf@localhost arm-linux-gnueabi]$ file libssl.so.1.0.0
libssl.so.1.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=83c83f5d3da36759c7adc837405b28539569d26e, stripped
它们都是 32 位和 ELF,但我不确定“ARM”部分是否具有可比性。
我可以在我的应用程序中使用那个 1.0.0 库吗?如果没有,我应该在寻找正确的二进制文件时寻找什么?
结果来自cat /proc/cpuinfo
:
root@Moxa:/home/fabs# cat /proc/cpuinfo
Processor : ARM922Tid(wb) rev 1 (v4l)
BogoMIPS : 76.59
Features : swp half thumb
CPU implementer : 0x66
CPU architecture: 4
CPU variant : 0x0
CPU part : 0x526
CPU revision : 1
Cache type : VIVT write-back
Cache clean : cp15 c7 ops
Cache lockdown : format B
Cache format : Harvard
I size : 16384
I assoc : 2
I line length : 16
I sets : 512
D size : 16384
D assoc : 2
D line length : 16
D sets : 512
Hardware : Moxa CPU development platform
Revision : 0000
Serial : 0000000000000000
解决方案
不,他们不是。但是您可以使用以下过程为您的平台构建一个最新/受支持/安全的 openssl 版本:
# openssl
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar zxf openssl-1.1.1k.tar.gz
# a toolchain I know is working for arm922t according to gcc documentation
wget "https://releases.linaro.org/components/toolchain/binaries/latest-6/arm-linux-gnueabi/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz" -O gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz
mkdir -p /opt/arm/6
tar Jxf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi.tar.xz -C /opt/arm/6
# building
cd openssl-1.1.1k
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k
编辑Makefile
, 并替换
CFLAGS=-Wall -O3
经过:
CFLAGS=-Wall -O3 -march=armv4t -mcpu=arm922t
然后:
make install
ls -gG /opt/openssl-1.1.1k/bin/
total 576
-rwxr-xr-x 1 6214 Jun 30 12:53 c_rehash
-rwxr-xr-x 1 579740 Jun 30 12:53 openssl
ls -gG /opt/openssl-1.1.1k/lib
total 6432
drwxr-xr-x 2 4096 Jun 30 12:53 engines-1.1
-rw-r--r-- 1 3312034 Jun 30 12:53 libcrypto.a
lrwxrwxrwx 1 16 Jun 30 12:53 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x 1 2152072 Jun 30 12:53 libcrypto.so.1.1
-rw-r--r-- 1 603100 Jun 30 12:53 libssl.a
lrwxrwxrwx 1 13 Jun 30 12:53 libssl.so -> libssl.so.1.1
-rwxr-xr-x 1 502704 Jun 30 12:53 libssl.so.1
file /opt/openssl-1.1.1k/bin/openssl
/opt/openssl-1.1.1k/bin/openssl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=7b0e69c478f4c7390d416247f95ac60d9a632bd8, with debug_info, not stripped
-static
如果需要,您可以通过在配置命令末尾添加选项来构建静态版本:
./Configure linux-generic32 --cross-compile-prefix=/opt/arm/6/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- --prefix=/opt/openssl-1.1.1k --openssldir=/opt/openssl-1.1.1k -static
推荐阅读
- spring-boot - 在 GridGain Spring boot Client 节点中打印连续日志
- php - 联系表格 7 数据发送到 API
- php - 如何在不触发错误 PHP 的情况下将可选参数和数据类型传递给方法
- karate - 如何在 afterScenario 中访问 karate ui 自动化驱动程序详细信息,如 sessionid?
- sql - 具有多个条件的 Bigquery LTRIM 函数
- powerbi - 检查值是否在另一个表中并在 Power BI 中添加列
- vue.js - 基于 nuxt.config.js 上的 .env 文件加载不同的 css
- spring-jdbc - 从 Postgres 中获取 4-5 百万条记录并用 JAVA 处理它们
- ios - 是否无法在 UITableViewCell 上的删除操作(滑动按钮)中使用自定义视图?
- reactjs - 使用 API 调用和 Redux 模拟函数组件