Config.in 中的 env="HOSTARCH" 是如何解释的

How env="HOSTARCH" from the Config.in is interpreted

你能帮我理解以下几点吗:

1- 如何解释来自 buildroot 的根 Config.in 的以下行 env="HOSTARCH

config BR2_HOSTARCH
string
option env="HOSTARCH"

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

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

你看过git历史吗?例如。 git 责备 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:

它是 uname -m 的输出,带有一些 post 处理,通过环境转发到 Kconfig。它不存储在 .config 中,因为它是一个 "blind" 选项,例如没有提示。

你问这个有什么具体原因吗?