如何解释Config.in中的env =“HOSTARCH”

时间:2017-01-19 21:21:19

标签: linux buildroot

你能不能帮我解决以下问题:

1-如何解释buildroot的根Config.in中的以下行env="HOSTARCH':

config BR2_HOSTARCH
string
option env="HOSTARCH"

2- make menuconfig后图形视图中BR2_HOSTARCH的值为x86_64,如何分配?

3-为什么当我在.config中找到BR2_HOSTARCH时,我找不到它?

1 个答案:

答案 0 :(得分:2)

你看过git的历史吗?例如。 git blame Config.in然后提交添加上面的行?

它很清楚它的作用,如何以及为什么来自提交描述: https://git.buildroot.org/buildroot/commit/?id=1d4104f0d0428297a8b447a0e08c81a9eaee7f62

commit 1d4104f0d0428297a8b447a0e08c81a9eaee7f62
Author: Francois Perrad <fperrad@gmail.com>
Date:   Wed Jul 18 15:59:09 2012 +0200

    add host arch detection and Kconfig BR2_HOSTARCH

    This will allow to install binary package only if they are supported by the
    host. As example Atmel SAM-BA (x86 only).

    Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

diff --git a/Config.in b/Config.in
index 925c2474c..c182f7044 100644
--- a/Config.in
+++ b/Config.in
@@ -10,6 +10,10 @@ config BR2_VERSION
        string
        option env="BR2_VERSION_FULL"

+config BR2_HOSTARCH
+       string
+       option env="HOSTARCH"
+
 source "target/Config.in.arch"

 menu "Build options"
diff --git a/Makefile b/Makefile
index d55b136a8..639fdaa1f 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,16 @@ ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSI
 $(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
 endif

+export HOSTARCH := $(shell uname -m | \
+       sed -e s/i.86/x86/ \
+           -e s/sun4u/sparc64/ \
+           -e s/arm.*/arm/ \
+           -e s/sa110/arm/ \
+           -e s/ppc64/powerpc/ \
+           -e s/ppc/powerpc/ \
+           -e s/macppc/powerpc/\
+           -e s/sh.*/sh/)
+
 # This top-level Makefile can *not* be executed in parallel
 .NOTPARALLEL:

E.G。它是uname -m的输出,带有一些后期处理,通过环境转发到Kconfig。它不存储在.config中,因为它是一个&#34; blind&#34;选项,E.G。没有提示。

你问这个问题的具体原因是什么?