Skip to contentSkip to conversation

util-linux: rework utilities menu for finer control

PATCH Superseded Danomi Manchego 2 participants 7 messages Jul 11, 2015 – Oct 4, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover util-linux: rework utilities menu for finer control

This series changes the util-linux tool setup to support more scenarios.

Previously supported by buildroot:

a. Build libraries only.
- Occurred when "install utilities" disabled.

b. Build basic set of tools which do not have separate config-time enables.
- Examples of the basic set of utils that were installed whether you wanted them or not: dmesg, blkid, fdisk, flock, hexdump, logger, swapoff, ...
- Many of these tools overlap with BusyBox applets.
- Occurred when "install utilities" enabled, but no others.

c. Build basic set of tools, plus additional tools accessible by buildroot kconfig.

With the patch series, we introduce the possibility of:

d. Selectively build tools, without getting the basic set of utils.
- This lets us keep BusyBox for most things, and only add what is actually needed from util-linux.

e. Build everything.

To get to this point, the patches do the following:

- Introduce new "basic set" option.

- Introduce missing options for "line" and "tunelp".

- Change boolean "install utilities" to a choice of none/all/custom.

- none:
- In menu, hide individual options.
- Configure with --disable-all-programs.

- all:
- In menu, hide individual options.
- Configure with --enable-all-programs.

- custom:
- In menu, show individual options.
- Configure with --disable-all-programs if "basic set" is not enabled.

- Hide all the util-linux options in a menuconfig, as the option list is quite long.

The series was tested as follows:

- "Install utilities" set to "none" matches (a) above. No apps are built.

- "Install utilities" set to "custom" with only the "basic set" enabled matches (b).

- "Install utilities" set to "custom" with only one app enabled results in only that app built, and the libraries, without the "basic set" described in "b".

- "Install utilities" set to "all" matches the output of a custom build with all the individual options enabled.

Danomi Manchego (3):
util-linux: add more tool select options
util-linux: rework utilities menu for finer control
util-linux: put package options in a sub-menu

 package/util-linux/Config.in     |   59 ++++++++++++++++++++++++++++++++++----
 package/util-linux/util-linux.mk |   17 ++++++-----
 2 files changed, 64 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/3 util-linux: add more tool select options

Add more options to Config.in to optionally select or deselect util-linux "line" and "tunelp" tools.

---
 package/util-linux/Config.in     |   11 +++++++++++
 package/util-linux/util-linux.mk |    2 ++
 2 files changed, 13 insertions(+)
package/util-linux/Config.in +11 -0
index 39df11c..e0a25bf 100644
@@ -120,6 +120,11 @@ config BR2_PACKAGE_UTIL_LINUX_LAST
 	help
 	  Show a listing of last logged in users
 
+config BR2_PACKAGE_UTIL_LINUX_LINE
+	bool "line"
+	help
+	  Read one line
+
 config BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS
 	bool "login utilities"
 	depends on (BR2_ENABLE_LOCALE && BR2_USE_WCHAR) # linux-pam
@@ -230,6 +235,12 @@ config BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT
 	help
 	  Switch to another filesystem as the root of the mount tree
 
+config BR2_PACKAGE_UTIL_LINUX_TUNELP
+	bool "tunelp"
+	select BR2_PACKAGE_NCURSES
+	help
+	  Set various parameters for the lp device
+
 config BR2_PACKAGE_UTIL_LINUX_UL
 	bool "ul"
 	select BR2_PACKAGE_NCURSES
package/util-linux/util-linux.mk +2 -0
index 3ca147a..116596f 100644
@@ -84,6 +84,7 @@ UTIL_LINUX_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LIBMOUNT),--enable-libmount,--disable-libmount) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS),--enable-libsmartcols,--disable-libsmartcols) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LIBUUID),--enable-libuuid,--disable-libuuid) \
+	$(if $(BR2_PACKAGE_UTIL_LINUX_LINE),--enable-line,--disable-line) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),--enable-last --enable-login --enable-runuser --enable-su --enable-sulogin,--disable-last --disable-login --disable-runuser --disable-su --disable-sulogin) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LOSETUP),--enable-losetup,--disable-losetup) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_MESG),--enable-mesg,--disable-mesg) \
@@ -103,6 +104,7 @@ UTIL_LINUX_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_SETPRIV),--enable-setpriv,--disable-setpriv) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_SETTERM),--enable-setterm,--disable-setterm) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_SWITCH_ROOT),--enable-switch_root,--disable-switch_root) \
+	$(if $(BR2_PACKAGE_UTIL_LINUX_TUNELP),--enable-tunelp,--disable-tunelp) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_UL),--enable-ul,--disable-ul) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_UNSHARE),--enable-unshare,--disable-unshare) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_UTMPDUMP),--enable-utmpdump,--disable-utmpdump) \
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/3 util-linux: add more tool select options

Dear Danomi Manchego,

Quoted 8 lines · Danomi Manchego

Add more options to Config.in to optionally select or deselect util-linux "line" and "tunelp" tools.

---
 package/util-linux/Config.in     |   11 +++++++++++
 package/util-linux/util-linux.mk |    2 ++
 2 files changed, 13 insertions(+)

Applied, thanks.

Thomas

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

PATCH v2 2/3 util-linux: rework utilities menu for finer control

In reply to Danomi Manchego

When even a single extra util-linux utility is enabled, the default build and install will install many more programs, including many that overlap with those offered by busybox.

Fix by reworking the install-utilies menu to take advantage of the new --disable-all-programs config option. This option make it possible to disable the basic set of apps, and then enable only the desired apps.

---

Changes v1 -> v2:
- Rework to incorporate ideas and suggestions from Thomas Petazzoni and Arnout Vandecappelle. At least, in spirit.

---
 package/util-linux/Config.in     |   46 ++++++++++++++++++++++++++++++++++----
 package/util-linux/util-linux.mk |   15 +++++++------
 2 files changed, 50 insertions(+), 11 deletions(-)
package/util-linux/Config.in +42 -4
index e0a25bf..31ef12d 100644
@@ -35,17 +35,55 @@ config BR2_PACKAGE_UTIL_LINUX_LIBUUID
 	help
 	  Install libuuid.
 
-config BR2_PACKAGE_UTIL_LINUX_BINARIES
-	bool "install utilities"
+choice
+	prompt "Install utilities"
+	default BR2_PACKAGE_UTIL_LINUX_NO_BINARIES
+
+config BR2_PACKAGE_UTIL_LINUX_NO_BINARIES
+	bool "none"
+	help
+	  Disable all util-linux binaries.
+
+config BR2_PACKAGE_UTIL_LINUX_ALL_BINARIES
+	bool "all"
+	depends on BR2_USE_MMU # fork()
+	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
+	select BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
+	select BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	select BR2_PACKAGE_LINUX_PAM  # login utils
+	select BR2_PACKAGE_ZLIB  # cramfs
+	select BR2_PACKAGE_NCURSES  # more, setterm, ul
+	select BR2_PACKAGE_LIBCAP_NG  # setpriv
+	help
+	  Install the complete set of util-linux binaries.
+
+config BR2_PACKAGE_UTIL_LINUX_SELECTED_BINARIES
+	bool "custom"
 	depends on BR2_USE_MMU # fork()
 	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
 	select BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
 	select BR2_PACKAGE_UTIL_LINUX_LIBSMARTCOLS
 	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
 	help
-	  Install the basic set of util-linux binaries.
+	  Manually select which util-linux binaries to install.
+
+endchoice
+
+if BR2_PACKAGE_UTIL_LINUX_SELECTED_BINARIES
+
+config BR2_PACKAGE_UTIL_LINUX_BASIC_SET
+	bool "Basic set"
+	help
+	  Install a basic set of util-linux binaries.
 
-if BR2_PACKAGE_UTIL_LINUX_BINARIES
+	  blkdiscard, blkid, blockdev, cal, chcpu, col, colcrt, colrm, column,
+	  ctrlaltdel, dmesg, fdisk, findfs, findmnt, flock, fsfreeze, fstrim,
+	  getopt, hexdump, ipcmk, ipcrm, ipcs, isosize, ldattach, linux32,
+	  linux64, logger, look, lsblk, lscpu, lslocks, lslogins, mcookie,
+	  mkfs, mkswap, namei, prlimit, readprofile, renice, rev, rtcwake,
+	  script, scriptreplay, setarch, setsid, sfdisk, swaplabel, swapoff,
+	  swapon, tailf, uname26, uuidgen, whereis, wipefs
 
 config BR2_PACKAGE_UTIL_LINUX_AGETTY
 	bool "agetty"
package/util-linux/util-linux.mk +8 -7
index 116596f..fc94a99 100644
@@ -65,8 +65,14 @@ UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib)
 # Used by login-utils
 UTIL_LINUX_DEPENDENCIES += $(if $(BR2_PACKAGE_LINUX_PAM),linux-pam)
 
+ifeq ($(BR2_PACKAGE_UTIL_LINUX_NO_BINARIES),y)
+UTIL_LINUX_CONF_OPTS += --disable-all-programs
+else ifeq ($(BR2_PACKAGE_UTIL_LINUX_ALL_BINARIES),y)
+UTIL_LINUX_CONF_OPTS += --enable-all-programs
+else
 # Disable/Enable utilities
 UTIL_LINUX_CONF_OPTS += \
+	$(if $(BR2_PACKAGE_UTIL_LINUX_BASIC_SET),,--disable-all-programs) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_AGETTY),--enable-agetty,--disable-agetty) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_ARCH),--enable-arch,--disable-arch) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_BFS),--enable-bfs,--disable-bfs) \
@@ -114,6 +120,7 @@ UTIL_LINUX_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_WDCTL),--enable-wdctl,--disable-wdctl) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_WRITE),--enable-write,--disable-write) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_ZRAMCTL),--enable-zramctl,--disable-zramctl)
+endif
 
 # In the host version of util-linux, we so far only require libuuid,
 # and none of the util-linux utilities, so we disable all of them, unless
@@ -132,12 +139,6 @@ else
 HOST_UTIL_LINUX_CONF_OPTS += --disable-all-programs
 endif
 
-# Avoid building the tools if they are disabled since we can't install on
-# a per-directory basis.
-ifeq ($(BR2_PACKAGE_UTIL_LINUX_BINARIES),)
-UTIL_LINUX_CONF_OPTS += --disable-all-programs
-endif
-
 # Install PAM configuration files
 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),y)
 define UTIL_LINUX_INSTALL_PAMFILES
@@ -153,7 +154,7 @@ endif
 UTIL_LINUX_POST_INSTALL_TARGET_HOOKS += UTIL_LINUX_INSTALL_PAMFILES
 
 # Install agetty->getty symlink to avoid breakage when there's no busybox
-ifeq ($(BR2_PACKAGE_UTIL_LINUX_AGETTY),y)
+ifneq ($(BR2_PACKAGE_UTIL_LINUX_ALL_BINARIES)$(BR2_PACKAGE_UTIL_LINUX_AGETTY),)
 ifeq ($(BR2_PACKAGE_BUSYBOX),)
 define UTIL_LINUX_GETTY_SYMLINK
 	ln -sf agetty $(TARGET_DIR)/sbin/getty
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 3/3 util-linux: put package options in a sub-menu

In reply to Danomi Manchego

Hide all the util-linux options in a menuconfig, as the option list is quite long.

---
 package/util-linux/Config.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/util-linux/Config.in +1 -1
index 31ef12d..82c71d4 100644
@@ -1,4 +1,4 @@
-config BR2_PACKAGE_UTIL_LINUX
+menuconfig BR2_PACKAGE_UTIL_LINUX
 	bool "util-linux"
 	depends on BR2_USE_WCHAR
 	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE
Signature · 1 line
1.7.9.5
#5 lore raw

v2 cover util-linux: rework utilities menu for finer control

In reply to Danomi Manchego

Dear Danomi Manchego,

Quoted 1 line · Danomi Manchego

This series changes the util-linux tool setup to support more scenarios.

Thanks. util-linux definitely needs some love. However, can you comment on backward compatibility in terms of Config.in option? I.e, what happens if a Buildroot user has an existing .config which uses util-linux, and upgrades Buildroot to a version that contains your patches. What will happen?

In any case, your patch 2/3 is removing BR2_PACKAGE_UTIL_LINUX_BINARIES, so you should update Config.in.legacy accordingly.

Best regards,

Thomas

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

v2 cover util-linux: rework utilities menu for finer control

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Dear Danomi Manchego,

Quoted 1 line · Danomi Manchego

This series changes the util-linux tool setup to support more scenarios.

Thanks. util-linux definitely needs some love. However, can you comment on backward compatibility in terms of Config.in option? I.e, what happens if a Buildroot user has an existing .config which uses util-linux, and upgrades Buildroot to a version that contains your patches. What will happen?

Quoted 3 lines

In any case, your patch 2/3 is removing BR2_PACKAGE_UTIL_LINUX_BINARIES, so you should update Config.in.legacy accordingly.

With the series as sent, it looks like the new config would cause a defconfig with tools selected to go to having no tools selected. So, not so good.

I can add a legacy option with the help indicating that the "custom" choice must be selected (like some of the lua legacy options). But - we can actually preserve backwards-compatibility if I change BR2_PACKAGE_UTIL_LINUX_SELECTED_BINARIES to match the previous BR2_PACKAGE_UTIL_LINUX_BINARIES ("BINARIES" vs the other choices "ALL_BINARIES" and "NO_BINARIES"). Its not what one would do when coding from scratch, but it avoids needing to add the legacy option.

(We could even claim perfect backwards compatibility if we enable the "basic set" of tools by default, though it seems like changing that particular default is not a priority for anyone.)

Any objection to reusing the old config name?

Danomi -

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com