用户工具

站点工具


entware:armv7

Entware ARMv7

笔记: 创建 Entware 环境

系统环境准备

ubuntu 需要安装以下软件包

gcc g++ make autoconf automake flex gperf bison texinfo libtool libtool-bin libncurses5-dev zlib1g-dev unzip libssl-dev gettext python2.7 subversion

centos 需要安装以下软件包

git patch bzip2 gcc gcc-c++ libtool ncurses-devel zlib-static openssl-devel make autoconf automake flex gperf bison texinfo libtool unzip gettext subversion

搭建 entware

$ git clone https://github.com/Entware/Entware.git
$ cd Entware
$ make package/symlinks

## 如果你的设备kernel是2.6.x
$ cp ./configs/armv7-2.6.config .config
## 如果你的设备kernel是3.2.x
$ cp ./configs/armv7-3.2.config .config

$ make tools/install
$ make toolchain/install
$ make target/compile

编译自带软件包

编译名叫name的软件

$ make package/name/compile

手动编译软件

设置环境变量

export STAGING_DIR=/opt/arm/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi
export PATH=$PATH:/opt/arm/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/bin

手动编译设置

手动编译软件时configure需要加入以下参数

./configure \
--target=arm-openwrt-linux \
--host=arm-openwrt-linux \
--build=x86_64-pc-linux-gnu \
--prefix=/opt \
--without-openssl \
CC=arm-openwrt-linux-gnueabi-gcc \
CPP='arm-openwrt-linux-gnueabi-gcc -E' \
CFLAGS='-O2 -pipe -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -fPIC' \
CPPFLAGS='-I/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/include -I/opt/entware/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/include' \
LDFLAGS='-L/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link=/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/entware/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/lib'

例子

编译tinc 1.11pre12

先编译依赖库, entware自带

make package/ncurses/compile
make package/lzo/compile
make package/readline/compile
make package/zlib/compile
make package/openssl/compile

接着编译tinc

./configure \
--target=arm-openwrt-linux \
--host=arm-openwrt-linux \
--build=x86_64-pc-linux-gnu \
--prefix=/opt \
--without-openssl \
CC=arm-openwrt-linux-gnueabi-gcc \
CPP='arm-openwrt-linux-gnueabi-gcc -E' \
CFLAGS='-O2 -pipe -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -fPIC' \
CPPFLAGS='-I/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/include -I/opt/entware/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/include' \
LDFLAGS='-L/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link=/opt/entware/Entware/staging_dir/target-arm_cortex-a9_glibc-2.23_eabi/opt/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/entware/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/lib'
make

编译 openssl-1.1.1k tinc-1.1pre18

由于 entware 自带的 openssl 没法正常编译 tinc-1.1pre18, 所以需要自己编译

./Configure \
linux-armv4 shared \
--prefix=/opt/openssl \
--cross-compile-prefix="arm-openwrt-linux-gnueabi-" -fPIC \
-I/opt/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/include \
-Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 \
-Wl,-rpath=/opt/openssl/lib \
-Wl,-rpath=/opt/lib \
-L/opt/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/lib \
-Wl,--gc-sections
# make CFLAGS='-O2 -pipe -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -DPIC -fpic'
# make install

以上将把 openssl 安装到 /opt/openssl

接着编译 tinc-1.1pre18

./configure \
--target=arm-openwrt-linux \
--host=arm-openwrt-linux \
--build=x86_64-pc-linux-gnu \
--prefix=/opt/tinc \
--with-openssl=/opt/openssl \
CC=arm-openwrt-linux-gnueabi-gcc \
CPP='arm-openwrt-linux-gnueabi-gcc -E' \
CFLAGS='-O2 -pipe -mtune=cortex-a9 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -DPIC -fpic' \
CPPFLAGS='-I/opt/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/include' \
LDFLAGS='-Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -Wl,-rpath=/opt/openssl/lib -Wl,-rpath=/opt/lib -L/opt/Entware/staging_dir/toolchain-arm_cortex-a9_gcc-8.4.0_glibc-2.23_eabi/lib'
entware/armv7.txt · 最后更改: 2021/08/04 06:36 由 Hshh