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?
-
Check my example: github.com/howhow/makefileHow Chen– How Chen2017年11月16日 11:05:59 +00:00Commented Nov 16, 2017 at 11:05
-
you could delete relavent files, just build updated lib and do the link again, no need rebuild allHow Chen– How Chen2017年11月17日 00:07:31 +00:00Commented Nov 17, 2017 at 0:07
-
How Chen, how do I determine whai is relevant, and why build root could not do this? I mean, could it clean just binaries in target and reinstall from build to target, according to its default script? not deleting build folder but target?xakepp35– xakepp352017年11月18日 12:20:54 +00:00Commented Nov 18, 2017 at 12:20
-
I think make clean just a fake target named as clean, you need check under clean target, how the makefile implemented it. You want to integrate filesystem image, then you need first have a Filesystem image. Then maybe you need check your makefile how it assemble Filesystem image into whole image, then you just redo that stepHow Chen– How Chen2017年11月18日 14:16:57 +00:00Commented Nov 18, 2017 at 14:16
-
How Chen, in makefile there is just rm -rf all data in /output/ eg not only target but build and so on. so, to clean only target directory and related stamps, do i have to reimplement new 'cleantarget' target for makefile by my own? :(xakepp35– xakepp352017年11月19日 14:38:32 +00:00Commented Nov 19, 2017 at 14:38
2 Answers 2
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 latest buildroot, you can simply do the following:
rm -rf output/target
find output/ -name ".stamp_target_installed" -delete
rm -f output/build/host-gcc-final-*/.stamp_host_installed
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/.rootwill force to reinstall skeleton- remove
build/*/.stamp_target_installedforce 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".
7 Comments
make cleantarget command with what you just provided?.stamp_target_installed files and rebuilding was suffient.output/build/.root does not exist any more.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.
7 Comments
<pkg>-uninstall command is not supported: lists.busybox.net/pipermail/buildroot/2013-February/067097.html Buildroot is targeted towards simplicity over features. If you need a more sophisticated build system, I might suggest Yocto. A great discussion on the differences can be found here: youtu.be/13LZ0szWSVg