After some struggling, I have successfully compiled LEDE from source and customized packages and config files. So far, so good.
Now, I would like to use the LEDE image Builder. I have built it also from source and I have successfully built some images wit it.
However, the image size is roughly 1 MB less than configuring and building from source. So, it seems that it is not using the customized .config (even if it is present in the directory).
So, the question is what packages are included by default? I suppose the rest must be added to the PACKAGES var.
Somehow related, the .../bin/targets/ar71xx/generic/config.seed file contains the changes from default config. The PACKAGES could be extracted from here, but what about libraries and others... How to add them to PACKAGES? For instance:
Image builder does not compile packages themselves, so they are included with the same config options as in buildbot. You can't change the compiled packages as they are just downloaded from the repo.
Libraries are normal packages.
Imagebuilder includes just the same packages that get selected by selecting the device in make menuconfig.
Thank @Strangi and @hnyman for clarifying the missing pieces.
So, to summarise:
List all available router models to a file, to be able to search for specific models easily.
make info > AllTargets.txt
Search in .targetinfo the desired "Source Makefile" (should be the Target System that would be selected on menuconfig if compiling from source). This would give the default packages that are included in (section "Default-Packages"). Scroll down to find the specific device profile and there will be specified some additional packages (which will be the same as declared in point 3).
Search target in .targetinfo or .profiles.mk. This will give the default extra packages included in the target.
All packages/libraries will be included with the specific options selected when generating the Image Builder.
For instance, for TP-Link 1043ND v4 and searching in file:
Any other desired package should be added to PACKAGES. Let's suppose we want to include 'luci' and the 'nano' editor, add a 'custom' part to our image name and use some config files under 'myConfigFiles' directory, the build command would be something like: