概述
1、编译环境,Ubuntu18.04,gcc version 7.5.0 (Linaro GCC 7.5-2019.12)。
2、ninja版本,1.8.2。
ninja --version
3、安装python3-pip。
sudo apt-get install python3-pip
4、安装meson。
sudo pip3 install meson
5、进入libdrm-2.4.109目录。
gedit build.sh
build.sh脚本:
#!/bin/bash
set -e
if [ -d _build ];then
rm -r _build
fi
mkdir _build
if [ -d _bin ];then
rm -r _bin
fi
mkdir _bin
arch='aarch64-linux-gnu-'
prefix_path=`pwd`/_bin
#创建交叉编译配置文件cross_file.txt
#还可设置c_args等等类似 CFLAGS
echo "[constants]" > cross_file.txt
echo "arch = '${arch}'" >> cross_file.txt
echo "[binaries]" >> cross_file.txt
echo "c = arch + 'gcc'" >> cross_file.txt
echo "cpp = arch + 'g++'" >> cross_file.txt
echo "ar = arch + 'ar'" >> cross_file.txt
echo "ld = arch + 'ld'" >> cross_file.txt
echo "srtip = arch + 'strip'" >> cross_file.txt
#e#cho "sys_root = '${sys_root}'" >> cross_file.txt
#echo "pkg_config_libdir = '${sys_root}/usr/lib/pkgconfig'" >> cross_file.txt
#编译结果可运行平台的架构
echo "[host_machine]" >> cross_file.txt
echo "system = 'linux'" >> cross_file.txt
echo "cpu_family = 'arm'" >> cross_file.txt
echo "cpu = 'armv7hl'" >> cross_file.txt
echo "endian = 'little'" >> cross_file.txt
#类似于configure功能 meson configure 获取到可配置项
echo "[project options]" >> cross_file.txt
#编译libkms,选项可以参考meson.build及meson_option.txt
echo "libkms = 'true'" >> cross_file.txt
#安装测试程序(kmstest/modetest等)到_bin/bin/目录下
echo "install-test-programs = 'true'" >> cross_file.txt
#类似于执行configure
meson setup _build --prefix=${prefix_path} --cross-file cross_file.txt
cd _build
#编译 类似于make
ninja
#类似于make install, *.h *.a *.so install to prefix dir
ninja install
cd ../
6、libdrm-2.4.109/_bin/bin目录下生成modetest命令。
7、查看当前屏幕信息。
modetest -c
最后
以上就是无奈夏天为你收集整理的交叉编译libdrm-2.4.109,生成modetest命令的全部内容,希望文章能够帮你解决交叉编译libdrm-2.4.109,生成modetest命令所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复