开始着手 linux shell/ makefile 编程,菜鸟(我自己)对这些底层技术不是很了解,one by one 吧!共勉!
根据原文
http://hi.baidu.com/jrkaho/blog/item/253c6ced4f08c13bacafd5c6.html,稍作修改。
1. build、 host 和 target 初步
在交叉编译中比较常见的一些参数就是build、host 和 target了,正确的理解这三者的含义对于交叉编译是非常重要的,下面就此进行解释
--build=编译该软件所使用的平台
--host=该软件将运行的平台
--target=该软件所处理的目标平台
2. 以 gcc 为例子来讲解这三者的作用
在gcc编译中我们使用
./configure --build=编译平台 --host=运行平台 --target=目标平台 [各种编译参数]
来配置gcc的源代码,以让其编译出我们需要的gcc编译器。
那么在这组配置参数中:
--build:
表示目前我们正在运行的平台名称是什么,如果当前我们是在intel的pentium机器中编译该系统,那么我们的--build就可能是 i686-pc-linux-gnu!
当然如果我们在其它种类的机器上编译那么这个build就应该是那个机器所对应的平台名称。
该参数在不指定的情况下将自动常识猜测目前平台的名称。
--host:
表示我们把这个编译好的gcc在什么样的平台下运行,在交叉编译过程中这个需要我们来指定,
因为机器自己是不能知道我们心里是怎么想的, 那么我们可以明确的告诉它,我们要做出来的程序是运行在“龙芯”上的,但是目前还不能直接指定“龙芯”。
因此我们这里指定为 mips64el- unknown-linux-gnu(如果你省点事情那么就用这个名字好了,如果你想用个有个性的名字,那么请你想明白它的含义再动手,
并且做好后面的过 程需要多出一些手续的麻烦的心理准备)。
--host也可以不指定,那么host将自动使用build来定义自己,不过那将不再是交叉编译。
注:--build 和 --host 在不同的时候就被配置文件认定为交叉编译方式。
--target:
该参数的目的是让配置程序知道这个软件被编译后使用来处理什么平台上的文件的。
target这个参数只有在为数不多的几个包中有用处,虽然在 ./configure --help中经常能看到该参数,但实际上绝大多数软件包都是不需要该参数的。
从这个参数的含义来看,说明其处理的目标只有在不同平台下表现为不同的时候才有作用,而这些文件通常都跟目标平台 的指令系统直接或间接有关:
比如可执行文件,对于不同平台下使用的可执行文件的编码可以是完全不同的,因此必须使用 对应能处理该编码的程序才能正确处理,
而如果错误的使用则可能导致程序错误或者破坏文件,对于这样要处理不同平台下会 出现不同编码的软件,我们就应当对它指定目标平台,以免另其错误处理;
而对于文本文件,对于不同的平台同样的内容表达的 含义都是相同的,因此我们不需要专门针对平台来处理,这样的软件我们就可以不必对它指定需要处理的平台了。
3. 总结一下
build:自动测试在用平台名称,若无法检测出来则需要指定。
host:若无指定,自动使用 build 的结果。
build 和 host 相同时表示本地编译,若不相同则表示交叉编译。
target:表示需要处理的目标平台名称,若无指定使用 host 相同名称,gcc、binutils 等于平台指令相关软件有此参数,多 数软件此参数无用处。
下面举几个例子,虽然是英文,但是很好理解。
分享到:
相关推荐
全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar...
KCONFIG_AUTOCONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/...
设置完相应的环境变量和选择vendor后,即可直接用mm或mmm external/iperf204即可在out/target/product/XXX/system/xbin/生成iperf,然后即可在android里运行了,比通过交叉编译工具要简单一点。。 附mmm生成iperf的...
介绍如何在linux下编译生成libjpeg库,然后调用libjpeg库将BMP图片转成JPG图片。 tar jvxf libtool-2.2.4.tar.bz2 cd libtool-2.2.4/ ./configure CC=arm-linux-gnu-gcc --build=i686-linux --host=arm-linux --...
TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= ...
bpi_a64_android初步编译为LCD显示20170309_1442.7z banana pi a64 android6.0.1初步编译为LCD显示。初步设置。 bpi_a64_android的编译配置文件排版.txt 2017/3/9 14:33 0、压缩包的处理: rootroot@cm-System...
make: *** 没有规则可以创建“out/target/product/astar-evb30/system/etc/bluetooth/rtkbt.conf”需要的目标“device/softwinner/astar-evb30/bluetooth/rtkbt.conf”。 停止。 make: *** 正在等待未完成的任务.......
1、01原始编译全志r16平台tinav2.5系统: rootroot@cm88:~$ cd /home/wwt rootroot@cm88:/home/wwt$ rootroot@cm88:/home/wwt$ md5sum tinav2.5_orig_r16repack_20171214_1114.tar.gz aa13de7313f393ca25375d9802a...
Target: arm-openwrt-linux-muslgnueabi Configured with: /home/caiyongheng/tina_test/out/azalea-perf3/compile_dir/toolchain/gcc-5.2.0/configure --with-bugurl=...
TARGET_BUILD_VARIANT=tina TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_...
rootroot@cm-System-Product-Name:/home/wwt/dp18_ap6330/lichee/linux-3.10$ make ARCH=arm64 menuconfig rootroot@cm-System-Product-Name:/home/wwt/dp18_ap6330/lichee/linux-3.10$ WIFI部分可以关闭realtek:...
$ sudo apt-get install build-essential linux-source $ cp /usr/src/linux-source-3.2.0.tar.bz2 . $ bunzip2 linux-source-3.2.0.tar.bz2 $ tar xf linux-source-3.2.0.tar $ cd ~/linux-source-3.2.0 2....
rootroot@rootroot-E400:~/wyb/ap6212a0_a33_sc3817r/lichee/linux-3.4$ make ARCH=arm menuconfig [*] Networking support ---> <*> Bluetooth subsystem support ---> Bluetooth device drivers ---> < > ...
rootroot@rootroot-E400:~/wyb/ap6212a0_a33_sc3817r/lichee/linux-3.4$ make ARCH=arm menuconfig [*] Networking support ---> <*> Bluetooth subsystem support ---> Bluetooth device drivers ---> < > ...
#include <linux/types.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/ioctl.h> #include <errno.h> #include <assert.h> #include <string.h> #...
1、驱动的编译配置: R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\gc2145.c R:\wyb\gc2145_tinav2.1\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile (可选...
rootroot@cm-System-Product-Name:/home/wwt/uvc_r16_project/lichee/linux-3.4$ make ARCH=arm menuconfig Device Drivers ---> <*> Multimedia support ---> [*] Video capture adapters ---> 修改: [ ...
rootroot@cm-System-Product-Name:/home/wwt/uvc_r16_project/lichee/linux-3.4$ make ARCH=arm menuconfig Device Drivers ---> <*> Multimedia support ---> [*] Video capture adapters ---> 修改...
编译 cd ~/Downloads git clone https://github.com/airspy/host.git airspy cd airspy/libairspy mkdir build cd build cmake ../ make sudo make install 用法 把它放在你的Cargo.toml : [ dependencies . ...
TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 HOST_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with...