package/iputils: add configs to select which binaries are built
PATCH v3 1/1 package/iputils: add configs to select which binaries are built
By default, the iputils build script might build binaries which are useless for certain applications, like tftpd or ninfod. Those binaries will add to the target filesystem size unless a post-build script removes them manually, which is cumbersome and doesn't shorten build times.
In particular, in a certain aarch64 Buildroot project with musl selected as a C library, this patch allowed to shrink the full iputils package from 219 KiB (if every option is selected) to 63 KiB (with only the ping binary selected) - a 71.2% relative size decrease.
Moreover, upstream recently introduced a commit that disabled tftpd from building by default, like rarpd. In the current state of things, this change will introduce inconveniences for Buildroot users which prefer to use the tftpd implementation provided by this package. With this patch, however, that decision and similar future ones won't be a concern, because they will have complete control of what binaries are built.
These changes add Kconfig options which let the user select what binaries are built with ease.
---
Changes v2 -> v3:
- Several style revisions (suggested by Arnout)
- Simplify ninfod crypto dependencies logic (suggested by Arnout)
- Better explain the rationale for this patch in the commit message
Changes v2 -> v1:
- Fix several typos
package/iputils/Config.in | 68 ++++++++++++++++++++++ package/iputils/iputils.mk | 116 +++++++++++++++++++++++++------------ 2 files changed, 147 insertions(+), 37 deletions(-)
package/iputils/Config.in +68 -0
@@ -7,3 +7,71 @@ config BR2_PACKAGE_IPUTILS etc. https://github.com/iputils/iputils + +if BR2_PACKAGE_IPUTILS + +config BR2_PACKAGE_IPUTILS_ARPING + bool "arping" + default y + help + Installs arping. + +config BR2_PACKAGE_IPUTILS_CLOCKDIFF + bool "clockdiff" + default y + help + Installs clockdiff. + +config BR2_PACKAGE_IPUTILS_PING + bool "ping" + default y + help + Installs ping. + +config BR2_PACKAGE_IPUTILS_RARPD + bool "rarpd" + help + Installs rarpd. + +config BR2_PACKAGE_IPUTILS_RDISC + bool "rdisc" + default y + help + Installs rdisc. + +config BR2_PACKAGE_IPUTILS_RDISC_SERVER + bool "rdisc (server code)" + depends on BR2_PACKAGE_IPUTILS_RDISC + default y + help + Builds rdisc with server code. + +config BR2_PACKAGE_IPUTILS_TFTPD + bool "tftpd" + help + Installs tftpd. + +config BR2_PACKAGE_IPUTILS_TRACEPATH + bool "tracepath" + default y + help + Installs tracepath. + +config BR2_PACKAGE_IPUTILS_TRACEROUTE6 + bool "traceroute6" + default y + help + Installs traceroute6. + +config BR2_PACKAGE_IPUTILS_NINFOD + bool "ninfod" + depends on BR2_TOOLCHAIN_HAS_THREADS # ninfod requires <pthread.h> + depends on BR2_PACKAGE_NETTLE || BR2_PACKAGE_LIBGCRYPT || BR2_PACKAGE_OPENSSL || BR2_PACKAGE_LINUX_HEADERS + default y + help + Installs ninfod. + +comment "ninfod needs nettle, libgcrypt, openssl or Linux headers and a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS || (!BR2_PACKAGE_NETTLE && !BR2_PACKAGE_LIBGCRYPT && !BR2_PACKAGE_OPENSSL && !BR2_PACKAGE_LINUX_HEADERS) + +endif
package/iputils/iputils.mk +79 -37
144 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH RESEND v3 1/1 package/iputils: add configs to select which binaries are built
By default, the iputils build script might build binaries which are useless for certain applications, like tftpd or ninfod. Those binaries will add to the target filesystem size unless a post-build script removes them manually, which is cumbersome and doesn't shorten build times.
In particular, in a certain aarch64 Buildroot project with musl selected as a C library, this patch allowed to shrink the full iputils package from 219 KiB (if every option is selected) to 63 KiB (with only the ping binary selected) - a 71.2% relative size decrease.
Moreover, upstream recently introduced a commit that disabled tftpd from building by default, like rarpd. In the current state of things, this change will introduce inconveniences for Buildroot users which prefer to use the tftpd implementation provided by this package. With this patch, however, that decision and similar future ones won't be a concern, because they will have complete control of what binaries are built.
These changes add Kconfig options which let the user select what binaries are built with ease.
---
Changes v2 -> v3:
- Several style revisions (suggested by Arnout)
- Simplify ninfod crypto dependencies logic (suggested by Arnout)
- Better explain the rationale for this patch in the commit message
Changes v2 -> v1:
- Fix several typos
package/iputils/Config.in | 68 ++++++++++++++++++++++ package/iputils/iputils.mk | 116 +++++++++++++++++++++++++------------ 2 files changed, 147 insertions(+), 37 deletions(-)
package/iputils/Config.in +68 -0
@@ -7,3 +7,71 @@ config BR2_PACKAGE_IPUTILS etc. https://github.com/iputils/iputils + +if BR2_PACKAGE_IPUTILS + +config BR2_PACKAGE_IPUTILS_ARPING + bool "arping" + default y + help + Installs arping. + +config BR2_PACKAGE_IPUTILS_CLOCKDIFF + bool "clockdiff" + default y + help + Installs clockdiff. + +config BR2_PACKAGE_IPUTILS_PING + bool "ping" + default y + help + Installs ping. + +config BR2_PACKAGE_IPUTILS_RARPD + bool "rarpd" + help + Installs rarpd. + +config BR2_PACKAGE_IPUTILS_RDISC + bool "rdisc" + default y + help + Installs rdisc. + +config BR2_PACKAGE_IPUTILS_RDISC_SERVER + bool "rdisc (server code)" + depends on BR2_PACKAGE_IPUTILS_RDISC + default y + help + Builds rdisc with server code. + +config BR2_PACKAGE_IPUTILS_TFTPD + bool "tftpd" + help + Installs tftpd. + +config BR2_PACKAGE_IPUTILS_TRACEPATH + bool "tracepath" + default y + help + Installs tracepath. + +config BR2_PACKAGE_IPUTILS_TRACEROUTE6 + bool "traceroute6" + default y + help + Installs traceroute6. + +config BR2_PACKAGE_IPUTILS_NINFOD + bool "ninfod" + depends on BR2_TOOLCHAIN_HAS_THREADS # ninfod requires <pthread.h> + depends on BR2_PACKAGE_NETTLE || BR2_PACKAGE_LIBGCRYPT || BR2_PACKAGE_OPENSSL || BR2_PACKAGE_LINUX_HEADERS + default y + help + Installs ninfod. + +comment "ninfod needs nettle, libgcrypt, openssl or Linux headers and a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS || (!BR2_PACKAGE_NETTLE && !BR2_PACKAGE_LIBGCRYPT && !BR2_PACKAGE_OPENSSL && !BR2_PACKAGE_LINUX_HEADERS) + +endif
package/iputils/iputils.mk +79 -37
144 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH RESEND v3 1/1 package/iputils: add configs to select which binaries are built
Hello Alejandro,
package/iputils/Config.in config BR2_PACKAGE_IPUTILS · line 69
Quoted 4 lines · On Sun, 15 Sep 2019 12:05:46 +0200 Alejandro Gonz?lez…
package/iputils/Config.in +4
-0+config BR2_PACKAGE_IPUTILS_NINFOD + bool "ninfod" + depends on BR2_TOOLCHAIN_HAS_THREADS # ninfod requires <pthread.h> + depends on BR2_PACKAGE_NETTLE || BR2_PACKAGE_LIBGCRYPT || BR2_PACKAGE_OPENSSL || BR2_PACKAGE_LINUX_HEADERS
Do we really want to handle this with depends on ? This is indeed what is the closest to what the current package does, but when we have sub-options, we generally use "select" to enable the appropriate dependencies. In this case, it's not easy to know if there is a preferred crypto provider though, so perhaps what you did is the best.
However, reviewing your commit, I realized we already have this dependency on BR2_PACKAGE_LINUX_HEADERS, and this is completely bogus. BR2_PACKAGE_LINUX_HEADERS is only valid when an internal toolchain is used. When an external toolchain is used, BR2_PACKAGE_LINUX_HEADERS is always disabled. So it shouldn't be used in packages. This is something that should be fixed in iputils. In fact, kernel headers are always available, as they are provided by the toolchain. So this dependency doesn't make sense.
Could you investigate how USE_CRYPTO=kernel is working, i.e which APIs/headers it requires ?
Besides this particular problem, the rest of the patch looks good to me.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH RESEND v3 1/1 package/iputils: add configs to select which binaries are built
In reply to Alejandro GonzálezQuoted 20 lines · On Sun, 15 Sep 2019 12:05:46 +0200 Alejandro Gonz?lez…
By default, the iputils build script might build binaries which are useless for certain applications, like tftpd or ninfod. Those binaries will add to the target filesystem size unless a post-build script removes them manually, which is cumbersome and doesn't shorten build times.
In particular, in a certain aarch64 Buildroot project with musl selected as a C library, this patch allowed to shrink the full iputils package from 219 KiB (if every option is selected) to 63 KiB (with only the ping binary selected) - a 71.2% relative size decrease.
Moreover, upstream recently introduced a commit that disabled tftpd from building by default, like rarpd. In the current state of things, this change will introduce inconveniences for Buildroot users which prefer to use the tftpd implementation provided by this package. With this patch, however, that decision and similar future ones won't be a concern, because they will have complete control of what binaries are built.
These changes add
Kconfigoptions which let the user select what binaries are built with ease.
Quoted 8 lines
Signed-off-by Alejandro Gonz?lez <[email protected]>---
Changes v2 -> v3:
- Several style revisions (suggested by Arnout)
- Simplify ninfod crypto dependencies logic (suggested by Arnout)
- Better explain the rationale for this patch in the commit message
I have finally applied to master. The ninfod situation is now simpler because iputils no longer needs any external crypto library.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH RESEND v3 1/1 package/iputils: add configs to select which binaries are built
El jue., 3 sept. 2020 a las 21:49, Thomas Petazzoni (<[email protected]>) escribi?:
Quoted 2 lines
I have finally applied to master. The ninfod situation is now simpler because iputils no longer needs any external crypto library.
Neat! I lost interest over time for this patch after finding better ways to shrink the resulting image size, but it's good to see that finally it could be merged :)