BusyBox has the feature to embed custom shell scripts into the main binary during the build process. Details are described at the following link: https://git.busybox.net/busybox/tree/docs/embedded-scripts.txt If the BusyBox config FEATURE_SH_EMBEDDED_SCRIPTS is set to yes (which is the default setting), all scripts from the 'embed' directory of the BusyBox build folder are compressed and embedded in the BusyBox binary. It would be great to be able to use this feature with buildroot, but (please correct me if I'm wrong) unfortunately there is no configuration option in buildroot to add custom scripts to the 'embed' directory of the BusyBox build folder.
Max, All, > It would be great to be able to use [embedded scripts] What is the advantage over having the scripts installed in /bin or /usr/bin instead? If you are concerned about space that much that you want to take advantage of busybox' compression of the scripts, you would anyway consider a compressed filesystem like squashfs anyway, so the space gain would probably be ridiculous. > there is no configuration option in buildroot [for that] Indeed no, but it should not be overly complex to add. Yet, I'd like to see a good explanations why that would be better than to have the scripts in the filesystem instead. Regards, Yann E. MORIN. PS. Yes, support for embedded scripts is enabled in a default build, but that's an accident: our busybox .config was created before embedded scripts were a thing, so they are not explicitly disabled in our .config, and since the default for them in busybox is 'y', we end up with a buysbox that has support for embedded script (but no such script).
Beside the benefit of additional free space on the target filesystem (due to the compression of the scripts), another advantage is that it is not necessary to take care about script file permissions (there is no need to set execute-permissions when the scripts are embedded into the BusyBox binary).
Max, All, > Beside the benefit of additional free space on the target filesystem (due > to the compression of the scripts), As I said: if you are really concerned about the size of the scripts that you need them to be compressed, you will probably better benefit from a compressed filesystem to begin with, like squashfs, which would compress everything, from busybox itself, to the libraries it uses like libc et al. to all the files on the systems, and not just the few scripts that are embedded in the busybox binary. Honestly, I doubt embedding the scripts in the busybox binary wins over having a squashfs, but I'd like to see numbers. > another advantage is that it is not necessary to take care about script > file permissions (there is no need to set execute-permissions when the > scripts are embedded into the BusyBox binary). If you can't track the executable bit on your scripts, you have a big problem in your tooling and/or process and/or build environment. Again, I am not opposed to having support for embedded scripts, but I'd like to see a *convincing* argument... BTW, this is not a bug, but an enhancement request. We usually take new features as patches sent to the mailing list, so I'm closing this bug. Regards, Yann E. MORIN.