How to clean only target in buildroot

xakepp35 picture xakepp35 · Nov 16, 2017 · Viewed 14k times · Source

I've messed up some files in target fs. So i would like to reassemble it. But not rebuild all.

make clean just erases all output, + build directory. What command should use to delete only target directory and all related .stamp_some_step files recursively through output/build/ structure, forcing buildroot to reassemble filesystem according to current config, but not rebuilding all libraries and binaries again and again?

Answer

Jeff Zheng picture Jeff Zheng · Apr 16, 2018

Buildroot tracks build progress with .stamp_xxx in each package build dir. target install is actually the last stage for each package. So removing the .stamp_target_installed file from each package build dir would cause it to reinstall to target

In the lastest buildroot, you can simply do the following:

rm -rf output/target
find output/ -name ".stamp_target_installed" |xargs rm -rf 

In some older buildroot, there are a few other files in output that tracks the creation of the target dir with the skeleton. Citing the mailing list message, we could summarize following:

Does a "rm -rf output/target && make" work?

As Thomas said, it does not work. But, some unofficial hacks exist:

  • remove build/.root will force to reinstall skeleton
  • remove build/*/.stamp_target_installed force reinstall each target package
  • depending of you toolchain, you can reinstall libc and co by removing:
    • stamps/ext-toolchain-installed (external)
    • stamps/ct-ng-toolchain-installed (ctng)
    • target/lib/libc.so.0 (buildroot)

And then simply do make again.

Remind, there are ton of reasons these tips could do wrong things. The only current official way to rebuild target is "make clean".