Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to rebuild rootfs in buildroot

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.

like image 370
Yuri Avatar asked Jul 26 '13 15:07

Yuri


People also ask

How do I rebuild Buildroot?

The easiest way to rebuild a single package from scratch is to remove its build directory in output/build . Buildroot will then re-extract, re-configure, re-compile and re-install this package from scratch. You can ask buildroot to do this with the make <package>-dirclean command.

How do you clean Buildroot?

If you want to remove the files from your rootfs without a full rebuild, that's fine - you can just go into output/target/ , rm the files you no longer want, then run make to regenerate your final images. Make sure your Buildroot config is also not set to rebuild and install the package you are trying to remove.

How can I speed up my Buildroot?

Make sure that you're using only local files: do not attempt to do a build over NFS, which significantly slows down the build. Having the Buildroot download folder available locally also helps a bit. Buy new hardware. SSDs and lots of RAM are key to speeding up the builds.


1 Answers

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
like image 176
sawdust Avatar answered Sep 28 '22 02:09

sawdust