how to rebuild rootfs in buildroot

匿名 (未验证) 提交于 2019-12-03 02:20:02

问题:

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.

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

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.

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

Possibly are there more efficient alternatives than buildroot?

Thanks in advance.

回答1:

The make command build all targets

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

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

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

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

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.

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.

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.

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

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

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

More concise information on using Buildroot for AT91SAM9x5 is this Linx4SAM page

Possibly are there more efficient alternatives than buildroot?

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


ADDENDUM

how to rebuild rootfs in buildroot

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 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!