How to clean only target in buildroot

Viewed 20263

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?

2 Answers

Buildroot has special make targets to clean out the build directory for specific packages, but this does not touch any of the installed files. To quote the user manual:

When a package is removed from the configuration, Buildroot does not do anything special. It does not remove the files installed by this package from the target root filesystem or from the toolchain sysroot. A full rebuild is needed to get rid of this package. However, generally you don’t necessarily need this package to be removed right now: you can wait for the next lunch break to restart the build from scratch.

That said, you can delete the build files for a specific package by running make <PKG-NAME>-dirclean. For example, if I wanted to delete the build files for i2c-tools, I would run make i2c-tools-dirclean. The <PKG-NAME>-dirclean target simply runs an rm -rf on the output/build/<PKG-NAME> directory. This will not remove the installed files from output/target/. 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.

Related