如何在buildroot中重建rootfs [英] how to rebuild rootfs in buildroot

查看:41
本文介绍了如何在buildroot中重建rootfs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将设置构建环境,为 AT91SAM9X25 开发板制作我自己的 linux 嵌入式系统.我正在使用 buildroot 来做到这一点.make 命令构建所有目标,首先构建工具链,然后打包,然后是 rootfs 和 rootfs 的图像(tar、cpio ...).要重建 rootfs,我通常使用 make clean 然后 make.make clean 命令删除所有工具链,包括工具链.

I am going to setup build environment to make my own linux embedded system for AT91SAM9X25 Board. I am using buildroot to do this. The make command build all targets, the first it build toolchain then packages and then rootfs and images of rootfs (tar, cpio ...). To rebuild rootfs I usually use make clean and then make. The make clean command removes all and including toolchain.

所以我的第一个问题是:有没有办法在不构建工具链的情况下重新制作 rootfs?这需要很多时间.

So the first my question is: Is there some way to remake rootfs without building toolchain? It takes a lot of time.

我也在 buildroot 中构建 linux 内核.我在 buildroot 中打开了 BR2_LINUX_KERNEL [=y].linux 配置为使用初始 RAM 文件系统,因此要构建内核,它需要 rootfs 映像(应由 buildroot 创建).当我在 buildroot 的根目录下运行 make 时,构建失败并显示错误无法打开buildroot-2013.05/output/images/rootfs.cpio".因为(如果我理解正确的话)构建顺序是工具链 - 包 - rootfs - linux 内核 - rootfs 的图像.当它尝试构建 linux 内核时,不会创建 rootfs.cpio 映像.

Also I am building linux kernel within buildroot. I have turned on BR2_LINUX_KERNEL [=y] in buildroot. The linux configured to use Initial RAM filesystem, so to build kernel it required image of rootfs (which should be created by buildroot). When I run make under root of buildroot the building fails with error Cannot open 'buildroot-2013.05/output/images/rootfs.cpio'. Because (if I understand correctly) the building sequence is toolchain - pakages - rootfs - linux kernel - images of rootfs. When it tries to build linux kernel the rootfs.cpio image is not created.

所以第二个问题是:如果我想使用初始 RAM 文件系统,如何在 buildroot 中构建 linux?

So the second question is: How to build linux within buildroot if I want to use Initial RAM filesystem?

可能有比 buildroot 更有效的替代方法吗?

Possibly are there more efficient alternatives than buildroot?

提前致谢.

推荐答案

make 命令构建所有目标

The make command build all targets

您不想这样做(直到配置了 Buildroot).
您首先需要通过指定目标板来配置 Buildroot.
根据 手册,您可以从头开始,或创建 Buildroot 配置文件用于从类似板派生的 AT91SAM9X25 板,例如 configs/at91sam9g20dfc_defconfig

You do not want to do that (until Buildroot is configured).
You first need to configure Buildroot by specifying the target board.
Per the manual you can start from scratch, or create a Buildroot config file for your AT91SAM9X25 board derived from a similar board such as configs/at91sam9g20dfc_defconfig

除了 Buildroot 配置文件之外,您还需要一个 Linux 内核配置文件(除非您想尝试从头开始配置内核).
带有 AT91SAM9x5 的 Atmel 评估板的内核配置文件是 at91samconfig9x5ek_def

Besides the Buildroot config file, you will also need a Linux kernel config file (unless you want to try configuring the kernel from scratch).
The kernel config file for Atmel's eval board with a AT91SAM9x5 is at91sam9x5ek_defconfig

您还应该阅读第 3.4.2 节.创建自己的董事会支持

You should also read section 3.4.2. Creating your own board support

所以我的第一个问题是:有没有办法在不构建工具链的情况下重新制作 rootfs?这需要很多时间.

So the first my question is: Is there some way to remake rootfs without building toolchain? It takes a lot of time.

答案取决于您如何定义remake rootfs".如果删除目录output/images/,则rootfs的文件被重写.
如果您删除 output/build/ 中的目录,那么这些包或子系统将从源代码重新编译.

The answer depends on how you define "remake rootfs". If you delete the directory output/images/, then the files of the rootfs are rewritten.
If you delete directories in output/build/, then those packages or subsystems are recompiled from source.

如果您将 Buildroot 配置为使用您自己的或外部工具链,则 make clean 不会删除它们.如果您将 Buildroot 配置为在其目录之外安装它构建的工具链,那么它可能会在 make clean 期间不理会它.

If you configure Buildroot to use your own or an external tool chain, then make clean would not remove them. If you configure Buildroot to install the toolchain it builds outside of its directory, then it may leave it alone during a make clean.

当然,Buildroot make 足够聪明,可以知道自上次构建以来发生了什么变化以及必须重新编译什么.
需要删除 output/build/ 中的目录以强制重新编译的情况应该很少见.

Of course the Buildroot make is smart enough to know what has changed since the last build and what has to be recompiled.
It should be the rare case that you need to delete directories in output/build/ to force recompilation.

所以第二个问题是:如果我想使用初始 RAM 文件系统,如何在 buildroot 中构建 linux?

So the second question is: How to build linux within buildroot if I want to use Initial RAM filesystem?

您需要正确配置 Buildroot 和 Linux 内核.

You need to properly configure both Buildroot and the Linux kernel.

make menuconfig
    Filesystem images --->
make linux-menuconfig
    General setup --->
make

关于为 AT91SAM9x5 使用 Buildroot 的更简洁信息是 这个 Linx4SAM 页面

可能有比 buildroot 更有效的替代方案吗?

Possibly are there more efficient alternatives than buildroot?

还有其他工具,例如 Open Embedded,但将它们描述为more效率"是主观的.

There are other tools such as Open Embedded, but describing them as "more efficient" is subjective.

附录

如何在buildroot中重建rootfs

how to rebuild rootfs in buildroot

要强制重建 rootfs(在本例中为 initramfs),请删除 output/build/linux-x.xx.xx 目录中的三个隐藏文件

To force the rootfs to be rebuilt (in this case an initramfs) delete three hidden files in the output/build/linux-x.xx.xx directory

    .stamp_images_installed
    .stamp_initramfs_rebuilt
    .stamp_target_installed

这篇关于如何在buildroot中重建rootfs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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