当我们构建一个内核和繁忙的盒子时,我们只需要为繁忙的盒子而不是内核提供工具链吗? [英] When we build a kernel and busy box, we need toolchain only for busybox not for kernel?

查看:107
本文介绍了当我们构建一个内核和繁忙的盒子时,我们只需要为繁忙的盒子而不是内核提供工具链吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我纠正了,在为嵌入式设备制作小型linux系统时,我们需要基于具有默认工具链的配置集的内核构建。而rootfs需要工具链?由于该体系结构是在内核中设置的,因此不需要工具链。而忙碌的盒子会生成二进制文件。因此,它需要一个工具链。请纠正我,因为我对此有疑问。

Am I correct that while making a small linux system for an embedded device, we need kernel build based on the configuration set with the default toolchain. Whereas rootfs requires a toolchain ? Since the architecture is set in kernel there is no need of toolchains. Whereas the busy box makes a binary. Thus, it needs a toolchain. Please correct me as i have a doubt here.

推荐答案

工具链在嵌入式系统开发中起着非常重要的作用。
在编译和构建时,您还需要特定于体系结构的跨工具链。工具链不是默认的。您必须在配置期间设置它,或者在传递make命令时指定工具链前缀。

Toolchain plays very important role in embedded system development. In compiling and building also you required cross tool chain that is specific to your Architecture.Tools chain will not be default.You have to set it during configuration or while passing make command you have specify your tool chain prefix.

make CROSS_COMPILE = arm-none-linux-gnueabi-

在编译和构建Busybox时应使用相同的工具链。如果您使用
静态地编译busybox,则无需担心共享库。但是,如果您动态地编译忙碌的盒子,那么您的工具链将在rootfs中扮演重要角色。在这里,您需要将工具链库复制到rootfs / lib 文件夹中。

The same tool chain should be used in compiling and building your Busybox. If you compile busybox with statically.Then no need to worry about shared library. But if you compiled busy box with dynamically then your toolchain plays important role in rootfs. here you need to copy libraries of toolchain to rootfs /lib folder .

需要复制的库是什么

字符串_install / bin / busybox |可以知道。 grep ^ lib
显示列表库,该列表库应保存在rootfs的 / lib 中。

此命令说:从文件中获取所有字符串,仅显示以lib开头的行。
程序ldd不能使用,因为该程序已经交叉编译,因此无法在
开发主机上运行。
这些文件应该从工具链的sysroot目录中获取。大多数现代工具链
都配置了sysroot,该目录包含工具链
中的文件,该文件可能出现在工具链所针对的系统的根文件系统中。要检查您的工具链是否支持
sysroot,请尝试以下操作:

This command says, "Get all the strings from the file, and only show the lines that begin with lib." The program ldd can’t be used, because the program has been cross-compiled and won’t run on the development host. These files should be fetched from the sysroot directory of the toolchain. Most modern toolchains have been configured with a sysroot, which is a directory that contains the files from the toolchain likely to appear on a root file system of a system targeted by the toolchain. To check if your toolchain has sysroot support, try the following:

$ arm-linux-gcc -print-sysroot

/ arm-unknown-linux-gnueabi / bin / arm-linux-gcc
如果这是有效路径,则在这里文件应从中复制。如果未显示任何路径,请使用find
在中找到sysroot目录,或使用find查找libc.so:

/arm-unknown-linux-gnueabi/bin/arm-linux-gcc If this is a valid path, this is where the files should be copied from. If no path is displayed, use find to locate a sysroot directory in , or use find to look for libc.so:

$查找。 -name libc.so
找到libc和libm后,创建(您的rootfs)/ lib 目录并复制它们那里。
文件可能是指向其他文件的符号链接,因此请确保将它们全部收集起来。下一个要获取的文件是动态加载程序,通常称为ld-linux-的
,它也与libc.so. *一起位于lib目录中。
将其复制到 / lib 目录。您的系统现在具有所有共享库和加载程序,因此
BusyBox可以运行。

$ find . -name libc.so After you’ve located libc and libm, create the (your rootfs)/lib directory and copy them there. The files are likely symlinks to other files, so be sure to gather them all. The next file to get is the dynamic loader, normally called ld-linux-, which also resides in the lib directory along with libc.so.*. Copy that to the /lib directory. Your system now has all the shared libraries and the loader, so BusyBox can run.

最后,如果您要编译任何应用程序或程序,则应该可以使用您编译busybox的工具链进行编译。

So finally if you want to compile any apps or program you should have to compile with this tool chain which you compiled busybox.

这篇关于当我们构建一个内核和繁忙的盒子时,我们只需要为繁忙的盒子而不是内核提供工具链吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆