Generally in my post-image scripts I perform some intensive tasks that are strictly for the benefit of the preparation and creation of disk images or ISOs. However, if all I want to do is to prepare an SDK, I don't need to do any of these tasks because the SDK should just be building the toolchain, host packages, and (in my case) generating the environment-setup script. It would be very useful to have an official/built-in way to bypass the post-image script (and possibly the other scripts) when doing `make prepare-sdk` (either implicitly or explicitly).
My current workaround involves a special environment variable that allows my scripts to bail out early. However, that unfortunately doesn't do anything for when buildroot creates a (compressed) rootfs, which takes substantially longer than my post-* scripts. If there is some way to prevent buildroot from unnecessarily creating the rootfs when preparing the SDK, I'd be set...
mscdex, All, Thanks for the report. > It would be very useful to have an official/built-in way to bypass the > post-image script That's indeed pretty surprising. Could you please try this patch (not sure if bugzilla keeps or removes TABs, so adapt if need be): diff --git a/Makefile b/Makefile index 3d0783242f..05b422d8d2 100644 --- a/Makefile +++ b/Makefile @@ -592,7 +592,7 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf world: target-post-image .PHONY: prepare-sdk -prepare-sdk: world +prepare-sdk: target-finalize staging-finalize host-finalize @$(call MESSAGE,"Rendering the SDK relocatable") PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath host PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath staging > (and possibly the other scripts) when doing `make prepare-sdk` (either > implicitly or explicitly). Post-fakeroot scripts are only caled when building an image, so the above patch should also cover that case. As for the post-build scripts, they are supposed to actually fixup the build, and they may have to explixitly tweak host/ and staging/ for the purpose of doing small last-minute cleanups and tweaks of various sorts, some which may be needed to get a working SDK (I know of such a case). So I'm afraid that is not going to be possible to cover both cases. In such a case, I'd suggest that what you are doing, setting an environment variable when you build the SDK and/or doing the full build, and checking that variable in your post-build scripts, is the correct thing to do. I would however argue that what your post-build scripts should not modify target/, staging/, and/or host/ in a way that is incomaptible with assembling an SDK. Regards, Yann E. MORIN.
Yann, Your suggested patch seems to do the trick. The post-image script is skipped and more importantly the generating and compressing of the rootfs is skipped!
mscdex, All, > Your suggested patch seems to do the trick. But in fact, it is not correct, because such an SDK would be missing the host tools needed to build the actual images. Indeed, those host tools are only built as dependencies of the image targets; so, if the image targets are not built, those tools will not be either. Now, one may argue that it would be perfectly valid that the SDK does not contain host tools to build images, but others may argue otherwise. And I tend to place myself in the second category. So, I withdraw this patch of mine. We'll need a better solution... Regards, Yann E. MORIN.
Thank you for your report. The issue tracker for the Buildroot project has been moved to the Gitlab.com issue tracker: https://gitlab.com/buildroot.org/buildroot/-/issues We are taking this opportunity to close old issues in this old tracker. If you believe your issue is still relevant, please open one in the new issue tracker. Thank you!