diff mbox

[1/1] tftpd: make installation of tftp client optional

Message ID 6A3F8AF4AF06764EBB67BDF72AE0FB4701F8E8F554@ly-ex-02.thrane.tt.ad
State Rejected
Headers show

Commit Message

Nielsen, David Marqvar Nov. 30, 2016, 9:23 a.m. UTC
Signed-off-by: David Marqvar <david.nielsen@cobham.com>
---
 package/tftpd/Config.in |  8 ++++++++
 package/tftpd/tftpd.mk  | 11 ++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

Comments

Thomas Petazzoni Dec. 5, 2016, 9:29 p.m. UTC | #1
Hello,

On Wed, 30 Nov 2016 09:23:19 +0000, Nielsen, David Marqvar wrote:
> Signed-off-by: David Marqvar <david.nielsen@cobham.com>
> ---
>  package/tftpd/Config.in |  8 ++++++++
>  package/tftpd/tftpd.mk  | 11 ++++++++---
>  2 files changed, 16 insertions(+), 3 deletions(-)

Your commit log is empty, so I'm not sure what you're trying to do
here. If I understand correctly, you want a sub-option to
enable/disable the installation of the "tftp" binary, so that you can
have a configuration where:

 - tftpd is the one coming from the tftpd package

 - tftp remains the one provided by Busybox

However, in Buildroot, we try to avoid having one sub-option per binary
program. We do have that in a few packages, and it's often very painful
and annoying to maintain. If you really, really don't like the tftp
program from the tftpd package, you can also add in your post-build
script:

	rm /usr/bin/tftp
	ln -s /bin/busybox /usr/bin/tftp

But I just checked and the tftp program installed by the tftp package
is only 22 KB in size:

thomas@skate:~/projets/buildroot (master)$ ls -l output/target/usr/bin/tftp 
-rwxr-xr-x 1 thomas thomas 22252 déc.   5 22:24 output/target/usr/bin/tftp

So I really don't think it's worth the effort having yet another
sub-option for 22 KB, especially when you can handle such tweaking in
your post-build script if you really really want to.

Thanks!

Thomas
Nielsen, David Marqvar Dec. 6, 2016, 7:07 a.m. UTC | #2
Hi Thomas Petazzoni,

> Your commit log is empty, so I'm not sure what you're trying to do
> here. If I understand correctly, you want a sub-option to
> enable/disable the installation of the "tftp" binary, so that you can
> have a configuration where:
> - tftpd is the one coming from the tftpd package
> - tftp remains the one provided by Busybox

Exactly.
The (rather unusual) situation is that the Busybox implementation has
features that the "full" tftpd package does not support - features that
we have come to rely on (set block size).

> However, in Buildroot, we try to avoid having one sub-option per binary
> program. We do have that in a few packages, and it's often very painful
> and annoying to maintain.

Ok.

> If you really, really don't like the tftp
> program from the tftpd package, you can also add in your post-build
> script:
> rm /usr/bin/tftp
> ln -s /bin/busybox /usr/bin/tftp

Thank you for this idea.

> But I just checked and the tftp program installed by the tftp package
> is only 22 KB in size:
> So I really don't think it's worth the effort having yet another
> sub-option for 22 KB, especially when you can handle such tweaking in
> your post-build script if you really really want to.

I agree.
Thank you very much for your response.

/David
Baruch Siach Dec. 6, 2016, 7:20 a.m. UTC | #3
Hi David,

On Tue, Dec 06, 2016 at 07:07:36AM +0000, Nielsen, David Marqvar wrote:
> > Your commit log is empty, so I'm not sure what you're trying to do
> > here. If I understand correctly, you want a sub-option to
> > enable/disable the installation of the "tftp" binary, so that you can
> > have a configuration where:
> > - tftpd is the one coming from the tftpd package
> > - tftp remains the one provided by Busybox
> 
> Exactly.
> The (rather unusual) situation is that the Busybox implementation has
> features that the "full" tftpd package does not support - features that
> we have come to rely on (set block size).

The atftp TFTP client seems to support block size set:

  --option "blksize 1428"

baruch
diff mbox

Patch

diff --git a/package/tftpd/Config.in b/package/tftpd/Config.in
index ea5cb30..9d6addd 100644
--- a/package/tftpd/Config.in
+++ b/package/tftpd/Config.in
@@ -6,3 +6,11 @@  config BR2_PACKAGE_TFTPD
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	help
 	  HPA's Trivial File Transfer Protocol (tftp) server.
+
+config BR2_PACKAGE_TFTPD_OVERRIDE_BUSYBOX_TFTP
+	bool "install tftp"
+	default y
+	depends on BR2_PACKAGE_TFTPD
+	depends on BR2_PACKAGE_BUSYBOX
+	help
+	  This will also override tftp from Busybox
diff --git a/package/tftpd/tftpd.mk b/package/tftpd/tftpd.mk
index 78df835..8080f97 100644
--- a/package/tftpd/tftpd.mk
+++ b/package/tftpd/tftpd.mk
@@ -9,13 +9,18 @@  TFTPD_SOURCE = tftp-hpa-$(TFTPD_VERSION).tar.xz
 TFTPD_SITE = $(BR2_KERNEL_MIRROR)/software/network/tftp/tftp-hpa
 TFTPD_CONF_OPTS = --without-tcpwrappers
 
-# Override BusyBox implementations if BusyBox is enabled.
-ifeq ($(BR2_PACKAGE_BUSYBOX),y)
+
+ifeq ($(BR2_PACKAGE_TFTPD_OVERRIDE_BUSYBOX_TFTP),y)
+# override BusyBox - install after busybox
 TFTPD_DEPENDENCIES += busybox
+define TFTPD_INSTALL_TARGET_TFTP
+	$(INSTALL) -D $(@D)/tftp/tftp $(TARGET_DIR)/usr/bin/tftp
+endef
 endif
 
+
 define TFTPD_INSTALL_TARGET_CMDS
-	$(INSTALL) -D $(@D)/tftp/tftp $(TARGET_DIR)/usr/bin/tftp
+	$(TFTPD_INSTALL_TARGET_TFTP)
 	$(INSTALL) -D $(@D)/tftpd/tftpd $(TARGET_DIR)/usr/sbin/tftpd
 endef