ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux – 使用configure识别Raspberry Pi主机

2019-07-03 13:40:11  阅读:295  来源: 互联网

标签:linux autotools configure raspberry-pi host


我从事跨平台项目,最近又添加了对Raspberry Pi的支持.该项目确保在尽可能广泛的受众中提供,具有预制,cmake和autotools构建系统.我为RPi设置了交叉编译,一切都很好.

最近,我还设置了一个Raspberry Pi VM(直到我得到一个真正的RPi)试图构建库.从Linux,我运行’./configure –host = arm-raspberry-linux-gnueabihf’,并从那里配置它.但是在RPi上(Rasbian 7),config.guess找到的默认主机是’armv61-unknown-linux-gnueabihf’.出于这个原因,即使是本地的Pi,我也必须运行’./configure –host = arm-raspberry-linux-gnueabihf’.所以,我的问题归结为:

目前,我目前在配置脚本中有类似的东西:

case "$host" in
    armv61-unknown-linux-gnueabihf)
        if [[ -f /usr/bin/rpi-update ]]; then
            on_raspberry=yes
        fi
    ;;
    ## other hosts here
esac

所以,我的问题归结为:

>’armv61-unknown-linux-gnueabihf’仅在Raspberry Pi上报道过吗?如果没有,如何配置以确保它确实在RPi上?检查rpi-update是否足够?不同的发行版(Arch Linux,Pidora,…)也有rpi-update吗?
>有不同版本的Pi报告的其他可能的主机三元组吗?

提前致谢

解决方法:

Is ‘armv61-unknown-linux-gnueabihf’ only reported on the Raspberry Pi?

其他平台也可以使用它.

If not, how can configure make sure that it is really on RPi?

它不能真正(例如在RPi VM上运行它). configure只是一个shell脚本.

Is checking for rpi-update sufficient?

往上看.

Do different distros (Arch Linux, Pidora, …) also have rpi-update?

当前的Pidora和Arch映像没有/usr/bin/rpi-update.至少早在2012年8月10日,旧的Rasbpian图像也都没有.

Are there any other possible host triplets like this that are reported by different versions of the Pi?

There are 3 triplets for the RPi cross compilers,所以如果有其他人也不会感到惊讶.

编辑:所以基本上所需要的是一种配置来检测它何时在Raspberry Pi上构建的方法.非常简单:

configure.ac

# need to detect build...
AC_CANONICAL_BUILD

...

AC_MSG_CHECKING([if build is on Raspberry Pi])
# The test for 'BCM2708' might be sufficient,
# but the presence of Serial is definitely part of
# the Pi firmware for codec licensing.
# See this thread
# <http://www.raspberrypi.org/phpBB3/viewtopic.phpf=29&t=28304&p=252357#p251536>.
AS_CASE("$build",
     [arm*-*-linux*],
     [on_rpi=`awk -v r=0 '/^Hardware@<:@ \t@:>@+:@<:@ \t@:>@+BCM2708/ { ++r;} /^Serial@<:@ \t@:>@+:/ { ++r; } END { print ((r > 1) ? "yes" : "no");}' /proc/cpuinfo`],
     [on_rpi="no"])
AC_MSG_RESULT($on_rpi)

检测Raspbian,Pidora,应该在Arch上工作. Arch似乎没有在其当前安装映像中包含编译器,因此在我尝试时配置失败.运行./configure时,所有检测到的构建都是armv6l-unknown-linux-gnueabihf.我没有尝试过任何类型的RPi模拟器或VM.

标签:linux,autotools,configure,raspberry-pi,host
来源: https://codeday.me/bug/20190703/1366924.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有