Skip to contentSkip to conversation

coreutils: use single binary in symlink method, with merged usr

PATCH New Carlos Santos 2 participants 5 messages Sep 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coreutils: use single binary in symlink method, with merged usr

The symlink method is faster, since there is no shell fork/exec, and provides extra space savings. Keep using the shebang method without merged usr, because it makes easier to move binaries into other directories.

---
 package/coreutils/coreutils.mk | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
package/coreutils/coreutils.mk +8 -2
index 6a8a31b..721c711 100644
@@ -14,7 +14,7 @@ COREUTILS_LICENSE_FILES = COPYING
 COREUTILS_AUTORECONF = YES
 COREUTILS_GETTEXTIZE = YES
 
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=shebangs \
+COREUTILS_CONF_OPTS = --disable-rpath \
 	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
 COREUTILS_CONF_ENV = ac_cv_c_restrict=no \
 	ac_cv_func_chown_works=yes \
@@ -101,9 +101,15 @@ COREUTILS_CONF_OPTS += --with-openssl=yes
 COREUTILS_DEPENDENCIES += openssl
 endif
 
+# Build as a single binary for some neat space savings. Use the symlink method
+# with merged usr. Otherwise use the shebang method since it allows us to move
+# binaries into other directories whereas for symlink that wouldn't be so easy.
 ifeq ($(BR2_ROOTFS_MERGED_USR),)
+COREUTILS_CONF_OPTS += --enable-single-binary=symlinks
+else
+COREUTILS_CONF_OPTS += --enable-single-binary=shebangs
 define COREUTILS_CLEANUP_BIN
-	# some things go in root rather than usr
+	# some things go in /bin rather than /usr/bin
 	for f in $(COREUTILS_BIN_PROGS); do \
 		mv -f $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f || exit 1; \
 	done
Signature · 1 line
2.7.5
#1 lore raw

PATCH 1/1 coreutils: use single binary in symlink method, with merged usr

Quoted 35 lines

From: "Carlos Santos" <[email protected]>
To: buildroot at buildroot.org
Sent: Wednesday, September 27, 2017 1:23:31 PM
Subject: [Buildroot] [PATCH] coreutils: use single binary in symlink method, with merged usr

The symlink method is faster, since there is no shell fork/exec, and provides extra space savings. Keep using the shebang method without merged usr, because it makes easier to move binaries into other directories.

---
package/coreutils/coreutils.mk | 10 ++++++++--

1 file changed, 8 insertions(+), 2 deletions(-)
package/coreutils/coreutils.mk +0 -0
index 6a8a31b..721c711 100644
@@ -14,7 +14,7 @@ COREUTILS_LICENSE_FILES = COPYING

COREUTILS_AUTORECONF = YES
COREUTILS_GETTEXTIZE = YES

package/coreutils/coreutils.mk +1 -1
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=shebangs \
+COREUTILS_CONF_OPTS = --disable-rpath \
	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
COREUTILS_CONF_ENV = ac_cv_c_restrict=no \
	ac_cv_func_chown_works=yes \
package/coreutils/coreutils.mk +0 -0
@@ -101,9 +101,15 @@ COREUTILS_CONF_OPTS += --with-openssl=yes

COREUTILS_DEPENDENCIES += openssl
endif

package/coreutils/coreutils.mk +3 -0
+# Build as a single binary for some neat space savings. Use the symlink method
+# with merged usr. Otherwise use the shebang method since it allows us to move
+# binaries into other directories whereas for symlink that wouldn't be so easy.
Quoted 1 line

ifeq ($(BR2_ROOTFS_MERGED_USR),)

Sorry, I sent the wrong patch. This should be "ifeq ($(BR2_ROOTFS_MERGED_USR),y)"

Quoted 11 lines
package/coreutils/coreutils.mk +3 -0
+COREUTILS_CONF_OPTS += --enable-single-binary=symlinks
+else
+COREUTILS_CONF_OPTS += --enable-single-binary=shebangs

define COREUTILS_CLEANUP_BIN

package/coreutils/coreutils.mk +1 -1
-	# some things go in root rather than usr
+	# some things go in /bin rather than /usr/bin
	for f in $(COREUTILS_BIN_PROGS); do \
		mv -f $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f || exit 1; \
	done

--
2.7.5

Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens
#2 lore raw

PATCH v2 1/1 coreutils: use single binary in symlink method, with merged usr

In reply to Carlos Santos

The symlink method is faster, since there is no shell fork/exec, and provides extra space savings. Keep using the shebang method without merged usr, because it makes easier to move binaries into other directories.

Change-Id Iad19df24a7428f8a3c0d87d62da57c659b0378d1
---
 package/coreutils/coreutils.mk | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
package/coreutils/coreutils.mk +9 -3
index 6a8a31b..4b9dc99 100644
@@ -14,7 +14,7 @@ COREUTILS_LICENSE_FILES = COPYING
 COREUTILS_AUTORECONF = YES
 COREUTILS_GETTEXTIZE = YES
 
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=shebangs \
+COREUTILS_CONF_OPTS = --disable-rpath \
 	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
 COREUTILS_CONF_ENV = ac_cv_c_restrict=no \
 	ac_cv_func_chown_works=yes \
@@ -101,9 +101,15 @@ COREUTILS_CONF_OPTS += --with-openssl=yes
 COREUTILS_DEPENDENCIES += openssl
 endif
 
-ifeq ($(BR2_ROOTFS_MERGED_USR),)
+# Build as a single binary for some neat space savings. Use the symlink method
+# with merged usr. Otherwise use the shebang method since it allows us to move
+# binaries into other directories whereas for symlink that wouldn't be so easy.
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+COREUTILS_CONF_OPTS += --enable-single-binary=symlinks
+else
+COREUTILS_CONF_OPTS += --enable-single-binary=shebangs
 define COREUTILS_CLEANUP_BIN
-	# some things go in root rather than usr
+	# some things go in /bin rather than /usr/bin
 	for f in $(COREUTILS_BIN_PROGS); do \
 		mv -f $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f || exit 1; \
 	done
Signature · 1 line
2.7.5
#3 lore raw

PATCH v2 1/1 coreutils: use single binary in symlink method, with merged usr

Hello,

Quoted 4 lines · Carlos Santos

The symlink method is faster, since there is no shell fork/exec, and provides extra space savings. Keep using the shebang method without merged usr, because it makes easier to move binaries into other directories.

I'm not sure why we would want to make a difference between merged /usr and non-merged /usr. Is the shebang method really useful/interesting? Busybox is using symlinks, and that is just fine. Why not do the same for coreutils?

In addition, having too many differences between merged /usr and non-merged /usr is a test/maintenance burden.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/1 coreutils: use single binary in symlink method, with merged usr

Quoted 14 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org
Sent: Wednesday, September 27, 2017 4:12:10 PM
Subject: Re: [Buildroot] [PATCH v2] coreutils: use single binary in symlink method, with merged usr

Hello,

Quoted 4 lines · Carlos Santos

The symlink method is faster, since there is no shell fork/exec, and provides extra space savings. Keep using the shebang method without merged usr, because it makes easier to move binaries into other directories.

Quoted 4 lines

I'm not sure why we would want to make a difference between merged /usr and non-merged /usr. Is the shebang method really useful/interesting? Busybox is using symlinks, and that is just fine. Why not do the same for coreutils?

It is useful just because some binaries need to be moved after the installation (see commit 03f87430e54d11912e707cad105fc4f2a2590aba message)

Quoted 2 lines

In addition, having too many differences between merged /usr and non-merged /usr is a test/maintenance burden.

Yeah, I'd rater declare merged usr as the standard and stop worrying about this. BusyBox, coreutils, util-linux, sysvinit and procps-ng (just to name a few), competing for the ownership of the same utilities.

Even worst, they install those utilities in different places, so we may end-up with two different implementations of link, mktemp, nice printenv, free, top, uptime, w, killall5, getopt, linux32, linux64, setarch, setpriv and fsfreeze (and I'm suspicious that this list is not complete).

Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens