交叉编译libdrm-2.4.109,生成modetest命令

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
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_40723768

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值