Linux arm 交叉编译(1)——常用的some tools

交叉编译语法

参考链接:
https://blog.youkuaiyun.com/liufuchun111/article/details/81509651

1、export

CROSS_COMPILE

export CROSS_COMPILE=../prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

PATH

export PATH=../prebuilts/gcc/linux-x86/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin:$PATH

SYSROOT

2、./configure

–build
用来指定执行代码编译的主机,一般由config.guess自动配置

例如:
--build=x86

–host
用来指定编译出来的二进制程序所执行的主机环境

例如:
--host=arm64

–prefix
用来指定程序编译完成后安装的路径

例如:
--prefix=$PWD/install

–sysroot
用于指定逻辑工作路径

3、make install安装路径

1.Makefile工程
make install DESTDIR=/path
 
2.QT工程
make install INSTALL_ROOT=/path
 
3.ninja工程
DESTDIR=/path ninja -C . install
 
注意:./path为绝对路径

some tools的编译

1、iperf打流工具

本示例适用平台:ok4418

编译方法

克隆源码
git clone https://github.com/esnet/iperf.git

交叉编译
mkdir install
./configure --host=arm-linux CC=arm-cortex_a9-linux-gnueabi-gcc CFLAGS=-static CXX=arm-cortex_a9-linux-gnueabi-g++ CXXFLAGS=-static --prefix=$PWD/install
make;make install

用法
TBC

2、phytool

本示例适用平台:rk3399
网络phy芯片调试工具。
编译方法

克隆源码
git clone https://github.com/wkz/phytool.git

加载环境变量
source envsetup.sh

编译
make

用法

$ ./phytool
Usage: phytool read  IFACE/ADDR/REG
       phytool write IFACE/ADDR/REG <0-0xffff>
       phytool print IFACE/ADDR[/REG]

Clause 22:

ADDR := <0-0x1f>
REG  := <0-0x1f>

Clause 45 (not supported by all MDIO drivers):

ADDR := PORT:DEV
PORT := <0-0x1f>
DEV  := <0-0x1f>
REG  := <0-0xffff>

Examples:
       phytool read  eth0/0:4/0x1000
       phytool write eth0/0xa/0 0x1140
       phytool print eth0/0x1c

The `read` and `write` commands are simple register level
accessors. The `print` command will pretty-print a register. When
using the `print` command, the register is optional. If left out, the
most common registers will be shown.

Bug report address: https://github.com/wkz/phytool/issues

查看3399平台eth0口phy芯片寄存器值

[root@rk3399:/]# ./phytool print eth0/0:1
ieee-phy: id:0x001cc915

   ieee-phy: reg:BMCR(0x00) val:0x1140
      flags:          -reset -loopback +aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          1000-full

   ieee-phy: reg:BMSR(0x01) val:0x7949
      capabilities:   -100-b4 +100-f +100-h +10-f +10-h -100-t2-f -100-t2-h
      flags:          +ext-status -aneg-complete -remote-fault +aneg-capable -link -jabber +ext-register

3、memtester

本示例适用平台:t507
内存压力测试工具。

编译方法
依托t507的sdk,使用bulidroot添加memtester到文件系统。
添加编译配置

make menuconfig

在这里插入图片描述
重现编译buidlroot,获取编译的可执行文件

用法

memtester size times

4、lz4

压缩工具,一般镜像编译完成后的压缩打包会用到。

编译方法

git clone https://github.com/ScottImpGreen/lz4.git
make install
sudo make install

用法

export PATH=/usr/local/bin:$PATH

5、qt5.15.13

https://download.qt.io/official_releases/qt/5.15/5.15.13/single/
https://blog.youkuaiyun.com/s806903/article/details/141671449
https://forums.gentoo.org/viewtopic-p-8763197.html?sid=ff50809372da984c37372be99939a6bf

历史版本qt
https://download.qt.io/archive/qt/
https://download.qt.io/new_archive/qt/
build-essential libgl1-mesa-dev gperf libclang-dev mesa-common-dev libglu1-mesa-dev llvm flex bison
make gcc g++ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu cmake 
./configure -prefix $PWD/install-arm -opensource -nomake tests

./configure -release -opensource -confirm-license -xplatform linux-aarch64-gnu-g++ -prefix /usr/local/arm64 -nomake tests -nomake examples -sysroot /home/forlinx/rootfs
QtWidgets
sed -i '6i #include <cstdint>' qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp
sed -i '7i #include <cstdint>' qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp
sed -i '4i #include <cstdint>' qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp

6、x11

TBC

./configure --target=aarch64-linux-gnu --host=aarch64-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var 
--program-prefix= --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no 
--disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared --disable-config-hal --enable-record --disable-xnest 
--disable-unit-tests --with-builder-addr=buildroot@buildroot.org 'CFLAGS=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  
-O2 -g0 -D_FORTIFY_SOURCE=1 -I/usr/include/pixman-1 -O2' --with-fontrootdir=/usr/share/fonts/X11/ --disable-xephyr --disable-xvfb --without-systemd-daemon 
--disable-systemd-logind --enable-xorg --enable-libdrm --disable-kdrive --disable-dri --disable-glx --enable-config-udev --enable-config-udev-kms 
--enable-config-dbus --disable-libunwind --disable-xvmc --disable-composite --enable-dri2 --enable-dri3 --enable-glamor --disable-screensaver --with-sha1=libcrypto

Linux端查看.a/.so库文件CPU与软件信息
https://www.cnblogs.com/suntroop/articles/17655062.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值